2013-04-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
[external/binutils.git] / gold / ChangeLog
1 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2
3         * output.cc (Output_section::add_merge_input_section): Allow
4         to merge sections if the alignment is more than character size.
5         * merge.h (Output_merge_string::Output_merge_string): Remove
6         assert.
7         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
8         only not-null strings. Check the alignment of strings.
9         * stringpool.h
10         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
11         alignment as the argument.
12         (Stringpool_template<Stringpool_char>::addralign_): New class member.
13         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
14         Align non-zero length strings according to the addralign_.
15         (Stringpool_template<Stringpool_char>::set_string_offsets):
16         Updating offsets according to the given alignment.
17         * testsuite/Makefile.am (text_section_grouping): Test if string
18         literals are getting merged.
19         * testsuite/Makefile.in: Regenerate.
20         * testsuite/merge_string_literals_1.c: New file.
21         * testsuite/merge_string_literals_2.c: Ditto.
22         * testsuite/merge_string_literals.sh: Ditto.
23
24 2013-04-26  Ian Lance Taylor  <iant@google.com>
25
26         * target-reloc.h (relocate_section): If the reloc offset is out of
27         range, pass VIEW as NULL to relocate.relocate.
28         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
29         * i386.cc (Target_i386::Relocate::relocate): Likewise.
30         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
31         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
32         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
33         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
34
35 2013-04-26  Geoff Pike  <gpike@chromium.org>
36
37         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
38         * layout.cc (Hash_task): New class.
39         (Layout::queue_build_id_tasks): New function.
40         (Layout::write_build_id): Handle single-thread portion of build ID
41         computation.  (In some cases, all of it is single-threaded.)  Replace
42         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
43         functionality in fewer lines of code.
44         * layout.h (Layout::queue_build_id_tasks): New function declaration.
45         * options.h (General_options): make "--build-id" default to tree
46         rather than sha1.  Add two new options related to --build-id=tree:
47         --build-id-chunk-size-for-treehash and
48         --build-id-min-file-size-for-treehash.
49         * Makefile.am: add testing of --build-id=tree and related new options
50         (these tests will be invoked by "make check").
51         * Makefile.in: Regenerate.
52
53 2013-04-25  Alan Modra  <amodra@gmail.com>
54
55         * configure.tgt: Add powerpcle and powerpc64le.
56
57 2013-04-22  Alan Modra  <amodra@gmail.com>
58
59         PR gold/15355
60         * layout.cc (Layout::segment_precedes): Allow more than one
61         segment with the same type and flags.
62
63 2013-04-15  Cary Coutant  <ccoutant@google.com>
64
65         * layout.cc (Layout::set_relocatable_section_offsets): Don't
66         allocate space in file for BSS sections.
67
68 2013-04-15  Cary Coutant  <ccoutant@google.com>
69
70         * script-sections.cc (Orphan_output_section): Reset address
71         to zero after each orphaned section for relocatable links.
72
73 2013-04-15  Cary Coutant  <ccoutant@google.com>
74
75         * symtab.cc (Symbol_table::sized_write_globals): Subtract
76         section starting address for relocatable link.
77         * testsuite/Makefile.am (script_test_11): New test.
78         * testsuite/Makefile.in: Regenerate.
79         * testsuite/script_test_11.c: New source file.
80         * testsuite/script_test_11.t: New linker script.
81
82 2013-04-13  Alan Modra  <amodra@gmail.com>
83
84         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
85         owner when sections are not adjacent and exceed group size.
86         (Target_powerpc::group_sections): Handle corner case.
87         (Target_powerpc::Branch_info::make_stub): Handle case where
88         stub table doesn't exist due to branches in non-exec sections.
89         (Target_powerpc::Relocate::relocate): Likewise.
90
91 2013-04-11  Alan Modra  <amodra@gmail.com>
92
93         PR gold/15354
94         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
95         .branch_lt to match bfd ld.  Adjust comments throughout file.
96
97 2013-04-04  Ian Lance Taylor  <iant@google.com>
98
99         GCC PR c++/56840
100         * object.cc (do_layout_deferred_sections): Handle .eh_frame
101         sections before checking whether they are included in the link.
102
103 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
104
105         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
106         object before calling the plugin claim_file handler.  Pass the elf
107         object of the archive to the plugin. Delete the elf object if the
108         plugin claims the file.
109
110 2013-03-21  Alan Modra  <amodra@gmail.com>
111
112         * layout.cc (Layout::set_segment_offsets): Accept writable .text
113         segment when omagic.
114
115 2013-03-21  Alan Modra  <amodra@gmail.com>
116
117         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
118         comparison warning.
119         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
120         uninitialized" warning.
121
122 2013-03-20  Alan Modra  <amodra@gmail.com>
123
124         * symtab.h (Symbol::clear_version): New function.
125         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
126         is_needed by weak references.  Clear version for symbols defined
127         in as-needed objects that are not needed.
128
129 2013-03-15  Alan Modra  <amodra@gmail.com>
130
131         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
132         static and public.  Add report_err param.  Return false for data refs.
133         (Target_powerpc::rela_dyn_section): New overloaded function.
134         (Target_powerpc::plt_, iplt_): Elucidate.
135         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
136         (Output_data_plt_powerpc::do_write): Don't write .iplt.
137         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
138         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
139         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
140         push_branch and make_plt_entry for ifunc syms when
141         reloc_needs_plt_for_ifunc.
142         (Target_powerpc::Relocate::relocate): Don't use plt entry value
143         for ifunc unless reloc_needs_plt_for_ifunc.
144
145 2013-03-15  Alan Modra  <amodra@gmail.com>
146
147         * gc.h (gc_process_relocs): Don't look through function descriptors.
148         * icf.cc (get_section_contents): Do so here instead.
149
150 2013-03-13  Alan Modra  <amodra@gmail.com>
151
152         * powerpc.cc (is_branch_reloc): Forward declare.
153         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
154         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
155         false for 64-bit, true for 32-bit non-branch relocs.
156         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
157         * testsuite/Makefile.am (icf_test): Use linker map file instead of
158         nm output.
159         (icf_safe_test): Generate linker map file as well as nm output.
160         (icf_safe_so_test): Likewise.
161         * testsuite/Makefile.in: Regenerate.
162         * testsuite/icf_test.sh: Parse linker map file to determine
163         section folding.
164         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
165         * testsuite/icf_safe_so_test.sh: Likewise.
166         (X86_32_or_ARM_specific_safe_fold): Merge into..
167         (arch_specific_safe_fold): ..this.
168         (X86_64_specific_safe_fold): Delete unused function.
169
170 2013-03-12  Alan Modra  <amodra@gmail.com>
171
172         * gc.h (gc_process_relocs): Look through function descriptors
173         to determine shndx, symvalue and addend used by ICF.  Tidy
174         variable duplication.
175
176 2013-03-11  Alan Modra  <amodra@gmail.com>
177
178         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
179         * layout.cc (Layout_task_runner::run): ..to here.
180         * symtab.h (struct Symbol_location): Extract from..
181         (class Symbol_table): ..here.
182         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
183         * target.h (class Target): Add function_location and
184         do_function_location functions.
185         (class Sized_target): Add do_function_location.
186         * object.h (class Sized_relobj_file): Move find_shdr..
187         (class Object): ..to here.
188         * object.cc: Likewise.  Update to suit.  Instantiate.
189         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
190         * powerpc.cc (class Powerpc_dynobj): New.
191         (Target_powerpc::do_function_location): New function.
192         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
193         (Powerpc_dynobj::do_read_symbols): New function.
194         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
195
196 2013-03-08  Ian Lance Taylor  <iant@google.com>
197
198         * options.cc (General_options::string_to_object_format): Accept
199         "default".
200
201 2013-03-08  Alan Modra  <amodra@gmail.com>
202
203         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
204         pointer to Post_fde.
205         (struct Post_fde): Move definition to here..
206         * ehframe.cc (struct Post_fde): ..from here.
207         (Cie::write): Don't alloc Post_fde.
208         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
209
210 2013-03-07  Alan Modra  <amodra@gmail.com>
211
212         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
213         relocation referencing .LC0.
214         * testsuite/discard_locals_test.sh: Remove FIXMEs.
215
216 2013-03-07  Alan Modra  <amodra@gmail.com>
217
218         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
219         always_inline.  Add assembly for powerpc to avoid GOT.
220
221 2013-03-07  Alan Modra  <amodra@gmail.com>
222
223         * testsuite/script_test_10.sh: Don't test .bss section
224         header number.
225
226 2013-03-06  Alan Modra  <amodra@gmail.com>
227
228         * powerpc.cc (class Powerpc_relobj): Move some member functions.
229         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
230         all callers.  Handle folded sections.
231         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
232         to Powerpc_relobj.
233         (Global_symbol_visitor_opd::operator()): Likewise.
234
235 2013-03-04  Alan Modra  <amodra@gmail.com>
236
237         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
238         * testsuite/Makefile.in: Regenerate.
239
240 2013-03-01  Cary Coutant  <ccoutant@google.com>
241
242         Add dwp support for v2 DWARF package file format.
243         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
244         tu_length parameter.  Adjust all callers.
245         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
246         * dwp.cc: Include dwarf.h.
247         (Section_bounds): New struct type.
248         (Unit_set): New struct type.
249         (Dwo_file::Dwo_file): Initialize new data member.
250         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
251         Combine and rename to...
252         (Dwo_file::read_unit_index): ...this.
253         (Dwo_file::sized_read_compunit_index)
254         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
255         (Dwo_file::sized_read_unit_index): ...this.
256         (Dwo_file::copy_section): Remove section_name, is_str_offsets
257         parameters; add section_id parameter.
258         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
259         (Dwo_file::add_unit_set): ...this.
260         (Dwo_file::shndx_map_): Remove.
261         (Dwo_file::sect_offsets_): New data member.
262         (Dwp_output_file::Dwp_output_file): Initialize new data members.
263         (Dwp_output_file::add_section): Rename to...
264         (Dwp_output_file::add_contribution): ...this.
265         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
266         (Dwp_output_file::add_tu_set): Likewise.
267         (Dwp_output_file::Contribution): New type.
268         (Dwp_output_file::Section::contributions): New data member.
269         (Dwp_output_file::Cu_or_tu_set): Remove.
270         (Dwp_output_file::Section::Section): New ctor.
271         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
272         (Dwp_output_file::Dwp_index::Section_table): New type.
273         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
274         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
275         parameter.
276         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
277         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
278         (Dwp_output_file::Dwp_index::section_table): New member function.
279         (Dwp_output_file::Dwp_index::section_table_end): New member function.
280         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
281         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
282         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
283         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
284         (Dwp_output_file::Dwp_index::section_table_): New data member.
285         (Dwp_output_file::Dwp_index::section_mask_): New data member.
286         (Dwp_output_file::add_output_section): New member function.
287         (Dwp_output_file::write_new_section): New member function.
288         (Dwp_output_file::write_contributions): New member function.
289         (Dwp_output_file::section_id_map_): New data member.
290         (class Dwo_id_info_reader): Remove.
291         (class Unit_reader): New class.
292         (get_dwarf_section_name): New function.
293         (Dwo_file::read_executable): Adjust initializations of class data.
294         (Dwo_file::read): Add support for v2 package file format.
295         (Dwo_file::read_unit_index): Likewise.
296         (Dwo_file::sized_read_unit_index): Likewise.
297         (Dwo_file::copy_section): Likewise.
298         (Dwo_file::add_unit_set): Likewise.
299         (Dwp_output_file::add_output_section): Likewise.
300         (Dwp_output_file::add_contribution): Likewise.
301         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
302         for empty slot.
303         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
304         file format.
305         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
306         slot.
307         (Dwp_output_file::initialize): Remove unused function.
308         (Dwp_output_file::finalize): Add support for v2 package file format.
309         (Dwp_output_file::write_index): Likewise.
310         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
311         function prototype.
312
313 2013-03-01  Cary Coutant  <ccoutant@google.com>
314
315         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
316         function into class definition in header file.
317         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
318         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
319         New function.
320         (Dwarf_info_reader::check_buffer): Move here from .cc file.
321
322 2013-02-28  Alan Modra  <amodra@gmail.com>
323
324         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
325         * target.cc (Target::do_plt_fde_location): New function.
326         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
327         accessor function, and constructor param.
328         (struct Post_fde, Post_fdes): Declare.
329         (Cie::write): Add post_fdes param.
330         * ehframe.cc (Fde::write): Use plt_fde_location.
331         (struct Post_fde): Define.
332         (Cie::write): Stash FDEs added post merge mapping.
333         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
334         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
335         (Eh_frame::do_sized_write): Arrange to write post map FDES after
336         other FDEs.
337         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
338         (Target_powerpc::has_glink): New function.
339         (Target_powerpc::do_relax): Add eh_frame info for stubs.
340         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
341         glink_eh_frame_fde_32, default_fde): New data.
342         (Stub_table::eh_frame_added_): New var.
343         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
344         Make const.
345         (Stub_table::add_eh_frame): New function.
346         (Output_data_glink::add_eh_frame): New function.
347         (Target_powerpc::make_glink_section): Call add_eh_frame.
348
349 2013-02-15  Ian Lance Taylor  <iant@google.com>
350
351         * options.h (DEFINE_uint64_alias): Define.
352         (class General_options): Add -Ttext-segment as an alias for
353         -Ttext.
354
355 2013-02-15  Alan Modra  <amodra@gmail.com>
356
357         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
358         (Stub_table::do_write): ..here, two places.
359         (Stub_table::plt_call_size): Use it here too.
360
361 2013-02-11  Ian Lance Taylor  <iant@google.com>
362
363         * descriptors.cc (Descriptors::close_all): New function.
364         * descriptors.h (class Descriptors): Declare close_all.
365         (close_all_descriptors): New inline function.
366         * plugin.cc: Include "descriptors.h".
367         (Plugin_manager::cleanup): Call close_all_descriptors.
368
369 2013-02-06  Alan Modra  <amodra@gmail.com>
370
371         * README: Update coding style link.
372
373 2013-01-28  Cary Coutant  <ccoutant@google.com>
374
375         * dwp.cc (File_list): New typedef.
376         (Dwo_name_info_reader): New class.
377         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
378         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
379         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
380         (Dwo_file::read_executable): New function.
381         (Dwo_file::read): Move common setup code to ...
382         (Dwo_file::make_object): ... here.
383         (dwp_options): Add --exec/-e.
384         (usage): Likewise.
385         (main): Likewise.
386
387 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
388
389         * layout.cc (Layout::layout): Check for option text_reorder.
390         (Layout::make_output_section): Ditto.
391         * options.h (text_reorder): New option.
392         * output.cc (Input_section_sort_compare): Remove special ordering
393         of section names.
394         (Output_section::
395          Input_section_sort_section_name_special_ordering_compare::
396          operator()): New function.
397         (Output_section::sort_attached_input_sections): Use new sort function
398         for .text.
399         * output.h (Input_section_sort_section_name_special_ordering_compare):
400         New struct.
401         * testsuite/Makefile.am (text_section_grouping): Test option
402         --no-text-reorder
403         * testsuite/Makefile.in: Regenerate.
404         * testsuite/text_section_grouping.sh: Check order of functions without
405         default text reordering.
406
407 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
408
409         * options.h (General_options): Change default to true for new_dtags.
410
411 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
412
413         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
414         when enable_new_dtags is false.  Only add DT_RUNPATH when
415         enable_new_dtags is true.
416
417 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
418
419         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
420         used in declaration and definition consistent.
421         (Target_powerpc::symval_for_branch): Ditto.
422
423 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
424
425         * testsuite/plugin_final_layout.cc: Fix comment.
426
427 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
428
429         * layout.cc (Layout::layout): Do not do default sorting for
430         text sections when section ordering is specified.
431         (make_output_section): Ditto.
432         * testsuite/plugin_final_layout.cc: Name the function sections
433         to catch reordering issues.
434
435 2013-01-15  Alan Modra  <amodra@gmail.com>
436
437         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
438         plt-thread-safe.
439
440 2013-01-15  Alan Modra  <amodra@gmail.com>
441
442         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
443         * testsuite/Makefile.in: Regenerate.
444
445 2013-01-14  Alan Modra  <amodra@gmail.com>
446
447         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
448         * testsuite/Makefile.in: Regenerate.
449
450 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
451
452         PR bfd/14430
453         Fix mingw gold build with plugins enabled
454         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
455         * configure.ac: Export DLOPEN_LIBS and add headers check.
456         * plugin.cc: Handle non-dlfcn case.
457         * Makefile.in: Regenerate.
458         * config.in: Regenerate.
459         * configure: Regenerate.
460         * testsuite/Makefile.in: Regenerate.
461
462 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
463
464         * output.h (sort_attached_input_sections): Change to be public.
465         * script-sections.cc
466         (Output_section_definition::set_section_addresses): Sort
467         attached input sections according to section order before linker
468         script assigns section addresses.
469         (Orphan_output_section::set_section_addresses): Sort
470         attached input sections according to section order before linker
471         script assigns section addresses.
472         * Makefile.am (final_layout.sh): Use a simple linker script to
473         check if section ordering still works.
474         * Makefile.in: Regenerate.
475
476 2013-01-09  Ben Cheng  <bccheng@google.com>
477
478         * arm.cc (Target_arm::attributes_accept_div): New function.
479         (Target_arm::attributes_forbid_div): New function.
480         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
481         attribute using the same new functions as what bfd/elf32_arm.c
482         does.
483
484 2013-01-07  Cary Coutant  <ccoutant@google.com>
485
486         PR gold/14993
487         * output.cc (Output_section::add_input_section): For incremental
488         updates, don't track input sections that are allocated from patch
489         space.
490
491 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
492             Ian Lance Taylor  <iant@google.com>
493
494         PR gold/14897
495         * configure.ac (--enable-ld): Removed.
496         (install_as_default): Set to yes only for --enable-gold=default
497         or --disable-ld.
498         * configure: Regenerated.
499
500 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
501
502         * options.h (General_options): Add -fuse-ld= for GCC linker
503         option compatibility.
504
505 2013-01-04  Cary Coutant  <ccoutant@google.com>
506
507         * configure.ac: Fix typo restoring CXXFLAGS.
508         * configure: Regenerate.
509
510 2013-01-04  Cary Coutant  <ccoutant@google.com>
511
512         * testsuite/Makefile.am (CXXLINK_S): New macro.
513         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
514         * testsuite/Makefile.in: Regenerate.
515
516 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
517
518         * version.cc (print_version): Update copyright year to 2013.
519
520 2012-12-20  Ian Lance Taylor  <iant@google.com>
521
522         * layout.cc (Layout::special_ordering_of_input_section): New
523         function.
524         (Layout::layout): If input section requires special ordering, must
525         sort input sections.
526         (Layout::make_output_section): May sort .text input sections.
527         (Layout::is_section_name_prefix_grouped): Remove.
528         * layout.h (class Layout): Declare
529         special_ordering_of_input_section.  Don't declare
530         is_section_name_prefix_grouped.
531         * output.cc (Output_section::add_input_section): Revert last
532         change.
533         (Output_section::Input_section_sort::match_file_name): Don't crash
534         if called on output section data.
535         (Output_section::Input_section_sort_compare): Sort based on
536         special ordering.
537         (Output_section::Input_section_sort_section_order_index_compare):
538         Revert last patch.
539         (Output_section::sort_attached_input_sections): Likewise.
540
541 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
542
543         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
544         * layout.h (Layout::is_section_name_prefix_grouped): New function.
545         * output.cc (Output_section::add_input_section): Check if section
546         name contains special prefix.  Keep input sections to sort such
547         sections.
548         (Output_section::Input_section_sort_section_order_index_compare
549          ::operator()): Group sections according to prefixes.
550         (Output_section::sort_attached_input_sections): Add condition to
551         Input_section_entry constructor call.
552         * testsuite/Makefile.am (text_section_grouping): New test.
553         * testsuite/Makefile.in: Regenerate.
554         * testsuite/text_section_grouping.cc: New file.
555         * testsuite/text_section_grouping.sh: New file.
556
557 2012-12-17  Nick Clifton  <nickc@redhat.com>
558
559         * Makefile.am: Add copyright notice.
560         * NEWS: Likewise.
561         * README: Likewise.
562         * configure.ac: Likewise.
563         * ftruncate.c: Likewise.
564         * Makefile.in: Regenerate.
565
566 2012-12-14  Cary Coutant  <ccoutant@google.com>
567
568         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
569         --no-as-needed flag.
570         (exception_separate_shared_12_test): Likewise.
571         (incremental_copy_test): Likewise.
572         * testsuite/Makefile.in: Regenerate.
573
574 2012-12-14  Cary Coutant  <ccoutant@google.com>
575
576         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
577         (Dwp_output_file::Dwp_index::enter_set): Add assert.
578
579 2012-12-12  Alan Modra  <amodra@gmail.com>
580
581         * powerpc.cc (class Track_tls): New.
582         (class Relocate, class Scan): Inherit Track_tls.
583         (Target_powerpc::Scan::local, global): Track tls optimization
584         and avoid creating plt entry for __tls_get_addr if all uses
585         are optimized away.
586         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
587
588 2012-12-12  Alan Modra  <amodra@gmail.com>
589
590         * options.h (General_options): Add --toc-sort/--no-toc-sort.
591         Replace no_toc_optimize with toc_optimize.
592         * output.h (Output_section::input_sections): Provide non-const variant.
593         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
594         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
595         accessors.
596         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
597         (class Sort_toc_sections): New.
598         (Target_powerpc::do_finalize_sections): Sort toc sections.
599         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
600
601 2012-12-10  Roland McGrath  <mcgrathr@google.com>
602
603         * testsuite/binary_unittest.cc (read_all): New function.
604         (Sized_binary_test): Use it instead of ::read.
605         * fileread.cc (do_read): Don't assume pread always reads the whole
606         amount in a single call.
607
608 2012-12-10  Alan Modra  <amodra@gmail.com>
609
610         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
611         Set EM_PPC64 or EM_PPC here.
612         (Target_selector_powerpc::do_recognize): Delete.
613
614 2012-12-10  Alan Modra  <amodra@gmail.com>
615
616         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
617         stub_table_.
618         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
619
620 2012-12-07  Roland McGrath  <mcgrathr@google.com>
621
622         * testsuite/binary_unittest.cc (Sized_binary_test):
623         Use open_descriptor rather than ::open.
624
625 2012-12-07  Alan Modra  <amodra@gmail.com>
626
627         * powerpc.cc (Stub_table::do_write): Delete redundant Address
628         typedef and invalid_address constant.
629         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
630         instantiate constants.
631
632 2012-12-06  Roland McGrath  <mcgrathr@google.com>
633
634         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
635         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
636         * aclocal.m4: Regenerate.
637         * configure: Regenerate.
638         * Makefile.in: Regenerate.
639         * testsuite/Makefile.in: Regenerate.
640
641 2012-12-07  Alan Modra  <amodra@gmail.com>
642
643         * options.h (General_options): Add no_toc_optimize.
644         * powerpc.cc (ok_lo_toc_insn): New function.
645         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
646
647 2012-12-06  Alan Modra  <amodra@gmail.com>
648
649         * options.h (General_options): Add plt_align, plt_static_chain,
650         plt_thread_safe.  Update stub_group_size help text.
651         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
652         for new plt_thread_safe_ var.
653         (use_plt_offset): Correct comments.
654         (Target_powerpc::do_relax): Look for thread creation symbols to
655         determine default plt_thread_safe value.  Clear plt call stubs
656         as well as branch stubs each iteration.
657         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
658         insn constants.
659         (l, hi, ha, write_insn): Move earlier.
660         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
661         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
662         plt stubs too.
663         (Stub_table::update_size): Adjust.
664         (Stub_table::prev_size, set_prev_size): Delete.
665         (Stub_table::stub_align): Let --plt-align affect result.
666         (Stub_table::plt_call_size): Calculate sizes for various stubs.
667         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
668         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
669         (Stub_table::do_write): Support more stub variants.
670
671 2012-12-04  Alan Modra  <amodra@gmail.com>
672
673         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
674         (Target_powerpc::do_define_standard_symbols): New function.
675
676 2012-12-03  Alan Modra  <amodra@gmail.com>
677
678         * output.h: Formatting, whitespace.
679
680 2012-12-03  Alan Modra  <amodra@gmail.com>
681
682         * layout.h (Layout::get_executable_sections): Declare.
683         * layout.cc (Layout::get_executable_sections): New function.
684         * arm.cc (Target_arm::group_sections): Use it.
685         (Arm_output_section::group_sections): Delete now redundant test.
686         * output.cc (Output_reloc::Output_reloc): Add is_relative.
687         param to handle relative relocs.
688         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
689         (Output_data_reloc::add_absolute): Adjust.
690         (Output_data_reloc::add_relative): New function.
691         (Output_data::reset_data_size): New function.
692         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
693         (Output_section::set_addralign): New function.
694         (Output_section::checkpoint_set_addralign): New function.
695         (Output_section::clear_section_offsets_need_adjustment): New function.
696         (Output_section::input_sections): Make public.
697         * powerpc.cc (class Output_data_brlt_powerpc): New.
698         (class Stub_table, class Stub_control): New.
699         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
700         stub_table_, set_stub_table, stub_table): New vectors and accessor
701         functions.
702         (Target_powerpc::do_may_relax, do_relax, push_branch,
703         new_stub_table, stub_tables, brlt_section, group_sections,
704         add_branch_lookup_table, find_branch_lookup_table,
705         write_branch_lookup_table, make_brlt_section): New functions.
706         (Target_powerpc::struct Sort_sections, class Branch_info): New.
707         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
708         branch_info_): New vars.
709         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
710         make call stubs here.
711         (Output_data_glink): Remove all call stub handling from this class.
712         (Target_powerpc::Scan::local, global): Save interesting branch
713         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
714         (Target_powerpc::do_finalize_sections): Only make reg save/restore
715         functions on final link.
716         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
717         Handle long branch destinations too.
718         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
719         do_plt_address_for_local): Adjust lookup of plt call stubs.
720
721 2012-11-30  Alan Modra  <amodra@gmail.com>
722
723         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
724         relocs against protected symbols when building 32-bit shared libs.
725
726 2012-11-30  Alan Modra  <amodra@gmail.com>
727
728         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
729         param.  Call got_section() to make .got.  Update all callers
730         and their callers and so on.
731
732 2012-11-30  Alan Modra  <amodra@gmail.com>
733
734         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
735         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
736         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
737         value if it already exists.
738
739 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
740
741         PR gold/14858
742         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
743
744 2012-11-14  Roland McGrath  <mcgrathr@google.com>
745
746         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
747         than bfc instruction for data sandboxing.
748
749 2012-11-08  Alan Modra  <amodra@gmail.com>
750
751         * po/POTFILES.in: Regenerate.
752
753 2012-11-05  Alan Modra  <amodra@gmail.com>
754
755         * configure.ac: Apply 2012-09-10 change to config.in here.
756         * configure: Regenerate.
757
758 2012-11-05  Alan Modra  <amodra@gmail.com>
759
760         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
761         (struct Opd_ent): Use "Address" rather than "Offset".
762         (Output_data_got_powerpc::got_base_offset): Return Valtype.
763         (Target_powerpc::got_section): Make public.
764         (Target_powerpc::scan_relocs): Move code setting symbols..
765         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
766         Create _SDA_BASE_ only when referenced.
767
768 2012-11-02  Roland McGrath  <mcgrathr@google.com>
769
770         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
771         from last change.
772
773 2012-11-01  Roland McGrath  <mcgrathr@google.com>
774
775         * target.h (Sized_target::relocate_relocs): Use Elf_Off
776         for offset_in_output_section parameter.
777         (Sized_target::relocate_special_relocatable): Likewise.
778         * arm.cc (Target_arm::relocate_relocs): Likewise.
779         (Target_arm::relocate_special_relocatable): Likewise.
780         * i386.cc (Target_i386::relocate_relocs): Likewise.
781         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
782         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
783         * target-reloc.h (relocate_relocs): Likewise.
784         * testsuite/testfile.cc (Target_test): Likewise.
785         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
786         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
787
788         * system.h: Move inclusion of <clocale> to after <libintl.h> in
789         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
790
791         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
792         parameter, which is unused in the [!F_SETFD] case.
793
794         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
795         SYMNDX to off_t before comparing it to this->data_size().
796         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
797         * incremental.cc (Output_section_incremental_inputs::do_write):
798         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
799
800         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
801
802 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
803
804         * gold.cc (Target_arm::do_adjust_elf_header): Add the
805         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
806         in EABI_VER5.
807
808 2012-10-29  Cary Coutant  <ccoutant@google.com>
809
810         * dwp.cc (usage): Add file and exit status parameters;
811         add --help and --version options.
812         (print_version): New function.
813         (main): Add --help and --version options.
814
815 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
816
817         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
818         final_layout_sequence.txt.
819         * testsuite/Makefile.in: Regenerated.
820
821 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
822
823         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
824         COMPILE generated by automake.
825         (LINK1): Likewise.
826         (CXXCOMPILE1): Likewise.
827         (CXXLINK1): Likewise.
828         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
829         (LINK): Likewise.
830         (CXXCOMPILE): Likewise.
831         (CXXLINK): Likewise.
832         * testsuite/Makefile.in: Regenerated.
833
834 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
835
836         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
837         on bad fwrite return.
838
839 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
840
841         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
842         on val.
843
844 2012-10-23  Cary Coutant  <ccoutant@google.com>
845
846         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
847         * testsuite/Makefile.in: Regenerate.
848         * testsuite/dwp_test.h: New source file.
849         * testsuite/dwp_test_1.cc: New source file.
850         * testsuite/dwp_test_1.s: New source file.
851         * testsuite/dwp_test_1.sh: New source file.
852         * testsuite/dwp_test_1b.cc: New source file.
853         * testsuite/dwp_test_1b.s: New source file.
854         * testsuite/dwp_test_2.cc: New source file.
855         * testsuite/dwp_test_2.s: New source file.
856         * testsuite/dwp_test_2.sh: New source file.
857         * testsuite/dwp_test_main.cc: New source file.
858         * testsuite/dwp_test_main.s: New source file.
859
860 2012-10-23  Cary Coutant  <ccoutant@google.com>
861
862         * dwp.h: New header file.
863         * dwp.cc: New source file.
864         * gold.h: Move shared declarations to system.h.
865         * system.h: New header file.
866         * Makefile.am: Add dwp.
867         * Makefile.in: Regenerate.
868
869 2012-10-23  Cary Coutant  <ccoutant@google.com>
870
871         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
872         Dwarf_info_reader::read_from_pointer.
873         (Dwarf_pubnames_table::read_header): Likewise.
874         (Dwarf_pubnames_table::next_name): Likewise.
875         (Dwarf_die::read_attributes): Likewise.
876         (Dwarf_die::skip_attributes): Likewise.
877         (Dwarf_info_reader::read_from_pointer): New function template.
878         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
879         (Dwarf_pubnames_table): Likewise.
880         (Dwarf_info_reader::read_from_pointer): New function template.
881         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
882         Dwarf_pubnames_table ctor.
883
884 2012-10-23  Cary Coutant  <ccoutant@google.com>
885
886         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
887         abbrev_shndx.
888         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
889         abbrev_shndx_.
890         (Dwarf_info_reader::set_abbrev_shndx): New method.
891         (Dwarf_info_reader::abbrev_shndx_): New data member.
892
893 2012-10-23  Cary Coutant  <ccoutant@google.com>
894
895         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
896         from object, not parameters.
897         (Dwarf_info_reader::parse): Likewise.
898         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
899         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
900         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
901         methods.
902
903 2012-10-23  Cary Coutant  <ccoutant@google.com>
904
905         * fileread.cc (Input_file::Input_file): New constructor.
906         * fileread.h (class Input_file): Add new constructor.
907
908 2012-10-18  Alan Modra  <amodra@gmail.com>
909
910         PR gold/14727
911         * object.cc (Relobj::is_section_name_included): Also match
912         .sdata personality section.
913
914 2012-10-18  Alan Modra  <amodra@gmail.com>
915
916         * target-reloc.h (class Default_comdat_behavior): New, package up..
917         (get_comdat_behaviour): ..this.
918         (relocate_section): Add Relocate_comdat_behavior template arg,
919         adjust code to suit.
920         * arm.cc (Target_arm::relocate_section): Adjust to suit.
921         (Target_arm::scan_reloc_section): Likewise.
922         * i386.cc (Target_i386::relocate_section): Likewise.
923         * sparc.cc (Target_sparc::relocate_section): Likewise.
924         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
925         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
926         * powerpc.cc (class Relocate_comdat_behavior): New.
927         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
928         gold::relocate_section with new template arg.
929
930 2012-10-18  Alan Modra  <amodra@gmail.com>
931
932         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
933         dynamic relocs for GOT_TPREL got entries, without symbol if
934         resolving locally.
935         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
936         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
937         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
938
939 2012-10-17  Alan Modra  <amodra@gmail.com>
940
941         PR gold/14726
942         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
943
944 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
945
946         * layout.cc (Layout::include_section): Keep sections marked
947         SHF_EXCLUDE when doing relocatable links.
948
949 2012-10-16  Alan Modra  <amodra@gmail.com>
950
951         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
952         (Target_powerpc::do_finalize_sections): Call it.
953         (Output_data_save_res): New class and supporting functions.
954         (Target_powerpc::symval_for_branch): Only look up .opd entry for
955         normal symbols defined in object files.
956
957 2012-10-12  Alan Modra  <amodra@gmail.com>
958
959         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
960         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
961         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
962         section if scan_opd_relocs not yet called.
963         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
964
965 2012-10-12  Alan Modra  <amodra@gmail.com>
966
967         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
968         add_local_ifunc_entry): Revert last change.
969         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
970
971 2012-10-05  Alan Modra  <amodra@gmail.com>
972
973         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
974         do_plt_address_for_global): New functions.
975         (Output_data_got_powerpc::do_write): Don't segfault when linking
976         statically.
977         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
978         add_local_ifunc_entry): Return true on adding entry..
979         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
980         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
981         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
982         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
983         set up symbols here.
984         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
985         syms here.  Do so even when no .iplt.  Don't segfault when linking
986         statically.
987         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
988         new variants without reloc param.
989         (Glink_sym_ent::Glink_sym_ent): Likewise.
990         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
991         reloc when refs will resolve to plt call stub.
992         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
993         R_PPC_PLTREL24 to resolve locally.
994         (Target_powerpc::Scan::global): Correct ifunc handling.
995         (Target_powerpc::Relocate::relocate): Correct local sym glink
996         lookup.  Don't destroy "value" when we have a plt call stub,
997         and when checking plt call validity.
998         (Target_powerpc::do_dynsym_value): Simplify.
999
1000 2012-10-05  Alan Modra  <amodra@gmail.com>
1001
1002         * i386.cc (Output_data_plt_i386::address_for_global,
1003         address_for_local): Add plt offset to returned value.  Adjust uses.
1004         * sparc.cc (Output_data_plt_sparc::address_for_global,
1005         address_for_local): Likewise.
1006         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1007         address_for_local): Likewise.
1008         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1009         address_for_local): Likewise.
1010         * target.h (Target::plt_address_for_global, plt_address_for_local):
1011         Update comment.
1012         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1013         (Output_data_got::Got_entry::write): Nor here.
1014         * output.h: Comment fix.
1015
1016 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1017
1018         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1019         global_offset_table_ value for larget got.
1020         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1021
1022 2012-09-29  Alan Modra  <amodra@gmail.com>
1023
1024         * powerpc.cc (Target_powerpc::iplt_): New output section.
1025         (Target_powerpc::iplt_section, make_iplt_section,
1026         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1027         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1028         Target_powerpc::plt_entry_count): Count iplt entries too.
1029         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1030         reloc section in constructor.  New params.
1031         (Target_powerpc::make_plt_section): Create reloc section here instead.
1032         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1033         functions.
1034         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1035         (Output_data_glink::add_entry, find_entry): New functions to
1036         deal with local syms.
1037         (Glink_sym_ent): Add support for local syms.
1038         (Output_data_glink::do_write): Handle ifunc plt entries.
1039         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1040         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1041         (Target_powerpc::Relocate::relocate): Likewise.
1042         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1043
1044 2012-09-25  Alan Modra  <amodra@gmail.com>
1045
1046         * object.h (Sized_relobj_file::adjust_local_symbol,
1047         do_adjust_local_symbol): New functions.
1048         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1049         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1050         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1051         and irregular opd entry spacing.
1052         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1053         (Global_symbol_visitor_opd): New functor.
1054         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1055         on deleted opd entries.
1056
1057 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1058
1059         * tilegx.cc: New file.
1060         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1061         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1062         * configure.tgt: Add entries for tilegx*.
1063         * configure.ac: Likewise.
1064         * Makefile.in: Rebuild.
1065         * configure: Likewise.
1066         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1067         tilegx.
1068
1069 2012-09-13  Alan Modra  <amodra@gmail.com>
1070
1071         * target-reloc.h (scan_relocs): Call scan.local for relocs
1072         against symbols in discarded sections.  Pass is_discarded
1073         param.
1074         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1075         Add is_discarded param.
1076         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1077         is_discarded to flag opd entry as discarded.  Don't emit dyn
1078         relocs on such entries.
1079         (Target_powerpc::Scan::global): Similarly detect and handle
1080         such opd entries.
1081         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1082         opd_ent_.  Update all uses.
1083         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1084         (Target_powerpc::relocate_section): Zero out discarded opd
1085         entry relocs.
1086
1087 2012-09-12  Ian Lance Taylor  <iant@google.com>
1088
1089         PR gold/14570
1090         * output.cc: Rename Output_data_got template parameter from size
1091         to got_size for all functions.  Compile all variants of
1092         Output_data_got.
1093         (Output_data_got::Got_entry::write): Correct use of size for
1094         symbol value.  Use local_is_tls rather than casting to
1095         Sized_relobj_file.
1096         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1097         (class Sized_relobj_file): Add do_local_is_tls.
1098         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1099
1100 2012-09-11  Alan Modra  <amodra@gmail.com>
1101
1102         PR gold/14566
1103         * layout.cc (Layout::set_segment_offsets): When using
1104         common-page-size alignment, ensure we are on a new max-page-size
1105         page.
1106         * output.cc (Output_segment::set_section_addresses): Use
1107         abi_pagesize, not common_pagesize for relro boundary.
1108         (Output_segment::set_offset): Likewise.
1109
1110 2012-09-11  Alan Modra  <amodra@gmail.com>
1111
1112         * output.h (Output_data_got::add_global_tls, add_local_tls,
1113         add_local_tls_pair): New functions.
1114         (Output_data_got::add_local_pair_with_rel): Remove second
1115         reloc param.  Expand comment.
1116         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1117         use_plt_or_tls_offset_, similarly for constructor param.
1118         (Output_data_got::Got_entry::write): Add got_index param.
1119         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1120         add_local_tls_pair): New functions.
1121         (Output_data_got::Got_entry::write): Handle tls symbols
1122         with use_plt_or_tls_offset_ set specially.
1123         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1124         (Output_data_got::do_write): Replace iterator with index, pass
1125         index to entry write function.
1126         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1127         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1128         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1129         call.
1130         * i386.cc (Target_i386::Scan::local): Likewise.
1131         * sparc.cc (Target_sparc::Scan::local): Likewise.
1132         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1133         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1134         do_tls_offset_for_global): New functions.
1135         (Target_powerpc::Scan::local): Correct TLS relocations and got
1136         entry values.
1137         (Target_powerpc::Scan::global): Don't emit unnecessary
1138         dynamic relocations on TLS GOT entries.
1139
1140 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1141
1142         * config.in: Disable sanity check for kfreebsd.
1143
1144 2012-09-10  Sterling Augustine  <saugustine@google.com>
1145
1146         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1147         (Gdb_index::pubtypes_read): New parameter.
1148         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1149         to calls.
1150         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1151         pubtypes_object_.
1152
1153 2012-09-09  Alan Modra  <amodra@gmail.com>
1154
1155         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1156         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1157         * gc.h (gc_process_relocs): Call target gc_add_reference.
1158         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1159         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1160         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1161         unnecessary cast.
1162         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1163         to cater for when we don't need code offset.  Update use.
1164         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1165         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1166         set_opd_valid): New functions.
1167         (Target_powerpc::do_gc_add_reference): New function.
1168         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1169         stashed refs.
1170         (Target_powerpc::do_gc_mark_symbol): New function.
1171
1172 2012-09-06  Cary Coutant  <ccoutant@google.com>
1173
1174         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1175         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1176         (Dwarf_die::skip_attributes): Likewise.
1177         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1178         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1179         (main): Call it.
1180         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1181
1182 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1183
1184         * testsuite/script_test_3.t: Add .got.plt output section
1185         statement.
1186         * testsuite/script_test_4.t: Likewise.
1187
1188 2012-09-05  Alan Modra  <amodra@gmail.com>
1189
1190         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1191         update all uses and lose "enum" when using type.
1192
1193 2012-09-05  Alan Modra  <amodra@gmail.com>
1194
1195         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1196         * configure: Regenerate.
1197         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1198         (plugin_final_layout.stdout): Likewise.
1199         (memory_test): Set page sizes to 0x1000.
1200         * testsuite/Makefile.in: Regenerate.
1201         * testsuite/discard_locals_test.sh: Add FIXME comment.
1202         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1203         * testsuite/pr14265.t: Add .got output section statement.
1204         * testsuite/script_test_2.t: Likewise.
1205         * testsuite/script_test_3.t: Likewise.
1206         * testsuite/script_test_4.t: Likewise.
1207         * testsuite/script_test_5.t: Likewise.
1208         * testsuite/script_test_6.t: Likewise.
1209         * testsuite/script_test_7.t: Likewise.
1210         * testsuite/script_test_9.t: Likewise.
1211
1212 2012-09-05  Alan Modra  <amodra@gmail.com>
1213
1214         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1215         (Powerpc_relocate_functions::Status): New typedef.
1216         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1217         (Target_powerpc::Scan::local): Handle REL64.
1218         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1219         for REL32 and REL64.
1220         (Target_powerpc::symval_for_branch): New function, extracted from..
1221         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1222         checks.  Report overflow errors.
1223
1224 2012-09-05  Alan Modra  <amodra@gmail.com>
1225
1226         * object.h (Sized_relobj_file::emit_relocs): Delete.
1227         (Sized_relobj_file::emit_relocs_reltype): Delete.
1228         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1229         relocate_relocs for --emit-relocs.
1230         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1231         * output.h: Update comment.
1232         (Output_segment::first_section): New function.
1233         (Output_segment::first_section_load_address): Use first_section.
1234         * output.cc (Output_segment::first_section): New function extracted..
1235         (Output_segment::first_section_load_address): ..from here.  Delete.
1236         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1237         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1238         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1239         adjust call to target.h function.
1240         * i386.cc (Target_i386): Likewise.
1241         * sparc.cc (Target_sparc): Likewise.
1242         * x86_64.cc (Target_x86_64): Likewise.
1243         * powerpc.cc (Target_powerpc): Likewise.
1244         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1245         first tls section has section symbol for optimised local dynamic
1246         output relocs.
1247         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1248         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1249         optimised tls code.
1250         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1251         Rename to relocate_relocs.  Update error message.
1252
1253 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1254
1255         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1256         --just-symbols.
1257
1258 2012-08-31  Alan Modra  <amodra@gmail.com>
1259
1260         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1261         (Powerpc_relobj::toc_base_offset): New stub function.
1262         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1263         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1264         (Target_powerpc::Relocate::enum skip_tls): New.
1265         (Target_powerpc::call_tls_get_addr_): New var.
1266         (Target_powerpc::is_branch_reloc): Move to file scope.
1267         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1268         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1269         New functions.
1270         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1271         (powerpc_info): Correct common_pagesize for ppc64.
1272         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1273         (Powerpc_relocate_functions): Add overflow check enums and functions.
1274         Add non-shift version of rela, rela_ua.  Delete all rel public
1275         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1276         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1277         addr16_ha3, addr14 functions.
1278         (Output_data_got_powerpc::add_constant_pair): New function.
1279         (Output_data_got_powerpc::got_base_offset): Likewise.
1280         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1281         (instruction constants): Sort, add some more.
1282         (Output_data_glink::do_write): Add and use Address typedef.  Use
1283         object->toc_base_offset() stub for 64-bit.
1284         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1285         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1286         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1287         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1288         Always treat .opd relocs as against locally defined symbol.
1289         Correct condition for RELATIVE relocs.
1290         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1291         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1292         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1293         calculations.  Handle TLS relocs, and more.  Add overflow
1294         checking and adjust for Powerpc_relocate_functions changes.
1295         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1296         Reinstate --emit-relocs code with FIXME.
1297
1298 2012-08-30  Alan Modra  <amodra@gmail.com>
1299
1300         * layout.cc (Layout::set_segment_offsets): Set p_align to
1301         abi_pagesize, not common_pagesize.
1302         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1303         to determine whether file header can go in segment.
1304
1305 2012-08-30  Alan Modra  <amodra@gmail.com>
1306
1307         * output.h (Output_reloc::Output_reloc <output section>): Add
1308         is_relative param.  Adjust calls.
1309         (Output_reloc::add_output_section_relative): New functions.
1310         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1311         is_relative.
1312         (Output_reloc::symbol_value): Handle SECTION_CODE.
1313
1314 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1315
1316         * gold.cc (queue_middle_tasks): Call layout again when unique
1317         segments for sections is desired.
1318         * layout.cc (Layout::Layout): Initialize new members.
1319         (Layout::get_output_section_flags): New function.
1320         (Layout::choose_output_section): Call get_output_section_flags.
1321         (Layout::layout): Make output section for mapping to a unique segment.
1322         (Layout::insert_section_segment_map): New function.
1323         (Layout::attach_allocated_section_to_segment): Make unique segment for
1324         output sections marked so.
1325         (Layout::segment_precedes): Check for unique segments when sorting.
1326         * layout.h (Layout::Unique_segment_info): New struct.
1327         (Layout::Section_segment_map): New typedef.
1328         (Layout::insert_section_segment_map): New function.
1329         (Layout::get_output_section_flags): New function.
1330         (Layout::is_unique_segment_for_sections_specified): New function.
1331         (Layout::set_unique_segment_for_sections_specified): New function.
1332         (Layout::unique_segment_for_sections_specified_): New member.
1333         (Layout::section_segment_map_): New member.
1334         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1335         Rename is_gc_pass_one to is_pass_one.
1336         Rename is_gc_pass_two to is_pass_two.
1337         Rename is_gc_or_icf to is_two_pass.
1338         Check for which pass based on whether symbols data is present.
1339         Make it two pass when unique segments for sections is desired.
1340         * output.cc (Output_section::Output_section): Initialize new
1341         members.
1342         * output.h (Output_section::is_unique_segment): New function.
1343         (Output_section::set_is_unique_segment): New function.
1344         (Output_section::is_unique_segment_): New member.
1345         (Output_section::extra_segment_flags): New function.
1346         (Output_section::set_extra_segment_flags): New function.
1347         (Output_section::extra_segment_flags_): New member.
1348         (Output_section::segment_alignment): New function.
1349         (Output_section::set_segment_alignment): New function.
1350         (Output_section::segment_alignment_): New member.
1351         (Output_segment::Output_segment): Initialize is_unique_segment_.
1352         (Output_segment::is_unique_segment): New function.
1353         (Output_segment::set_is_unique_segment): New function.
1354         (Output_segment::is_unique_segment_): New member.
1355         * plugin.cc (allow_unique_segment_for_sections): New function.
1356         (unique_segment_for_sections): New function.
1357         (Plugin::load): Add new functions to transfer vector.
1358         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1359         * Makefile.in: Regenerate.
1360         * testsuite/plugin_final_layout.sh: Check if unique segment
1361         functionality works.
1362         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1363         are available.
1364         (allow_unique_segment_for_sections): New global.
1365         (unique_segment_for_sections): New global.
1366         (claim_file_hook): Call allow_unique_segment_for_sections.
1367         (all_symbols_read_hook): Call unique_segment_for_sections.
1368
1369 2012-08-22  Cary Coutant  <ccoutant@google.com>
1370
1371         * layout.cc (Layout::include_section): Don't assert on GROUP
1372         sections with --emit-relocs.
1373
1374 2012-08-21  Cary Coutant  <ccoutant@google.com>
1375
1376         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1377         if --export-dynamic-symbol names an undef symbol.
1378
1379 2012-08-18  Alan Modra  <amodra@gmail.com>
1380
1381         * powerpc.cc: Formatting and white space.
1382         (Powerpc_relobj): Rename got2_section_ to special_.
1383         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1384         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1385         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1386         (Target_powerpc): Add Address typedef and invalid_address.  Use
1387         throughout.
1388         (Target_powerpc::is_branch_reloc): New function.
1389         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1390         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1391         for dst_mask, value and addend.
1392         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1393         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1394         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1395         uint16_t for 24-bit offset.  Use get_output_section_offset and
1396         check return.
1397         (Target_powerpc::Scan::local): Handle more relocs.
1398         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1399         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1400         Plug in toc restoring insn after plt calls.  Translate branches
1401         to function descriptor symbols to corresponding entry point.
1402         (Target_powerpc::relocate_for_relocatable): Check return from
1403         get_output_section_offset.
1404         * symtab.h: Comment typo.
1405
1406 2012-08-14  Ian Lance Taylor  <iant@google.com>
1407
1408         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1409         unsupported_relocal_local to call unsupported_reloc_global.
1410
1411 2012-08-14  Nick Clifton  <nickc@redhat.com>
1412
1413         PR ld/14265
1414         * script-sections.cc (Sections_element::output_section_name): Add
1415         keep return parameter.
1416         (Output_section_element::match_name): Add keep return parameter.
1417         Return the value of the keep_ member.
1418         * script-sections.h (class Output_section): Update
1419         output_section_name prototype.
1420         * layout.cc (Layout::keep_input_section): New public member
1421         function.
1422         (Layout::choose_output_section): Pass keep parameter to
1423         output_section_name.
1424         * layout.h (class Layout): Add keep_input_section.
1425         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1426         sections.
1427         * testsuite/Makefile.am: Add a test.
1428         * testsuite/Makefile.in: Regenerate.
1429         * testsuite/pr14265.c: Source file for the test.
1430         * testsuite/pr14265.t: Linker script for the test.
1431         * testsuite/pr14265.sh: Shell script for the test.
1432
1433 2012-08-14  Alan Modra  <amodra@gmail.com>
1434
1435         * target.h (Target::output_section_name): New function.
1436         (Target::do_output_section_name): New function.
1437         * layout.cc (Layout::choose_output_section): Call the above.
1438         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1439
1440 2012-08-14  Alan Modra  <amodra@gmail.com>
1441
1442         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1443         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1444         for replace_constant call.
1445         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1446         (Output_data_glink::do_print_to_mapfile): New function.
1447         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1448         (Target_powerpc::Relocate::relocate): Likewise.
1449
1450 2012-08-14  Alan Modra  <amodra@gmail.com>
1451
1452         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1453         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1454         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1455         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1456         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1457         here.
1458         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1459         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1460         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1461         here.
1462         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1463         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1464
1465 2012-08-12  Alan Modra  <amodra@gmail.com>
1466
1467         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1468         (glink insn constants): Use uint32_t.
1469         (Output_data_glink::add_entry): Use insert, not [] operator.
1470
1471 2012-08-11  Alan Modra  <amodra@gmail.com>
1472
1473         * object.h (Sized_relobj_file::find_shdr): New function.
1474         (Sized_relobj_file::find_special_sections): New function.
1475         * object.cc (Sized_relobj_file::find_shdr): New function.
1476         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1477         (Sized_relobj_file::find_special_sections): New function, split out..
1478         (Sized_relobj_file::do_read_symbols): ..from here.
1479         * output.h (Output_data_got::replace_constant): New function.
1480         (Output_data_got::num_entries): New function.
1481         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1482         (Output_data_got::got_offset): Protected rather than private.
1483         (Output_data_got::replace_got_entry): New function.
1484         * output.cc (Output_data_got::replace_got_entry): New function.
1485         * powerpc.cc (class Powerpc_relobj): New.
1486         (class Powerpc_relocate_functions): Delete all psymval variants or
1487         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1488         Implement _ha functions using corresponding _hi function.
1489         (Powerpc_relobj::find_special_sections): New function.
1490         (Target_powerpc::do_make_elf_object): New function.
1491         (class Output_data_got_powerpc): New.
1492         (class Output_data_glink): New.
1493         (class Powerpc_scan_relocatable_reloc): New.
1494         Many more changes througout file.
1495
1496 2012-08-09  Nick Clifton  <nickc@redhat.com>
1497
1498         * po/vi.po: Updated Vietnamese translation.
1499
1500 2012-08-07  Ian Lance Taylor  <iant@google.com>
1501
1502         * layout.cc (Layout::add_target_dynamic_tags): If
1503         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1504         plt_rel.
1505
1506 2012-07-30  Nick Clifton  <nickc@redhat.com>
1507
1508         * po/gold.pot: Updated template.
1509         * po/es.po: Updated Spanish translation.
1510
1511 2012-07-18  Cary Coutant  <ccoutant@google.com>
1512
1513         PR gold/14344
1514         * configure.ac: Add check for -gpubnames support.
1515         * configure: Regenerate.
1516         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1517         support; force -gno-pubnames.
1518         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1519         support.
1520         (gdb_index_test_4): New test.
1521         * testsuite/Makefile.in: Regenerate.
1522         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1523         * testsuite/gdb_index_test_2.sh: Likewise.
1524         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1525         * testsuite/gdb_index_test_4.sh: New script.
1526         * testsuite/gdb_index_test_comm.sh: New script with common code;
1527         don't look for space after colon.
1528
1529 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1530
1531         * gold.cc (queue_middle_tasks): Update function order only after
1532         deferred objects due to plugins are processed.
1533
1534 2012-07-11  Ian Lance Taylor  <iant@google.com>
1535
1536         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1537         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1538         (Target_arm::scan_reloc_for_stub): Likewise.
1539         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1540         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1541         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1542         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1543         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1544
1545 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1546             Ian Lance Taylor  <iant@google.com>
1547
1548         PR gold/14309
1549         * configure.ac: Test whether std::tr1::hash<off_t> works.
1550         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1551         needed.
1552         * output.h (class Output_fill): Add virtual destructor.
1553         * configure, config.in: Rebuild.
1554
1555 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1556
1557         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1558
1559 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1560
1561         * plugin.cc (Plugin::load): Handle position independent executables.
1562
1563 2012-06-06  Cary Coutant  <ccoutant@google.com>
1564
1565         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1566         add .debug_macro.
1567         (lines_only_debug_sections): Likewise.
1568         (gdb_fast_lookup_sections): New static array.
1569         (is_gdb_debug_section): Rename formal parameter.
1570         (is_lines_only_debug_section): Likewise.
1571         (is_gdb_fast_lookup_section): New function.
1572         (Layout::include_section): Check for ".zdebug_" prefix; pass
1573         section name suffix to is_gdb_debug_section, et al.; check for
1574         fast-lookup sections when building .gdb_index.
1575         * options.h (--strip-debug-gdb): Update GDB version number.
1576
1577 2012-06-06  Cary Coutant  <ccoutant@google.com>
1578
1579         * configure.ac: Add check for fallocate.
1580         * configure: Regenerate.
1581         * config.in: Regenerate.
1582
1583         * options.h (class General_options): Add --mmap-output-file and
1584         --posix-fallocate options.
1585         * output.cc: (posix_fallocate): Remove; replace with...
1586         (gold_fallocate): New function.
1587         (Output_file::map_no_anonymous): Call gold_fallocate.
1588         (Output_file::map): Check --mmap-output-file option.
1589
1590 2012-06-05  Jing Yu  <jingyu@google.com>
1591
1592         * gold.h (textdomain): Add do {} to empty while(0).
1593         (bindtextdomain): Likewise.
1594
1595 2012-06-04  Cary Coutant  <ccoutant@google.com>
1596
1597         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1598         has_dynsym_index.
1599
1600 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1601
1602         * symtab.cc (Symbol_table::define_special_symbol):
1603         Initialize *poldsym to prevent uninitialized variable errors.
1604
1605 2012-05-23  Cary Coutant  <ccoutant@google.com>
1606
1607         * layout.cc (Layout::section_name_mapping): Add rules to handle
1608         exact match on .data.rel.ro.local or .data.rel.ro.
1609         (Layout::output_section_name): Check for exact matches.
1610
1611 2012-05-23  Cary Coutant  <ccoutant@google.com>
1612
1613         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1614         more carefully.
1615
1616 2012-05-22  Cary Coutant  <ccoutant@google.com>
1617
1618         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1619         object before exporting symbol.
1620
1621 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1622
1623         * testsuite/tls_test.cc: Include "config.h" first.
1624         * testsuite/tls_test_c.c: Likewise.
1625
1626 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1627             Nick Clifton  <nickc@redhat.com>
1628
1629         PR 14072
1630         * configure.in: Add check that sysdep.h has been included before
1631         any system header files.
1632         * configure: Regenerate.
1633         * config.in: Regenerate.
1634
1635 2012-05-14  Cary Coutant  <ccoutant@google.com>
1636
1637         * layout.cc (Layout::make_output_section): Mark .tdata section
1638         as RELRO.
1639         * testsuite/relro_test.cc: Add a TLS variable.
1640
1641 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1642
1643         PR gold/14091
1644         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1645         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1646         R_X86_64_64.
1647
1648 2012-05-08  Cary Coutant  <ccoutant@google.com>
1649
1650         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1651         (lines_only_debug_sections): Likewise.
1652
1653 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1654
1655         * nacl.cc: New file.
1656         * nacl.h: New file.
1657         * Makefile.am (CCFILES, HFILES): Add them.
1658         * Makefile.in: Regenerate.
1659         * i386.cc (Output_data_plt_i386_nacl): New class.
1660         (Output_data_plt_i386_nacl_exec): New class.
1661         (Output_data_plt_i386_nacl_dyn): New class.
1662         (Target_i386_nacl): New class.
1663         (Target_selector_i386_nacl): New class.
1664         (target_selector_i386): Use it instead of Target_selector_i386.
1665         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1666         (Target_x86_64_nacl): New class.
1667         (Target_selector_x86_64_nacl): New class.
1668         (target_selector_x86_64, target_selector_x32): Use it instead of
1669         Target_selector_x86_64.
1670         * arm.cc (Output_data_plt_arm_nacl): New class.
1671         (Target_arm_nacl): New class.
1672         (Target_selector_arm_nacl): New class.
1673         (target_selector_arm, target_selector_armbe): Use it instead of
1674         Target_selector_arm.
1675
1676         * target-select.cc (select_target): Take new Input_file* and off_t
1677         arguments, pass them on to recognize method of selector.
1678         * object.cc (make_elf_sized_object): Update caller.
1679         * parameters.cc (parameters_force_valid_target): Likewise.
1680         * incremental.cc (make_sized_incremental_binary): Likewise.
1681         * target-select.h: Update decl.
1682         (Target_selector::recognize): Take new Input_file* argument,
1683         pass it on to do_recognize.
1684         (Target_selector::do_recognize): Take new Input_file* argument.
1685         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1686         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1687         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1688         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1689
1690         * target.h (Target::Target_info): New members isolate_execinstr
1691         and rosegment_gap.
1692         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1693         * arm.cc (Target_arm::arm_info): Update initializer.
1694         * i386.cc (Target_i386::i386_info): Likewise.
1695         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1696         * sparc.cc (Target_sparc::sparc_info): Likewise.
1697         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1698         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1699         * layout.cc (Layout::attach_allocated_section_to_segment):
1700         Take new const Target* argument.  If target->isolate_execinstr(), act
1701         like --rosegment.
1702         (Layout::find_first_load_seg): Take new const Target* argument;
1703         if target->isolate_execinstr(), reject PF_X segments.
1704         (Layout::relaxation_loop_body): Update caller.
1705         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1706         reset file offset to zero when we hit LOAD_SEG, and then do a second
1707         loop over the segments before LOAD_SEG to reassign offsets after
1708         addresses have been determined.  Handle target->rosegment_gap().
1709         (Layout::attach_section_to_segment): Take new const Target* argument;
1710         pass it to attach_allocated_section_to_segment.
1711         (Layout::make_output_section): Update caller.
1712         (Layout::attach_sections_to_segments): Take new const Target* argument;
1713         pass it to attach_section_to_segment.
1714         * gold.cc (queue_middle_tasks): Update caller.
1715         * layout.h (Layout): Update method decls with new arguments.
1716
1717         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1718         Target_info pointer to use.
1719         (Target_arm::do_make_data_plt): New virtual method.
1720         (Target_arm::make_data_plt): New method that calls it.
1721         (Target_arm::make_plt_entry): Use it.
1722         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1723         for the section alignment.
1724         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1725         method.
1726         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1727         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1728         method.
1729         (Output_data_plt_arm::get_plt_entry_size): Call it.
1730         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1731         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1732         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1733         method.
1734         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1735         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1736         method instead of sizeof(plt_entry).
1737         (Output_data_plt_arm::add_entry): Likewise.
1738         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1739         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1740         than static method.
1741         (Target_arm::plt_entry_size): Likewise.
1742         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1743         Move to ...
1744         (Output_data_plt_arm_standard): ... here, new class.
1745         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1746         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1747         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1748
1749         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1750         Take additional argument for the PLT entry size.
1751         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1752         Use get_plt_entry_size method rather than plt_entry_size variable.
1753         (Output_data_plt_x86_64::reserve_slot): Likewise.
1754         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1755         (Output_data_plt_x86_64::add_entry): Likewise.
1756         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1757         (Output_data_plt_x86_64::address_for_global): Likewise.
1758         (Output_data_plt_x86_64::address_for_local): Likewise.
1759         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1760         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1761         Make method non-static.
1762         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1763         method.
1764         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1765         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1766         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1767         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1768         virtual method.
1769         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1770         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1771         virtual method.
1772         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1773         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1774         virtual method.
1775         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1776         (Output_data_plt_x86_64::plt_entry_size)
1777         (Output_data_plt_x86_64::first_plt_entry)
1778         (Output_data_plt_x86_64::plt_entry)
1779         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1780         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1781         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1782         (Output_data_plt_x86_64_standard): ... here, new class.
1783         (Target_x86_64::Target_x86_64): Take optional argument for the
1784         Target_info pointer to use.
1785         (Target_x86_64::do_make_data_plt): New virtual method.
1786         (Target_x86_64::make_data_plt): New method to call it.
1787         (Target_x86_64::init_got_plt_for_update): Use that.
1788         Call this->plt_->add_eh_frame method here.
1789         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1790         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1791         rather than static method.
1792         (Target_x86_64::plt_entry_size): Likewise.
1793         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1794         rather than plt_entry_size variable.  Move guts of PLT filling to...
1795         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1796         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1797         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1798
1799         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1800         additional argument for the section alignment.
1801         Don't do add_eh_frame_for_plt here.
1802         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1803         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1804         variable.
1805         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1806         method.
1807         (Output_data_plt_i386::get_plt_entry_size): Call it.
1808         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1809         (Output_data_plt_i386::add_eh_frame): New method to call it.
1810         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1811         method.
1812         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1813         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1814         method.
1815         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1816         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1817         method instead of plt_entry_size.
1818         (Output_data_plt_i386::plt_entry_size)
1819         (Output_data_plt_i386::plt_eh_frame_fde_size)
1820         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1821         (Output_data_plt_i386_standard): ... here, new class.
1822         (Output_data_plt_i386_exec): New class.
1823         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1824         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1825         (Output_data_plt_i386::exec_plt_entry): Move to ...
1826         (Output_data_plt_i386_exec::plt_entry): ... here.
1827         (Output_data_plt_i386_dyn): New class.
1828         (Output_data_plt_i386::first_plt_entry): Move to ...
1829         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1830         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1831         (Output_data_plt_i386_dyn::plt_entry): ... here.
1832         (Target_i386::Target_i386): Take optional argument for the Target_info
1833         pointer to use.
1834         (Target_i386::do_make_data_plt): New virtual method.
1835         (Target_i386::make_data_plt): New method to call it.
1836         (Target_i386::make_plt_section): Use that.
1837         Call this->plt_->add_eh_frame method here.
1838         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1839         rather than plt_entry_size variable.
1840         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1841         (Output_data_plt_i386::address_for_local): Likewise.
1842         (Output_data_plt_i386::do_write): Likewise.
1843         Move guts of PLT filling to...
1844         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1845         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1846         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1847         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1848
1849 2012-05-01  Cary Coutant  <ccoutant@google.com>
1850
1851         * dwarf_reader.cc (Dwarf_die::read_attributes)
1852         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1853         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1854         * reduced_debug_output.cc
1855         (Output_reduced_debug_info_section::get_die_end): Remove
1856         DW_FORM_GNU_ref_index.  Add default case.
1857
1858 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1859
1860         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1861         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1862         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1863         DW_AT_high_pc as offset from DW_AT_low_pc.
1864
1865         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1866         * testsuite/Makefile.in: Regenerate.
1867         * testsuite/gdb_index_test_3.c: New test source file.
1868         * testsuite/gdb_index_test_3.sh: New test source file.
1869
1870 2012-04-25  Ian Lance Taylor  <iant@google.com>
1871
1872         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1873         pointer.
1874         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1875         as a class, not a struct.
1876         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1877         (Target_arm::apply_cortex_a8_workaround): Likewise.
1878         * gc.h: Declare Reloc_types as a struct, not a class.
1879         * object.h: Declare Symbols_data as a struct.
1880         * reloc.h: Declare Read_relocs_data as a struct.
1881         * target.h: Declare Relocate_info as a struct.
1882
1883 2012-04-24  David S. Miller  <davem@davemloft.net>
1884
1885         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1886         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1887         and R_SPARC_WPLT30.
1888
1889 2012-04-24  Cary Coutant  <ccoutant@google.com>
1890
1891         * incremental-dump.cc (find_input_containing_global): Replace
1892         magic number with symbolic constant.
1893         (dump_incremental_inputs): Update version number.
1894         * incremental.cc (Output_section_incremental_inputs): Update version
1895         number; import symbolic constants from Incremental_inputs_reader.
1896         (Incremental_inputs::create_data_sections): Align relocations
1897         section correctly for 64-bit targets.
1898         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1899         constants; add padding.
1900         (Output_section_incremental_inputs::write_header): Add assert for
1901         header_size.
1902         (Output_section_incremental_inputs::write_input_files): Add assert
1903         for input_entry_size.
1904         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1905         add assert for object_info_size, input_section_entry_size,
1906         global_sym_entry_size.
1907         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1908         for data structure sizes; use them.
1909         (Incremental_input_entry_reader): Import symbolic constants from
1910         Incremental_inputs_reader; use them.
1911
1912 2012-04-23  David S. Miller  <davem@davemloft.net>
1913
1914         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1915         and elf_flags_set_.
1916         (Target_sparc::Target_sparc): Initialize new fields.
1917         (Target_sparc::do_make_elf_object): New function.
1918         (Target_sparc::do_adjust_elf_header): New function.
1919
1920 2012-04-23  Cary Coutant  <ccoutant@google.com>
1921
1922         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1923         CU range table of gdb index.
1924
1925 2012-04-20  David S. Miller  <davem@davemloft.net>
1926
1927         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1928         instead of false.
1929
1930 2012-04-16  David S. Miller  <davem@davemloft.net>
1931
1932         * sparc.cc (Target_sparc::got_address): New function.
1933         (Sparc_relocate_functions::gdop_hix22): New function.
1934         (Sparc_relocate_functions::gdop_lox10): New function.
1935         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1936         relocs.
1937         (Target_sparc::Scan::local): Likewise if the global symbol is not
1938         preemptible and is not IFUNC.
1939         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1940         transformations for local and non-preemptible non-IFUNC global
1941         symbols.
1942
1943         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1944         writing out 64-bit part of ranges.
1945
1946         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1947         -fpic and -fpie respectively.
1948         * Makefile.in: Regenerate.
1949
1950         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1951         (Target_sparc::Target_sparc): Initialize new field.
1952         (Target_sparc::do_plt_section_for_global): New function.
1953         (Target_sparc::do_plt_section_for_local): New function.
1954         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1955         (Target_sparc::make_plt_section): New function, broken out of
1956         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1957         (Target_sparc::make_plt_entry): Call make_plt_section.
1958         (Target_sparc::make_local_ifunc_plt_entry): New function.
1959         (Target_sparc::rela_ifunc_section): New function.
1960         (Target_sparc::plt_section): Remove const.
1961         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1962         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1963         and ifunc_count_ fields.
1964         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1965         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1966         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1967         (Output_data_plt_sparc::rela_ifunc): New function.
1968         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1969         (Output_data_plt_sparc::has_ifunc_section): New function.
1970         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1971         (Output_data_plt_sparc::address_for_global): New function.
1972         (Output_data_plt_sparc::address_for_local): New function.
1973         (Output_data_plt_sparc::plt_index_to_offset): New function.
1974         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1975         and entry_count.
1976         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1977         entry_count.
1978         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1979         R_SPARC_JMP_IREL to switch.
1980         (Target_sparc::Scan::check_non_pic): Likewise.
1981         (Target_sparc::Scan::local): Handle IFUNC symbols.
1982         (Target_sparc::Scan::local): Likewise.
1983         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1984         and plt_address_for_local.
1985         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1986         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1987
1988         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1989         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1990         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1991         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1992         global relocs too.
1993         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1994         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1995         calls.
1996         * sparc.cc (Target_sparc::Scan::global): Likewise.
1997         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1998
1999 2012-04-16  Cary Coutant  <ccoutant@google.com>
2000
2001         * archive.cc (Library_base::should_include_member): Check for
2002         --export-dynamic-symbol.
2003         * options.h (class General_options): Add --export-dynamic-symbol.
2004         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2005         --export-dynamic-symbol.
2006         (Symbol_table::gc_mark_undef_symbols): Likewise.
2007         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2008
2009 2012-04-12  David S. Miller  <davem@davemloft.net>
2010
2011         * sparc.cc (Reloc::wdisp10): New relocation method.
2012         (Reloc::h34): Likewise.
2013         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2014         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2015         R_SPARC_WDISP10.
2016         (Target_sparc::Scan::local): Likewise.
2017         (Target_sparc::Scan::global): Likewise.
2018         (Target_sparc::Relocate::relocate): Likewise.
2019
2020 2012-04-09  Cary Coutant  <ccoutant@google.com>
2021
2022         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2023         low_pc == 0.
2024
2025 2012-04-06  Ian Lance Taylor  <iant@google.com>
2026
2027         * timer.cc: #include <unistd.h>.
2028
2029 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2030
2031         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2032         * config.in: Regenerate.
2033         * configure: Regenerate.
2034
2035 2012-04-05  Nick Clifton  <nickc@redhat.com>
2036
2037         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2038         (AM_LC_MESSAGES): Add.
2039         * aclocal.m4: Regenerate.
2040         * config.in: Regenerate.
2041         * configure: Regenerate.
2042
2043 2012-03-21  Cary Coutant  <ccoutant@google.com>
2044
2045         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2046         * Makefile.in: Regenerate.
2047         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2048         (Sized_elf_reloc_mapper::symbol_section): New function.
2049         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2050         (make_elf_reloc_mapper): New function.
2051         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2052         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2053         (Dwarf_abbrev_table::do_get_abbrev): New function.
2054         (Dwarf_ranges_table::read_ranges_table): New function.
2055         (Dwarf_ranges_table::read_range_list): New function.
2056         (Dwarf_pubnames_table::read_section): New function.
2057         (Dwarf_pubnames_table::read_header): New function.
2058         (Dwarf_pubnames_table::next_name): New function.
2059         (Dwarf_die::Dwarf_die): New function.
2060         (Dwarf_die::read_attributes): New function.
2061         (Dwarf_die::skip_attributes): New function.
2062         (Dwarf_die::set_name): New function.
2063         (Dwarf_die::set_linkage_name): New function.
2064         (Dwarf_die::attribute): New function.
2065         (Dwarf_die::string_attribute): New function.
2066         (Dwarf_die::int_attribute): New function.
2067         (Dwarf_die::uint_attribute): New function.
2068         (Dwarf_die::ref_attribute): New function.
2069         (Dwarf_die::child_offset): New function.
2070         (Dwarf_die::sibling_offset): New function.
2071         (Dwarf_info_reader::check_buffer): New function.
2072         (Dwarf_info_reader::parse): New function.
2073         (Dwarf_info_reader::do_parse): New function.
2074         (Dwarf_info_reader::do_read_string_table): New function.
2075         (Dwarf_info_reader::lookup_reloc): New function.
2076         (Dwarf_info_reader::get_string): New function.
2077         (Dwarf_info_reader::visit_compilation_unit): New function.
2078         (Dwarf_info_reader::visit_type_unit): New function.
2079         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2080         Sized_elf_reloc_mapper.
2081         (Sized_dwarf_line_info::symbol_section): Remove function.
2082         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2083         (Sized_dwarf_line_info::read_line_mappings): Remove object
2084         parameter, adjust callers.
2085         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2086         * dwarf_reader.h: Include <sys/types.h>.
2087         (class Track_relocs): Remove forward declaration.
2088         (class Elf_reloc_mapper): New class.
2089         (class Sized_elf_reloc_mapper): New class.
2090         (class Dwarf_abbrev_table): New class.
2091         (class Dwarf_range_list): New class.
2092         (class Dwarf_ranges_table): New class.
2093         (class Dwarf_pubnames_table): New class.
2094         (class Dwarf_die): New class.
2095         (class Dwarf_info_reader): New class.
2096         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2097         (Sized_dwarf_line_info::symbol_section): Remove member function.
2098         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2099         base class.
2100         * gdb-index.cc: New source file.
2101         * gdb-index.h: New source file.
2102         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2103         and .debug_types sections, call Layout::add_to_gdb_index.
2104         (Sized_relobj_incr::do_section_name): Implement.
2105         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2106         return type; Implement.
2107         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2108         return type.
2109         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2110         parameter list and return type.
2111         (Sized_incr_dynobj::do_section_contents): Likewise.
2112         * layout.cc: Include gdb-index.h.
2113         (Layout::Layout): Initialize gdb_index_data_.
2114         (Layout::init_fixed_output_section): Check for .gdb_index section.
2115         (Layout::add_to_gdb_index): New function. Instantiate.
2116         * layout.h: Add forward declaration for class Gdb_index.
2117         (Layout::add_to_gdb_index): New member function.
2118         (Layout::gdb_index_data_): New data member.
2119         * main.cc: Include gdb-index.h.
2120         (main): Print statistics for gdb index.
2121         * object.cc (Object::section_contents): Move code into
2122         do_section_contents.
2123         (need_decompressed_section): Check for sections needed when building
2124         gdb index.
2125         (build_compressed_section_map): Likewise.
2126         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2127         gdb index.
2128         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2129         sections; call Layout::add_to_gdb_index.
2130         (Sized_relobj_file::do_decompressed_section_contents): Call
2131         do_section_contents directly.
2132         * object.h (Object::do_section_contents): Adjust parameter list and
2133         return type.
2134         (Object::do_decompressed_section_contents): Call do_section_contents
2135         directly.
2136         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2137         return type.
2138         * options.h (class General_options): Add --gdb-index option.
2139         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2140         list and return type.
2141         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2142         * reloc.h (Track_relocs::checkpoint): New function.
2143         (Track_relocs::reset): New function.
2144
2145         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2146         New test cases.
2147         * testsuite/Makefile.in: Regenerate.
2148         * testsuite/gdb_index_test.cc: New test source file.
2149         * testsuite/gdb_index_test_1.sh: New test source file.
2150         * testsuite/gdb_index_test_2.sh: New test source file.
2151
2152 2012-03-19  Doug Kwan  <dougkwan@google.com>
2153
2154         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2155         (Target_arm::do_finalize_sections): Remove code which defines
2156         __exidx_start and __exidx_end.  Make symbol table parameter
2157         anonymous as it is not used.
2158         * gold.cc (queue_middle_tasks): Call target hook to define any
2159         target-specific symbols.
2160         * target.h (Target::define_standard_symbols): New method.
2161         (Target::do_define_standard_symbols): Same.
2162         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2163         * testsuite/Makefile.in: Regenerate.
2164         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2165         and __exidx_end.
2166         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2167         relocations are generated for __exidx_start and __exidx_end.
2168
2169 2012-03-16  Doug Kwan  <dougkwan@google.com>
2170
2171         * testsuite/Makefile.am: Disable test initpri3b.
2172         * testsuite/Makefile.in: Regenerate.
2173
2174 2012-03-15  Doug Kwan  <dougkwan@google.com>
2175
2176         * arm.cc (Target_arm::got_section): Make .got section read-only
2177         if -z now is given.
2178
2179 2012-03-15  Ian Lance Taylor  <iant@google.com>
2180
2181         PR gold/13850
2182         * layout.cc (Layout::make_output_section): Correctly mark
2183         SHT_INIT_ARRAY, et. al., as relro.
2184
2185 2012-03-14  Doug Kwan  <dougkwan@google.com>
2186
2187         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2188         dynamic relocations for protected symbols in shared objects.
2189
2190 2012-03-13  Ian Lance Taylor  <iant@google.com>
2191
2192         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2193         keep the larger alignment.
2194
2195 2012-03-12  Cary Coutant  <ccoutant@google.com>
2196
2197         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2198         handling of DW_LNE_define_file.
2199
2200 2012-03-12  Cary Coutant  <ccoutant@google.com>
2201
2202         * reduced_debug_output.cc
2203         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2204         codes to switch.
2205
2206 2012-02-29  Cary Coutant  <ccoutant@google.com>
2207
2208         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2209
2210 2012-02-29  Cary Coutant  <ccoutant@google.com>
2211
2212         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2213         Call Object::decompressed_section_contents.
2214         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2215         New dtor.
2216         (Sized_dwarf_line_info::buffer_start_): New data member.
2217         * merge.cc (Output_merge_data::do_add_input_section): Call
2218         Object::decompressed_section_contents.
2219         (Output_merge_string::do_add_input_section): Likewise.
2220         * object.cc (need_decompressed_section): New function.
2221         (build_compressed_section_map): Decompress sections needed later.
2222         (Sized_relobj_file::do_decompressed_section_contents): New function.
2223         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2224         * object.h (Object::decompressed_section_contents): New function.
2225         (Object::discard_decompressed_sections): New function.
2226         (Object::do_decompressed_section_contents): New function.
2227         (Object::do_discard_decompressed_sections): New function.
2228         (Compressed_section_info): New type.
2229         (Compressed_section_map): Include decompressed section contents.
2230         (Sized_relobj_file::do_decompressed_section_contents): New function.
2231         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2232
2233 2012-02-16  Cary Coutant  <ccoutant@google.com>
2234
2235         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2236         * testsuite/Makefile.in: Regenerate.
2237
2238 2012-02-14  Cary Coutant  <ccoutant@google.com>
2239
2240         * options.cc (General_options::finalize): Disallow -pie and -static.
2241
2242 2012-02-03  Doug Kwan  <dougkwan@google.com>
2243
2244         * arm.cc (Arm_relocate_functions::abs8,
2245         Arm_relocate_functions::abs16): Use
2246         Bits::has_signed_unsigned_overflow32.
2247         (Arm_relocate_functions::thm_abs8): Correct range of
2248         overflow check.
2249         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2250         in assertions.
2251
2252 2012-02-02  Doug Kwan  <dougkwan@google.com>
2253
2254         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2255         position independent outputs, not just shared objects.
2256
2257 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2258
2259         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2260         * configure: Regenerated.
2261
2262 2012-01-27  Ian Lance Taylor  <iant@google.com>
2263
2264         * reloc.h (Bits): New class with static functions, copied from
2265         namespace utils in arm.cc.
2266         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2267         instead.
2268
2269 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2270
2271         * incremental.cc (write_info_blocks): Correct relocation offset.
2272
2273 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2274
2275         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2276         (Relocate::tls_gd_to_le): Likewise.
2277
2278 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2279
2280         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2281
2282 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2283
2284         * configure.ac: Check if -mcmodel=medium works.
2285         * configure: Regenerated.
2286
2287 2012-01-24  Cary Coutant  <ccoutant@google.com>
2288
2289         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2290         definition and ...
2291         (read_unsigned_LEB_128_x): ... this new function.
2292         (read_signed_LEB_128): Replaced with inline definition and ...
2293         (read_signed_LEB_128_x): ... this new function.
2294         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2295         (read_unsigned_LEB_128): Add inline definition.
2296         (read_signed_LEB_128_x): New function.
2297         (read_signed_LEB_128): Add inline definition.
2298         * testsuite/Makefile.am (leb128_unittest): New unit test.
2299         * testsuite/Makefile.in: Regenerate.
2300         * testsuite/leb128_unittest.cc: New unit test.
2301
2302 2012-01-23  Ian Lance Taylor  <iant@google.com>
2303
2304         PR gold/13617
2305         * i386.cc (Target_i386::do_code_fill): When using a jmp
2306         instruction, pad with nop instructions.
2307         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2308
2309 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2310
2311         * x86_64.cc (gc_process_relocs): Add typename on types used in
2312         template.
2313         (scan_relocs): Likewise.
2314         (relocate_section): Likewise.
2315         (apply_relocation): Likewise.
2316
2317 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2318
2319         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2320         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2321         under x32.
2322
2323 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2324
2325         * x86_64.cc: Initial support for x32.
2326
2327 2012-01-03  Cary Coutant  <ccoutant@google.com>
2328
2329         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2330         Use abstract base class for GOT.
2331         * gold/output.h (class Output_data_got_base): New abstract base class.
2332         (class Output_data_got): Derive from new base class, adjust ctors.
2333         (Output_data_got::reserve_slot): Make virtual; rename to
2334         do_reserve_slot; Adjust callers.
2335         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2336         pointer to abstract base class.
2337         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2338
2339 2011-12-18  Ian Lance Taylor  <iant@google.com>
2340
2341         * object.h (Relobj::local_symbol_value): New function.
2342         (Relobj::local_plt_offset): New function.
2343         (Relobj::local_has_got_offset): New function.
2344         (Relobj::local_got_offset): New function.
2345         (Relobj::set_local_got_offset): New function.
2346         (Relobj::do_local_symbol_value): New pure virtual function.
2347         (Relobj::do_local_plt_offset): Likewise.
2348         (Relobj::do_local_has_got_offset): Likewise.
2349         (Relobj::do_local_got_offset): Likewise.
2350         (Relobj::do_set_local_got_offset): Likewise.
2351         (Sized_relobj::do_local_has_got_offset): Rename from
2352         local_has_got_offset.
2353         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2354         (Sized_relobj::do_set_local_got_offset): Rename from
2355         set_local_got_offset.
2356         (Sized_relobj_file::do_local_plt_offset): Rename from
2357         local_plt_offset.
2358         (Sized_relobj_file::do_local_symbol_value): New function.
2359         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2360         local_plt_offset.
2361         * output.cc (Output_data_got::Got_entry::write): Change object to
2362         Relobj.  Use local_symbol_value.
2363         (Output_data_got::add_global_with_rel): Change rel_dyn to
2364         Output_data_reloc_generic*.  Use add_global_generic.
2365         (Output_data_got::add_global_with_rela): Remove.  Change all
2366         callers to use add_global_with_rel.
2367         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2368         Output_data_reloc_generic*.  Use add_global_generic.
2369         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2370         callers to use add_global_pair_with_rel.
2371         (Output_data_got::add_local): Change object to Relobj*.
2372         (Output_data_got::add_local_plt): Likewise.
2373         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2374         change rel_dyn to Output_data_reloc_generic*.  Use
2375         add_local_generic.
2376         (Output_data_got::add_local_with_rela): Remove.  Change all
2377         callers to use all_local_with_rel.
2378         (Output_data_got::add_local_pair_with_rel): Change object to
2379         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2380         add_output_section_generic.
2381         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2382         callers to use add_local_pair_with_rel.
2383         (Output_data_got::reserve_local): Change object to Relobj*.
2384         * output.h: (class Output_data_reloc_generic): Add pure virtual
2385         declarations for add_global_generic, add_local_generic,
2386         add_output_section_generic.
2387         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2388         functions for Output_data_reloc_generic.  Update declarations for
2389         changes listed in output.cc.
2390         (class Output_data_got): Change template parameter to got_size.
2391         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2392         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2393         function.
2394         (Sized_relobj_incr::do_local_plt_offset): New function.
2395         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2396         add_global_generic.
2397
2398 2011-12-17  Cary Coutant  <ccoutant@google.com>
2399
2400         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2401         * resolve.cc (Symbol_table::resolve): Likewise.
2402         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2403         arrays.
2404         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2405
2406 2011-12-16  Ian Lance Taylor  <iant@google.com>
2407
2408         * output.h (Output_data_reloc_generic::add): Only call
2409         add_dynamic_reloc if this is a dynamic reloc section.
2410
2411 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2412
2413         PR gold/13505
2414         * target-reloc.h (apply_relocation): Replace <64, false> with
2415         <size, big_endian>.
2416
2417 2011-11-25  Nick Clifton  <nickc@redhat.com>
2418
2419         * po/it.po: New Italian translation.
2420
2421 2011-11-17  Sterling Augustine  <saugustine@google.com>
2422
2423         * script.cc (script_include_directive): Implement.
2424         (read_script_file): New local variables name and search_path. Update
2425         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2426         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2427         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2428
2429 2011-11-11  Sterling Augustine  <saugustine@google.com>
2430
2431         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2432         (file_or_sections_cmd): Likewise.
2433
2434 2011-11-11  Doug Kwan  <dougkwan@google.com>
2435
2436         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2437         if --just-symbols is given.
2438
2439 2011-11-10  Doug Kwan  <dougkwan@google.com>
2440
2441         PR gold/13362
2442         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2443         when processing data relocs.
2444         * reloc.h (Relocate_functions::rel_unaligned): New method.
2445         (Relocate_functions::pcrel_unaligned): Ditto.
2446         (Relocate_functions::rel32_unaligned): Ditto.
2447         (Relocate_functions::pcrel32_unaligned): Ditto.
2448
2449 2011-11-09  Doug Kwan  <dougkwan@google.com>
2450
2451         PR gold/13362
2452         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2453         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2454         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2455         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2456         (Relocate_functions::rel_unaligned): New.
2457         (Relocate_functions::rel32_unaligned): New.
2458         * target-reloc.h (relocate_for_relocatable): Add code to handle
2459         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2460         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2461         arm_unaligned_reloc_r): New targets.
2462         * testsuite/Makefile.in: Regenerate.
2463         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2464         linking.
2465
2466 2011-11-02  Ian Lance Taylor  <iant@google.com>
2467
2468         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2469         NATIVE_LINKER.
2470         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2471         * options.cc (General_options::finalize): Use library search path
2472         from configure script if specified.  If not native and no sysroot,
2473         only search TOOLLIBDIR.
2474         * options.h (Search_directory::Search_directory): Change name to
2475         const std::string&.
2476         (General_options::add_to_library_path_with_sysroot): Change arg to
2477         const std::string&.
2478         * configure, Makefile.in, config.in: Rebuild.
2479
2480 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2481
2482         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2483         we are working around the ARM1176 Erratum.
2484         * options.h (General_options::fix_arm1176): Add option.
2485         * testsuite/Makefile.am: Add testcases, and keep current ones
2486         working.
2487         * testsuite/Makefile.in: Regenerate.
2488         * testsuite/arm_fix_1176.s: New file.
2489         * testsuite/arm_fix_1176.sh: Likewise.
2490
2491 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2492
2493         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2494         may_use_blx_.
2495         (Target_arm::may_use_blx): Remove method.
2496         (Target_arm::set_may_use_blx): Likewise.
2497         (Target_arm::may_use_v4t_interworking): New method.
2498         (Target_arm::may_use_v5t_interworking): Likewise.
2499         (Target_arm::may_use_blx_): Remove member variable.
2500         (Arm_relocate_functions::arm_branch_common): Check for v5T
2501         interworking.
2502         (Arm_relocate_functions::thumb_branch_common): Likewise.
2503         (Reloc_stub::stub_type_for_reloc): Likewise.
2504         (Target_arm::do_finalize_sections): Correct interworking checks.
2505         * testsuite/Makefile.am: Add new tests.
2506         * testsuite/Makefile.in: Regenerate.
2507         * testsuite/arm_farcall_arm_arm.s: New test.
2508         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2509         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2510         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2511         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2512         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2513         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2514         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2515
2516 2011-10-31  Cary Coutant  <ccoutant@google.com>
2517
2518         PR gold/13023
2519         * expression.cc (Expression::eval_with_dot): Add
2520         is_section_dot_assignment parameter.
2521         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2522         absolute and assigning to dot within a section.
2523         * script-sections.cc
2524         (Output_section_element_assignment::set_section_addresses): Pass
2525         dot_section to set_if_absolute.
2526         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2527         as is_section_dot_assignment flag to eval_with_dot.
2528         (Output_section_element_dot_assignment::set_section_addresses):
2529         Likewise.
2530         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2531         parameter.  Also set value if relative to dot_section; set the
2532         symbol's output_section.
2533         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2534         parameter.  Adjust all callers.
2535         (Expression::eval_maybe_dot): Likewise.
2536         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2537         Adjust all callers.
2538         * testsuite/script_test_2.t: Test assignment of an absolute value
2539         to dot within an output section element.
2540
2541 2011-10-31  Cary Coutant  <ccoutant@google.com>
2542
2543         * options.h (class General_options): Add --[no-]gnu-unique options.
2544         * symtab.cc (Symbol_table::sized_write_globals): Convert
2545         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2546
2547 2011-10-31  Cary Coutant  <ccoutant@google.com>
2548
2549         PR gold/13359
2550         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2551         unnecessary assertion.
2552         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2553
2554 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2555
2556         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2557         gc_mark_symbol.
2558         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2559         gc_mark_symbol.
2560         Change to just keep the section associated with symbol.
2561         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2562         they are externally visible and --export-dynamic is turned on.
2563         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2564
2565 2011-10-19  Ian Lance Taylor  <iant@google.com>
2566
2567         PR gold/13163
2568         * script-sections.cc
2569         (Output_section_element_dot_assignment::needs_output_section): New
2570         function.
2571
2572 2011-10-19  Ian Lance Taylor  <iant@google.com>
2573
2574         PR gold/13204
2575         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2576         --section-start option was seen.
2577         * options.h (General_options::any_section_start): New function.
2578
2579 2011-10-18  David S. Miller  <davem@davemloft.net>
2580
2581         PR binutils/13301
2582         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2583         member to track relocation locations that have moved during TLS
2584         reloc optimizations.
2585         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2586         (Target_sparc::Relocate::relocate): Adjust view down by 4
2587         bytes if it matches reloc_adjust_addr_.
2588         (Target_sparc::Relocate::relocate_tls): Always move the
2589         __tls_get_addr call delay slot instruction forward 4 bytes when
2590         performing relaxation.
2591
2592 2011-10-18  Cary Coutant  <ccoutant@google.com>
2593
2594         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2595         (Output_file::map_no_anonymous): Check for non-zero
2596         return code from posix_fallocate.
2597
2598 2011-10-17  Cary Coutant  <ccoutant@google.com>
2599
2600         PR gold/13245
2601         * plugin.cc (is_visible_from_outside): Check for symbols
2602         referenced from dynamic objects.
2603         * resolve.cc (Symbol_table::resolve): Don't count references
2604         from dynamic objects as references from real ELF files.
2605         * testsuite/plugin_test_2.sh: Adjust expected result.
2606
2607 2011-10-17  Cary Coutant  <ccoutant@google.com>
2608
2609         * gold.cc: Include timer.h.
2610         (queue_middle_tasks): Stamp time.
2611         (queue_final_tasks): Likewise.
2612         * main.cc (main): Store timer in parameters.  Print timers
2613         for each pass.
2614         * parameters.cc (Parameters::Parameters): Initialize timer_.
2615         (Parameters::set_timer): New function.
2616         (set_parameters_timer): New function.
2617         * parameters.h (Parameters::set_timer): New function.
2618         (Parameters::timer): New function.
2619         (Parameters::timer_): New data member.
2620         (set_parameters_timer): New function.
2621         * timer.cc (Timer::stamp): New function.
2622         (Timer::get_pass_time): New function.
2623         * timer.h (Timer::stamp): New function.
2624         (Timer::get_pass_time): New function.
2625         (Timer::pass_times_): New data member.
2626
2627 2011-10-17  Cary Coutant  <ccoutant@google.com>
2628
2629         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2630         task for members of lib groups.
2631
2632 2011-10-17  Cary Coutant  <ccoutant@google.com>
2633
2634         PR gold/13288
2635         * fileread.cc (File_read::find_view): Add assert.
2636         (File_read::make_view): Move bounds check (replace with assert)...
2637         (File_read::find_or_make_view): ... to here.
2638
2639 2011-10-12  Cary Coutant  <ccoutant@google.com>
2640
2641         * output.cc (Output_file::open_base_file): Handle case where
2642         ::read returns less than requested size.
2643
2644 2011-10-10  Cary Coutant  <ccoutant@google.com>
2645
2646         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2647         Initialize defined_count_.
2648         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2649         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2650         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2651         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2652         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2653         * incremental.h (Sized_relobj_incr::defined_count_): New data
2654         member.
2655         (Sized_incr_dynobj::defined_count_): New data member.
2656         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2657         Return zeroes instead of internal error.
2658
2659 2011-10-10  Cary Coutant  <ccoutant@google.com>
2660
2661         PR gold/13249
2662         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2663         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2664         * output.h (class Output_reloc): Add use_plt_offset flag.
2665         (Output_reloc::type_): Adjust size of bit field.
2666         (Output_reloc::use_plt_offset_): New bit field.
2667         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2668         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2669         flag.  Adjust all callers.
2670         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2671         creating RELATIVE relocations.
2672
2673 2011-10-10  Nick Clifton  <nickc@redhat.com>
2674
2675         * po/es.po: Updated Spanish translation.
2676         * po/fi.po: Updated Finnish translation.
2677
2678 2011-10-03   Diego Novillo  <dnovillo@google.com>
2679
2680         * options.cc (parse_uint): Fix dereference of RETVAL.
2681
2682 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2683
2684         * layout.h (section_order_map_): New member.
2685         (get_section_order_map): New member function.
2686         * output.cc (Output_section::add_input_section): Check for patterns
2687         only when --section-ordering-file is specified.
2688         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2689         output_sections have been formed.
2690         * layout.cc (Layout_Layout): Initialize section_order_map_.
2691         * plugin.cc (update_section_order): Store order in order_map. Do not
2692         update the order.
2693         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2694         * testsuite/Makefile.in: Regenerate.
2695         * testsuite/plugin_section_order.c: New file.
2696         * testsuite/plugin_final_layout.cc: New file.
2697         * testsuite/plugin_final_layout.sh: New file.
2698
2699 2011-09-29  Cary Coutant  <ccoutant@google.com>
2700
2701         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2702         Check for NULL.
2703         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2704         symbols during incremental update.
2705         (Symbol_table::add_from_dynobj): Likewise.
2706
2707 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2708             Ian Lance Taylor  <iant@google.com>
2709
2710         * symtab.cc (Symbol_table::define_special_symbol): Always
2711         canonicalize version string.
2712
2713 2011-09-26  Cary Coutant  <ccoutant@google.com>
2714
2715         * gold.cc (queue_initial_tasks): Move option checks ...
2716         * options.cc (General_options::finalize): ... to here. Disable
2717         some options; make others fatal.
2718
2719 2011-09-26  Cary Coutant  <ccoutant@google.com>
2720
2721         gcc PR lto/47247
2722         * plugin.cc (get_symbols_v2): New function.
2723         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2724         (is_referenced_from_outside): New function.
2725         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2726         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2727         (get_symbols): Pass version parameter.
2728         (get_symbols_v2): New function.
2729         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2730         parameter.
2731         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2732         (onload): Add LDPT_GET_SYMBOLS_V2.
2733         (all_symbols_read_hook): Use get_symbols_v2; check for
2734         LDPR_PREVAILING_DEF_IRONLY_EXP.
2735         * testsuite/plugin_test_3.sh: Update expected results.
2736
2737 2011-09-23  Simon Baldwin  <simonb@google.com>
2738
2739         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2740         configuration options.
2741         * configure: Regenerate.
2742         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2743         * Makefile.in: Regenerate.
2744         * testsuite/Makefile.in: Regenerate.
2745
2746 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2747
2748         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2749
2750 2011-09-19  Cary Coutant  <ccoutant@google.com>
2751
2752         * incremental.cc (can_incremental_update): Fix typo in comment.
2753         * incremental.h (can_incremental_update): Likewise.
2754
2755 2011-09-18  Cary Coutant  <ccoutant@google.com>
2756
2757         * incremental.cc (can_incremental_update): New function.
2758         * incremental.h (can_incremental_update): New function.
2759         * layout.cc (Layout::init_fixed_output_section): Call it.
2760         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2761         * object.cc (Sized_relobj_file::do_layout): Call
2762         can_incremental_update.
2763
2764 2011-09-13  Cary Coutant  <ccoutant@google.com>
2765
2766         * configure.ac: Check for glibc support for gnu_indirect_function
2767         support with static linking, setting automake conditional
2768         IFUNC_STATIC.
2769         * Makefile.in: Regenerate.
2770         * configure: Regenerate.
2771
2772         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2773         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2774         for IFUNC_STATIC.
2775         * testsuite/Makefile.in: Regenerate.
2776
2777 2011-09-13  Cary Coutant  <ccoutant@google.com>
2778
2779         * incremental.cc (Sized_relobj_incr::do_layout): Call
2780         report_comdat_group for kept comdat sections.
2781         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2782         * testsuite/Makefile.in: Regenerate.
2783         * testsuite/incr_comdat_test_1.cc: New source file.
2784         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2785         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2786         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2787
2788 2011-09-13  Ian Lance Taylor  <iant@google.com>
2789
2790         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2791         variable external_symbols_offset.
2792
2793 2011-09-12  Ian Lance Taylor  <iant@google.com>
2794
2795         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2796         triggered if object has no symbols.
2797
2798 2011-09-09  David S. Miller  <davem@davemloft.net>
2799
2800         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2801         (Output_fill_debug_line::do_write): Likewise.
2802
2803 2011-08-29  Cary Coutant  <ccoutant@google.com>
2804
2805         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2806         casts to match formatting specs.
2807         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2808
2809 2011-08-26  Cary Coutant  <ccoutant@google.com>
2810
2811         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2812         remaining hole size when allocating.
2813         (Layout::make_output_section): Set fill methods for debug sections.
2814         * layout.h (Free_list::Free_list_node): Move from private to
2815         public.
2816         (Free_list::set_min_hole_size): New function.
2817         (Free_list::begin, Free_list::end): New functions.
2818         (Free_list::min_hole_): New data member.
2819         * output.cc: Include dwarf.h.
2820         (Output_fill_debug_info::do_minimum_hole_size): New function.
2821         (Output_fill_debug_info::do_write): New function.
2822         (Output_fill_debug_line::do_minimum_hole_size): New function.
2823         (Output_fill_debug_line::do_write): New function.
2824         (Output_section::Output_section): Initialize new data member.
2825         (Output_section::set_final_data_size): Ensure patch space is larger
2826         than minimum hole size.
2827         (Output_section::do_write): Fill holes in debug sections.
2828         * output.h (Output_fill): New class.
2829         (Output_fill_debug_info): New class.
2830         (Output_fill_debug_line): New class.
2831         (Output_section::set_free_space_fill): New function.
2832         (Output_section::free_space_fill_): New data member.
2833         * testsuite/Makefile.am (incremental_test_3): Add
2834         --incremental-patch option.
2835         (incremental_test_4): Likewise.
2836         (incremental_test_5): Likewise.
2837         (incremental_test_6): Likewise.
2838         (incremental_copy_test): Likewise.
2839         (incremental_common_test_1): Likewise.
2840         * testsuite/Makefile.in: Regenerate.
2841
2842 2011-08-26  Nick Clifton  <nickc@redhat.com>
2843
2844         * po/es.po: Updated Spanish translation.
2845
2846 2011-08-01  Cary Coutant  <ccoutant@google.com>
2847
2848         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2849         * gold/testsuite/Makefile.in: Regenerate.
2850         * gold/testsuite/justsyms_exec.c: New source file.
2851         * gold/testsuite/justsyms_lib.c: New source file.
2852
2853 2011-08-01  Cary Coutant  <ccoutant@google.com>
2854
2855         * layout.cc (Layout::set_segment_offsets): Don't realign text
2856         segment if -Ttext was specified.
2857         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2858         file type.
2859         * object.h (Sized_relobj_file::e_type): New function.
2860         (Sized_relobj_file::e_type_): New data member.
2861         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2862         base address for ET_EXEC files.
2863         * target.cc (Target::do_make_elf_object_implementation): Allow
2864         ET_EXEC files with --just-symbols option.
2865
2866 2011-07-28  Cary Coutant  <ccoutant@google.com>
2867
2868         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2869         Add thread_number parameter.
2870         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2871         * workqueue-threads.cc
2872         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2873         current thread if its thread number is greater than desired thread
2874         count.
2875         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2876         Add thread_number parameter.
2877         (Workqueue::should_cancel_thread): Likewise.
2878         (Workqueue::find_runnable_or_wait): Pass thread_number to
2879         should_cancel_thread.
2880         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2881         parameter.
2882
2883 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2884
2885         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2886         only after checking if it cannot be forced local.
2887         * symtab.h (is_externally_visible): Check if the symbol is not forced
2888         local.
2889
2890 2011-07-15  Ian Lance Taylor  <iant@google.com>
2891
2892         * options.h (class General_options): Add --print-output-format.
2893         Move -EL next to -EB, for  better --help output.
2894         * target-select.cc: Include <cstdio>, "options.h", and
2895         "parameters.h".
2896         (Target_selector::do_target_bfd_name): New function.
2897         (print_output_format): New function.
2898         * target-select.h (class Target_selector): Update declarations.
2899         (Target_selector::target_bfd_name): New function.
2900         (print_output_format): Declare.
2901         * main.cc: Include "target-select.h".
2902         (main): Handle --print-output-format.
2903         * gold.cc: Include "target-select.h".
2904         (queue_initial_tasks): Handle --print-output-format when there are
2905         no input files.
2906         * parameters.cc (parameters_force_valid_target): Give a better
2907         error message if -EB/-EL does not match target.
2908         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2909         function.
2910
2911 2011-07-15  Ian Lance Taylor  <iant@google.com>
2912
2913         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2914         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2915         (Output_data_plt_i386::do_write): Write address of .dynamic
2916         section to first entry in .got.plt section.
2917         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2918         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2919         Initialize layout_.
2920         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2921         section to first entry in .got.plt section.
2922         * layout.h (Layout::dynamic_section): New function.
2923
2924 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2925
2926         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2927         to claim_file call.
2928         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2929         input_section_position_, and input_section_glob_.
2930         (read_layout_from_file): Call function section_ordering_specified.
2931         * layout.h (is_section_ordering_specified): New function.
2932         (section_ordering_specified): New function.
2933         (section_ordering_specified_): New boolean member.
2934         * main.cc(main): Call load_plugins after layout object is defined.
2935         * output.cc (Output_section::add_input_section): Use
2936         function section_ordering_specified to check if section ordering is
2937         needed.
2938         * output.cc (Output_section::add_relaxed_input_section): Use
2939         function section_ordering_specified to check if section ordering is
2940         needed.
2941         (Output_section::update_section_layout): New function.
2942         (Output_section::sort_attached_input_sections): Check if input section
2943         must be reordered.
2944         * output.h (Output_section::update_section_layout): New function.
2945         * plugin.cc (get_section_count): New function.
2946         (get_section_type): New function.
2947         (get_section_name): New function.
2948         (get_section_contents): New function.
2949         (update_section_order): New function.
2950         (allow_section_ordering): New function.
2951         (Plugin::load): Add the new interfaces to the transfer vector.
2952         (Plugin_manager::load_plugins): New parameter.
2953         (Plugin_manager::all_symbols_read): New parameter.
2954         (Plugin_manager::claim_file): New parameter. Save the elf object for
2955         unclaimed objects.
2956         (Plugin_manager::get_elf_object): New function.
2957         (Plugin_manager::get_view): Change to directly use the bool to check
2958         if get_view is called from claim_file_hook.
2959         * plugin.h (input_objects): New function
2960         (Plugin__manager::load_plugins): New parameter.
2961         (Plugin_manager::claim_file): New parameter.
2962         (Plugin_manager::get_elf_object): New function.
2963         (Plugin_manager::in_claim_file_handler): New function.
2964         (Plugin_manager::in_claim_file_handler_): New member.
2965         (layout): New function.
2966         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2967         handler with an extra parameter. Make the elf object before calling
2968         claim_file handler.
2969         * testsuite/plugin_test.c (get_section_count): New function pointer.
2970         (get_section_type): New function pointer.
2971         (get_section_name): New function pointer.
2972         (get_section_contents): New function pointer.
2973         (update_section_order): New function pointer.
2974         (allow_section_ordering): New function pointer.
2975         (onload): Check if the new interfaces exist.
2976
2977 2011-07-13  Ian Lance Taylor  <iant@google.com>
2978
2979         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2980         relro section.
2981         * x86_64.cc (Target_x86_64::got_section): Likewise.
2982         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2983         (relro_now_test_SOURCES): New variable.
2984         (relro_now_test_DEPENDENCIES): New variable.
2985         (relro_now_test_LDFLAGS): New variable.
2986         (relro_now_test_LDADD): New variable.
2987         (relro_now_test.so): New target.
2988         * testsuite/Makefile.in: Rebuild.
2989
2990 2011-07-12  Ian Lance Taylor  <iant@google.com>
2991
2992         PR gold/12980
2993         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2994         GLOB_DAT relocation rather than a RELATIVE relocation for a
2995         protected symbol when creating a shared library.
2996         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2997         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2998         * testsuite/protected_main_1.cc (main): Test that protected
2999         function has same address.
3000
3001 2011-07-11  Ian Lance Taylor  <iant@google.com>
3002
3003         PR gold/12979
3004         * options.h (class General_options): Add -Bgroup.
3005         * options.cc (General_options::finalize): If -Bgroup is set,
3006         default to --unresolved-symbols=report-all.
3007         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3008         * target-reloc.h (issue_undefined_symbol_error): Handle
3009         --unresolved-symbols=report-all.
3010
3011 2011-07-08  Ian Lance Taylor  <iant@google.com>
3012
3013         PR gold/11985
3014         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3015         if linker script discards key sections.
3016         (Layout::create_dynamic_symtab): Likewise.
3017         (Layout::assign_local_dynsym_offsets): Likewise.
3018         (Layout::sized_create_version_sections): Likewise.
3019         (Layout::create_interp): Likewise.
3020         (Layout::finish_dynamic_section): Likewise.
3021         (Layout::set_dynamic_symbol_size): Likewise.
3022
3023 2011-07-08  Ian Lance Taylor  <iant@google.com>
3024
3025         PR gold/12386
3026         * options.h (class General_options): Add --unresolved-symbols.
3027         * target-reloc.h (issue_undefined_symbol_error): Check
3028         --unresolved-symbols.  Add comments.
3029
3030 2011-07-08  Ian Lance Taylor  <iant@google.com>
3031
3032         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3033         expression more complex.
3034
3035 2011-07-08  Ian Lance Taylor  <iant@google.com>
3036
3037         PR gold/11317
3038         * target-reloc.h (issue_undefined_symbol_error): New inline
3039         function, broken out of relocate_section.
3040         (relocate_section): Call issue_undefined_symbol_error.
3041         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3042         there is no TLS segment if we are about to issue an undefined
3043         symbol error.
3044         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3045
3046 2011-07-08  Ian Lance Taylor  <iant@google.com>
3047
3048         PR gold/12279
3049         * resolve.cc (Symbol_table::should_override): Add fromtype
3050         parameter.  Change all callers.  Give error when linking together
3051         TLS and non-TLS symbol.
3052         (Symbol_table::should_override_with_special): Add fromtype
3053         parameter.  Change all callers.
3054         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3055         there is no TLS segment if we have reported some errors.
3056         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3057
3058 2011-07-08  Ian Lance Taylor  <iant@google.com>
3059
3060         PR gold/12372
3061         * target.h (Target::plt_address_for_global): New function.
3062         (Target::plt_address_for_local): New function.
3063         (Target::plt_section_for_global): Remove.
3064         (Target::plt_section_for_local): Remove.
3065         (Target::do_plt_address_for_global): New virtual function.
3066         (Target::do_plt_address_for_local): New virtual function.
3067         (Target::do_plt_section_for_global): Remove.
3068         (Target::do_plt_section_for_local): Remove.
3069         (Target::register_global_plt_entry): Add Symbol_table and Layout
3070         parameters.
3071         * output.cc (Output_data_got::Got_entry::write): Use
3072         plt_address_for_global and plt_address_for_local.
3073         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3074         address of output section.
3075         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3076         got_irelative_, and irelative_count_ fields.  Update
3077         declarations.
3078         (Output_data_plt_i386::has_irelative_section): New function.
3079         (Output_data_plt_i386::entry_count): Add irelative_count_.
3080         (Output_data_plt_i386::set_final_data_size): Likewise.
3081         (class Target_i386): Add got_irelative_ and rel_irelative_
3082         fields.  Update declarations.
3083         (Target_i386::Target_i386): Initialize new fields.
3084         (Target_i386::do_plt_address_for_global): New function replacing
3085         do_plt_section_for_global.
3086         (Target_i386::do_plt_address_for_local): New function replacing
3087         do_plt_section_for_local.
3088         (Target_i386::got_section): Create got_irelative_.
3089         (Target_i386::rel_irelative_section): New function.
3090         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3091         fields.  Don't define __rel_iplt_{start,end}.
3092         (Output_data_plt_i386::add_entry): Add symtab and layout
3093         parameters.  Change all callers.  Use different PLT and GOT for
3094         IFUNC symbols.
3095         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3096         layout parameters.  Change all callers.  Use different PLT and
3097         GOT.
3098         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3099         (Output_data_plt_i386::rel_irelative): New function.
3100         (Output_data_plt_i386::address_for_global): New function.
3101         (Output_data_plt_i386::address_for_local): New function.
3102         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3103         IRELATIVE GOT when changing IFUNC GOT entries.
3104         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3105         reloc.
3106         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3107         if we didn't create an IRELATIVE GOT.
3108         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3109         plt_address_for_local.
3110         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3111         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3112         got_irelative_, and irelative_count_ fields.  Update
3113         declarations.
3114         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3115         Initialize new fields.  Remove symtab parameter.  Change all
3116         callers.
3117         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3118         irelative_count_.
3119         (Output_data_plt_x86_64::has_irelative_section): New function.
3120         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3121         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3122         fields.  Update declarations.
3123         (Target_x86_64::Target_x86_64): Initialize new fields.
3124         (Target_x86_64::do_plt_address_for_global): New function replacing
3125         do_plt_section_for_global.
3126         (Target_x86_64::do_plt_address_for_local): New function replacing
3127         do_plt_section_for_local.
3128         (Target_x86_64::got_section): Create got_irelative_.
3129         (Target_x86_64::rela_irelative_section): New function.
3130         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3131         all callers.  Don't create __rel_iplt_{start,end}.
3132         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3133         parameters.  Change all callers.  Use different PLT and GOT for
3134         IFUNC symbols.
3135         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3136         layout parameters.  Change all callers.  Use different PLT and
3137         GOT.
3138         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3139         parameters.  Change all callers.  Use different PLT and GOT for
3140         IFUNC symbols.
3141         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3142         (Output_data_plt_x86_64::rela_irelative): New function.
3143         (Output_data_plt_x86_64::address_for_global): New function.
3144         (Output_data_plt_x86_64::address_for_local): New function.
3145         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3146         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3147         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3148         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3149         parameters.
3150         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3151         reloc.
3152         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3153         symbols if we didn't create an IRELATIVE GOT.
3154         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3155         plt_address_for_local.
3156         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3157         * testsuite/ifuncvar1.c: New test file.
3158         * testsuite/ifuncvar2.c: New test file.
3159         * testsuite/ifuncvar3.c: New test file.
3160         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3161         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3162         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3163         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3164         * testsuite/Makefile.in: Rebuild.
3165
3166 2011-07-07  Cary Coutant  <ccoutant@google.com>
3167
3168         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3169         (two_file_test_1_ndebug.o): Likewise.
3170         (two_file_test_1b_ndebug.o): Likewise.
3171         (two_file_test_2_ndebug.o): Likewise.
3172         (two_file_test_main_ndebug.o): Likewise.
3173         (incremental_test_2): Link with no-debug versions.
3174
3175 2011-07-06  Cary Coutant  <ccoutant@google.com>
3176
3177         * gold/incremental.cc
3178         (Output_section_incremental_inputs::write_info_blocks): Check for
3179         hidden and internal symbols.
3180
3181 2011-07-06  Cary Coutant  <ccoutant@google.com>
3182
3183         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3184         Check disposition for startup file.
3185         (Incremental_inputs::report_command_line): Ignore
3186         --incremental-startup-unchanged option.
3187         * options.cc (General_options::parse_incremental_startup_unchanged):
3188         New function.
3189         (General_options::General_options): Initialize new data member.
3190         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3191         (General_options): Add --incremental-startup-unchanged option.
3192         (General_options::incremental_startup_disposition): New function.
3193         (General_options::incremental_startup_disposition_): New data member.
3194
3195 2011-07-06  Cary Coutant  <ccoutant@google.com>
3196
3197         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3198         input file index to Script_info ctor.
3199         (Sized_incremental_binary::do_file_has_changed): Find the
3200         command-line argument for files named in scripts.
3201         * incremental.h (Script_info::Script_info): New ctor
3202         with input file index.
3203         (Script_info::input_file_index): New function.
3204         (Script_info::input_file_index_): New data member.
3205         (Incremental_binary::get_library): Add const.
3206         (Incremental_binary::get_script_info): Add const.
3207         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3208         * testsuite/Makefile.am (incremental_test_5): New test case.
3209         (incremental_test_6): New test case.
3210         * testsuite/Makefile.in: Regenerate.
3211
3212 2011-07-06  Cary Coutant  <ccoutant@google.com>
3213
3214         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3215         debug output when command lines differ.
3216
3217 2011-07-06  Cary Coutant  <ccoutant@google.com>
3218
3219         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3220         --incremental-patch option.
3221         * layout.cc (Free_list::allocate): Extend allocation beyond original
3222         end if enabled.
3223         (Layout::make_output_section): Mark sections that should get
3224         patch space.
3225         * options.cc (parse_percent): New function.
3226         * options.h (parse_percent): New function.
3227         (DEFINE_percent): New macro.
3228         (General_options): Add --incremental-patch option.
3229         * output.cc (Output_section::Output_section): Initialize new data
3230         members.
3231         (Output_section::add_input_section): Print section name when out
3232         of patch space.
3233         (Output_section::add_output_section_data): Likewise.
3234         (Output_section::set_final_data_size): Add patch space when
3235         doing --incremental-full.
3236         (Output_section::do_reset_address_and_file_offset): Remove patch
3237         space.
3238         (Output_segment::set_section_list_addresses): Print debug output
3239         only if --incremental-update.
3240         * output.h (Output_section::set_is_patch_space_allowed): New function.
3241         (Output_section::is_patch_space_allowed_): New data member.
3242         (Output_section::patch_space_): New data member.
3243         * parameters.cc (Parameters::incremental_full): New function.
3244         * parameters.h (Parameters::incremental_full): New function
3245         * testsuite/Makefile.am (incremental_test_2): Add test for
3246         --incremental-patch option.
3247         * testsuite/Makefile.in: Regenerate.
3248         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3249         (t18): Remove function body.
3250
3251 2011-07-05  Doug Kwan  <dougkwan@google.com>
3252
3253         PR gold/12771
3254         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3255         Arm_Address type for relocation result.
3256         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3257         overflow check.
3258         (Arm_relocate_functions::abs32): Use unaligned access.
3259         (Arm_relocate_functions::rel32): Ditto.
3260         (Arm_relocate_functions::prel31): Ditto.
3261         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3262         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3263         static data relocations.
3264         * testsuite/Makefile.in: Regnerate.
3265         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3266
3267 2011-07-05  Ian Lance Taylor  <iant@google.com>
3268
3269         PR gold/12392
3270         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3271         symbols if necessary.
3272         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3273
3274 2011-07-05  Ian Lance Taylor  <iant@google.com>
3275
3276         PR gold/12952
3277         * resolve.cc (Symbol::override_base_with_special): Simply override
3278         version with special symbol version, ignoring previous version.
3279
3280 2011-07-05  Ian Lance Taylor  <iant@google.com>
3281
3282         * object.cc (Sized_relobj_file::include_section_group): Add
3283         information to comment about signature location.
3284
3285 2011-07-02  Ian Lance Taylor  <iant@google.com>
3286
3287         PR gold/12957
3288         * options.h (class General_options): Add -f and -F.
3289         * options.cc (General_options::finalize): Fatal error if -f/-F
3290         are used without -shared.
3291         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3292
3293 2011-07-02  Ian Lance Taylor  <iant@google.com>
3294
3295         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3296
3297 2011-07-01  Ian Lance Taylor  <iant@google.com>
3298
3299         PR gold/12525
3300         PR gold/12952
3301         * resolve.cc (Symbol::override_base_with_special): Don't override
3302         the version if the overriding symbol has a different name.
3303         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3304         all callers.  If we give an error about an undefined version,
3305         define the base version if necessary.
3306         * dynobj.h (class Versions): Update declaration.
3307         * testsuite/weak_alias_test_5.cc: New file.
3308         * testsuite/weak_alias_test.script: New file.
3309         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3310         and versioned_alias have the right value, and call t2.
3311         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3312         weak_alias_test_5.so.
3313         (weak_alias_test_LDADD): Likewise.
3314         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3315         * testsuite/Makefile.in: Rebuild.
3316
3317 2011-07-01  Ian Lance Taylor  <iant@google.com>
3318
3319         PR gold/12525
3320         * options.h (class General_options): Support -z notext.
3321         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3322         -Wl,-z,notext.
3323         (two_file_shared_nonpic.so): Likewise.
3324         (two_file_shared_mixed.so): Likewise.
3325         (two_file_shared_mixed_1.so): Likewise.
3326         (weak_undef_lib_nonpic.so): Likewise.
3327         (alt/weak_undef_lib_nonpic.so): Likewise.
3328         (tls_test_shared_nonpic.so): Likewise.
3329         * testsuite/Makefile.in: Rebuild.
3330
3331 2011-07-01  Ian Lance Taylor  <iant@google.com>
3332
3333         PR gold/12525
3334         * configure.ac: Test whether static linking works, setting
3335         the automake conditional HAVE_STATIC.
3336         * testsuite/Makefile.am: Disable tests using -static if
3337         HAVE_STATIC is not true.
3338         * configure, testsuite/Makefile.in: Rebuild.
3339
3340 2011-07-01  Ian Lance Taylor  <iant@google.com>
3341
3342         PR gold/12525
3343         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3344         Assert if we see DW_EH_PE_indirect.
3345         * target.h (Target::ehframe_datarel_base): New function.
3346         (Target::do_ehframe_datarel_base): New target function.
3347         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3348         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3349         function.
3350
3351 2011-07-01  Ian Lance Taylor  <iant@google.com>
3352
3353         PR gold/12571
3354         * options.h (class General_options): Add
3355         --ld-generated-unwind-info.
3356         * ehframe.cc (Fde::write): Add address parameter.  Change all
3357         callers.  If associated with PLT, fill in address and size.
3358         (Cie::set_output_offset): Only add merge mapping if there is an
3359         object.
3360         (Cie::write): Add address parameter.  Change all callers.
3361         (Eh_frame::add_ehframe_for_plt): New function.
3362         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3363         input_offset_ fields into union u_, with new plt field.
3364         (Fde::Fde): Adjust for new union field.
3365         (Fde::Fde) [Output_data version]: New constructor.
3366         (Fde::add_mapping): Only add merge mapping if there is an object.
3367         (class Cie): Update declarations.
3368         (class Eh_frame): Declare add_ehframe_for_plt.
3369         * layout.cc (Layout::layout_eh_frame): Break out code into
3370         make_eh_frame_section, and call it.
3371         (Layout::make_eh_frame_section): New function.
3372         (Layout::add_eh_frame_for_plt): New function.
3373         * layout.h (class Layout): Update declarations.
3374         * merge.cc (Merge_map::add_mapping): Add assertion.
3375         * i386.cc: Include "dwarf.h".
3376         (class Output_data_plt_i386): Make first_plt_entry,
3377         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3378         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3379         and plt_eh_frame_fde.
3380         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3381         boundary.  Call add_eh_frame_for_plt if appropriate.
3382         * x86_64.cc: Include "dwarf.h".
3383         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3384         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3385         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3386         and plt_eh_frame_fde.
3387         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3388         appropriate.
3389
3390 2011-06-29  Ian Lance Taylor  <iant@google.com>
3391
3392         PR gold/12629
3393         * object.cc (Sized_relobj_file::layout_section): Change shdr
3394         parameter to be const.
3395         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3396         out of do_layout.
3397         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3398         appropriate.  Call layout_eh_frame_section.
3399         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3400         sections.
3401         * object.h (class Sized_relobj_file): Update declarations.
3402
3403 2011-06-29  Ian Lance Taylor  <iant@google.com>
3404
3405         PR gold/12652
3406         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3407         modifier.
3408         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3409
3410 2011-06-29  Ian Lance Taylor  <iant@google.com>
3411
3412         PR gold/12675
3413         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3414         SHT_X86_64_UNWIND.
3415         * layout.cc (Layout::layout_eh_frame): Likewise.
3416
3417 2011-06-29  Ian Lance Taylor  <iant@google.com>
3418
3419         PR gold/12695
3420         * layout.cc (Layout::symtab_section_shndx): New function.
3421         * layout.h (class Layout): Declare symtab_section_shndx.
3422         * output.cc (Output_section::write_header): Call it.
3423
3424 2011-06-29  Ian Lance Taylor  <iant@google.com>
3425
3426         PR gold/12818
3427         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3428         symbols which are not used in a relocation.
3429
3430 2011-06-28  Ian Lance Taylor  <iant@google.com>
3431
3432         PR gold/12898
3433         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3434         script create indistinguishable segments.
3435         (Layout::set_segment_offsets): Use stable_sort when sorting
3436         segments.  Pass this to Compare_segments constructor.
3437         * layout.h (class Layout): Make segment_precedes non-static.
3438         (class Compare_segments): Change from struct to class.  Add
3439         layout_ field.  Add constructor.
3440         * script-sections.cc
3441         (Script_sections::attach_sections_using_phdrs_clause): Rename
3442         local orphan to is_orphan.  Don't report failure to put empty
3443         section in segment.  On attachment failure, report name of
3444         section, and attach to first PT_LOAD segment.
3445
3446 2011-06-28  Ian Lance Taylor  <iant@google.com>
3447
3448         PR gold/12934
3449         * target-select.cc (Target_selector::Target_selector): Add
3450         emulation parameter.  Change all callers.
3451         (select_target_by_bfd_name): Rename from select_target_by_name.
3452         Change all callers.
3453         (select_target_by_emulation): New function.
3454         (supported_emulation_names): New function.
3455         * target-select.h (class Target_selector): Add emulation_ field.
3456         Update declarations.
3457         (Target_selector::recognize_by_bfd_name): Rename from
3458         recognize_by_name.  Change all callers.
3459         (Target_selector::supported_bfd_names): Rename from
3460         supported_names.  Change all callers.
3461         (Target_selector::recognize_by_emulation): New function.
3462         (Target_selector::supported_emulations): New function.
3463         (Target_selector::emulation): New function.
3464         (Target_selector::do_recognize_by_bfd_name): Rename from
3465         do_recognize_by_name.  Change all callers.
3466         (Target_selector::do_supported_bfd_names): Rename from
3467         do_supported_names.  Change all callers.
3468         (Target_selector::do_recognize_by_emulation): New function.
3469         (Target_selector::do_supported_emulations): New function.
3470         (select_target_by_bfd_name): Change name in declaration.
3471         (select_target_by_emulation): Declare.
3472         (supported_emulation_names): Declare.
3473         * parameters.cc (parameters_force_valid_target): Try to find
3474         target based on emulation from -m option.
3475         * options.h (class General_options): Change doc string for -m.
3476         * options.cc (help): Print emulations.
3477         (General_options::parse_V): Likewise.
3478         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3479         Add emulation parameter.  Change all callers.
3480
3481 2011-06-28  Ian Lance Taylor  <iant@google.com>
3482
3483         * target.h (class Target): Add osabi_ field.
3484         (Target::osabi): New function.
3485         (Target::set_osabi): New function.
3486         (Target::Target): Initialize osabi_.
3487         (Target::do_adjust_elf_header): Make pure virtual.
3488         (Sized_target::do_adjust_elf_header): Declare.
3489         * target.cc (Sized_target::do_adjust_elf_header): New function.
3490         (class Sized_target): Instantiate all versions.
3491         * freebsd.h (class Target_freebsd): Remove.
3492         (Target_selector_freebsd::do_recognize): Call set_osabi on
3493         Target.
3494         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3495         (Target_selector_freebsd::set_osabi): Remove.
3496         * i386.cc (class Target_i386): Inherit from Sized_target rather
3497         than Target_freebsd.
3498         * x86_64.cc (class Target_x86_64): Likewise.
3499
3500 2011-06-28  Ian Lance Taylor  <iant@google.com>
3501
3502         * target.h (Target::can_check_for_function_pointers): Rewrite.
3503         Make non-virtual.
3504         (Target::can_icf_inline_merge_sections): Likewise.
3505         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3506         (Target::Target_info): Add can_icf_inline_merge_sections field.
3507         (Target::do_can_check_for_function_pointers): New virtual
3508         function.
3509         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3510         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3511         from can_check_for_function_pointers, move in file.
3512         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3513         section_may_have_icf_unsafe_poineters, move in file.
3514         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3515         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3516         Rename from can_check_for_function_pointers, move in file.
3517         (Target_i386::can_icf_inline_merge_sections): Remove.
3518         (Target_i386::i386_info): Initialize
3519         can_icf_inline_merge_sections.
3520         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3521         Initialize can_icf_inline_merge_sections.
3522         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3523         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3524         Rename from can_check_for_function_pointers, move in file.
3525         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3526         (Target_x86_64::x86_64_info): Initialize
3527         can_icf_inline_merge_sections.
3528         * testsuite/testfile.cc (Target_test::test_target_info):
3529         Likewise.
3530         * icf.cc (get_section_contents): Correct formatting.
3531
3532 2011-06-27  Ian Lance Taylor  <iant@google.com>
3533
3534         * symtab.cc (Symbol::versioned_name): New function.
3535         (Symbol_table::add_to_final_symtab): Use versioned_name when
3536         appropriate.
3537         (Symbol_table::sized_write_symbol): Likewise.
3538         * symtab.h (class Symbol): Declare versioned_name.
3539         * stringpool.h (class Stringpool_template): Add variant of add
3540         which takes a std::basic_string.
3541         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3542         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3543         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3544         (ver_test_12.o): New target.
3545         * testsuite/Makefile.in: Rebuild.
3546
3547 2011-06-27  Doug Kwan  <dougkwan@google.com>
3548
3549         * arm.cc (Arm_relocate_functions::thm_jump8,
3550         Arm_relocate_functions::thm_jump11): Use a wider signed
3551         type to compute offset.
3552         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3553         arm_thm_jump8.
3554         * testsuite/Makefile.in: Regenerate.
3555         * testsuite/arm_branch_in_range.sh: Check test results of
3556         arm_thm_jump11 and arm_thm_jump8.
3557         * testsuite/arm_thm_jump11.s: New test source file.
3558         * testsuite/arm_thm_jump11.t: New linker script.
3559         * testsuite/arm_thm_jump8.s: New test source file.
3560         * testsuite/arm_thm_jump8.t: New linker script.
3561
3562 2011-06-24  Ian Lance Taylor  <iant@google.com>
3563
3564         * layout.cc: Include "object.h".
3565         (ctors_sections_in_init_array): New static variable.
3566         (Layout::is_ctors_in_init_array): New function.
3567         (Layout::layout): Add entry to ctors_sections_in_init_array if
3568         appropriate.
3569         * layout.h (class Layout): Declare is_ctors_in_init_array.
3570         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3571         is_ctors_reverse_view is set.
3572         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3573         all callers.  Set is_ctors_reverse_view field of View_size.
3574         (Sized_relobj_file::reverse_words): New function.
3575         * object.h (Sized_relobj_file::View_size): Add
3576         is_ctors_reverse_view field.
3577         (class Sized_relobj_file): Update declarations.
3578         * testsuite/initpri3.c: New test.
3579         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3580         initpri3b.
3581         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3582         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3583         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3584         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3585         * testsuite/Makefile.in: Rebuild.
3586
3587 2011-06-24  Cary Coutant  <ccoutant@google.com>
3588
3589         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3590         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3591         (debug_msg_cdebug.err): New targets.
3592         * testsuite/Makefile.in: Regenerate.
3593         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3594         Fix checks for link with shared library.
3595
3596 2011-06-24  Doug Kwan  <dougkwan@google.com>
3597
3598         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3599         skip empty text sections.
3600         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3601
3602 2011-06-22  Ian Lance Taylor  <iant@google.com>
3603
3604         PR gold/12910
3605         * options.h (class General_options): Add --ctors-in-init-array.
3606         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3607         friends as SHT_PROGBITS for merging sections.
3608         (Layout::layout): Remove special handling of .init_array and
3609         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3610         and .dtors if ctors_in_init_array.
3611         (Layout::make_output_section): Force correct section types for
3612         .init_array and friends.  Don't sort if doing relocatable link,
3613         Don't sort .ctors and .dtors if ctors_in_init_array.
3614         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3615         (Layout::output_section_name): Add relobj parameter.  Change all
3616         callers.  Handle .ctors. and .dtors. in code rather than table.
3617         Handle .ctors and .dtors if ctors_in_init_array.
3618         (Layout::match_file_name): New function, moved from output.cc.
3619         * layout.h (class Layout): Update declarations.
3620         * output.cc: Include "layout.h".
3621         (Input_section_sort_entry::get_priority): New function.
3622         (Input_section_sort_entry::match_file_name): Just call
3623         Layout::match_file_name.
3624         (Output_section::Input_section_sort_init_fini_compare::operator()):
3625         Handle .ctors and .dtors.  Sort by explicit priority rather than
3626         by name.
3627         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3628         * testsuite/initpri2.c: New test.
3629         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3630         (check_PROGRAMS): Add initpri2.
3631         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3632         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3633         * configure, testsuite/Makefile.in: Rebuild.
3634
3635 2011-06-19  Ian Lance Taylor  <iant@google.com>
3636
3637         PR gold/12880
3638         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3639         .interp section to a PT_INTERP segment even if we have seen a
3640         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3641         clause in a linker script.
3642         (Layout::finalize): Don't create a .interp section if we've
3643         already create a PT_INTERP segment.
3644         (Layout::create_interp): Always call choose_output_section (revert
3645         patch of 2011-06-17).  Don't create PT_INTERP segment.
3646         * script-sections.cc
3647         (Script_sections::create_note_and_tls_segments): Add a .interp
3648         section to a PT_INTERP segment even if we have seen a
3649         --dynamic-linker option.
3650
3651 2011-06-18  Ian Lance Taylor  <iant@google.com>
3652
3653         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3654         merely because a non-PT_LOAD segment has a dynamic reloc.
3655
3656 2011-06-18  Ian Lance Taylor  <iant@google.com>
3657
3658         * layout.cc (Layout::finish_dynamic_section): Don't create
3659         DT_FLAGS entry if not needed.
3660
3661 2011-06-18  Ian Lance Taylor  <iant@google.com>
3662
3663         PR gold/12745
3664         * layout.cc (Layout::layout_eh_frame): Correct handling of
3665         writable .eh_frame section.
3666
3667 2011-06-17  Ian Lance Taylor  <iant@google.com>
3668
3669         PR gold/12893
3670         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3671         symbol is redefined with the exact same object and value.
3672
3673 2011-06-17  Ian Lance Taylor  <iant@google.com>
3674
3675         PR gold/12880
3676         * layout.h (class Layout): Add interp_segment_ field.
3677         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3678         (Layout::attach_allocated_section_to_segment): If making shared
3679         library, put .interp section in PT_INTERP segment.
3680         (Layout::finalize): Also call create_interp if -dynamic-linker
3681         option was used.
3682         (Layout::create_interp): Assert that there is no PT_INTERP
3683         segment.  If not using a SECTIONS clause, use make_output_section.
3684         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3685         * script-sections.cc
3686         (Script_sections::create_note_and_tls_segments): If making shared
3687         library, put .interp section in PT_INTERP segment.
3688
3689 2011-06-17  Ian Lance Taylor  <iant@google.com>
3690
3691         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3692         when making a shared library.
3693
3694 2011-06-17  Ian Lance Taylor  <iant@google.com>
3695
3696         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3697         parameter.  Change all callers.  Don't issue warning about PC32
3698         against locally defined symbol.
3699
3700 2011-06-16  Ian Lance Taylor  <iant@google.com>
3701
3702         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3703         occurs in same object.
3704
3705 2011-06-14  Alan Modra  <amodra@gmail.com>
3706
3707         * po/POTFILES.in: Regenerate.
3708
3709 2011-06-09  Ian Lance Taylor  <iant@google.com>
3710
3711         * script-sections.cc
3712         (Orphan_output_section::set_section_addresses): For a relocatable
3713         link set address to 0.
3714
3715 2011-06-09  Cary Coutant  <ccoutant@google.com>
3716
3717         PR gold/12804
3718         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3719         used with --compress-debug-sections.
3720         * gold/object.cc (Sized_relobj_file::do_layout): Report
3721         uncompressed size of compressed input sections.
3722
3723 2011-06-08  Cary Coutant  <ccoutant@google.com>
3724
3725         PR gold/12804
3726         * testsuite/two_file_test_2_v1.cc: Change initialization of
3727         v2 to keep it in .data.
3728
3729 2011-06-07  Cary Coutant  <ccoutant@google.com>
3730
3731         * common.cc (Symbol_table::do_allocate_commons_list): Call
3732         gold_fallback.
3733         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3734         (Errors::fallback): New function.
3735         (gold_fallback): New function.
3736         * errors.h (Errors::fallback): New function.
3737         * gold.cc (gold_exit): Change status parameter to enum; adjust
3738         all callers.
3739         (queue_initial_tasks): Call gold_fallback.
3740         * gold.h: Include cstdlib.
3741         (Exit_status): New enum type.
3742         (gold_exit): Change status parameter to enum.
3743         (gold_fallback): New function.
3744         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3745         (Layout::create_symtab_sections): Likewise.
3746         (Layout::create_shdrs): Likewise.
3747         * main.cc (main): Adjust call to gold_exit.
3748         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3749         (Output_data_got::add_got_entry_pair): Likewise.
3750         (Output_section::add_input_section): Likewise.
3751         (Output_section::add_output_section_data): Likewise.
3752         (Output_segment::set_section_list_addresses): Likewise.
3753         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3754
3755 2011-06-07  Cary Coutant  <ccoutant@google.com>
3756
3757         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3758         for incremental links.
3759         * output.cc (Output_segment::set_section_list_addresses): Remove
3760         FIXME and test for TLS or BSS.
3761
3762 2011-06-07  Cary Coutant  <ccoutant@google.com>
3763
3764         * testsuite/Makefile.am: Add incremental_copy_test,
3765         incremental_common_test_1.
3766         * testsuite/Makefile.in: Regenerate.
3767         * testsuite/common_test_1_v1.c: New source file.
3768         * testsuite/common_test_1_v2.c: New source file.
3769         * testsuite/copy_test_v1.cc: New source file.
3770
3771 2011-06-07  Cary Coutant  <ccoutant@google.com>
3772
3773         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3774         update, allocate common from bss section's free list.
3775         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3776         linker-defined symbols.
3777         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3778         Skip GOT and PLT entries that are no longer referenced.
3779         (Output_section_incremental_inputs::write_info_blocks): Mark
3780         linker-defined symbols.
3781         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3782         * output.cc (Output_section::allocate): New function.
3783         * output.h (Output_section::allocate): New function.
3784         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3785         linker-defined symbols.
3786         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3787         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3788         (Symbol::init_base_output_data): Likewise.
3789         (Symbol::init_base_output_segment): Likewise.
3790         (Symbol::init_base_constant): Likewise.
3791         (Sized_symbol::init_output_data): Likewise.
3792         (Sized_symbol::init_output_segment): Likewise.
3793         (Sized_symbol::init_constant): Likewise.
3794         (Symbol_table::do_define_in_output_data): Likewise.
3795         (Symbol_table::do_define_in_output_segment): Likewise.
3796         (Symbol_table::do_define_as_constant): Likewise.
3797         * symtab.h (Symbol::is_predefined): New function.
3798         (Symbol::init_base_output_data): Add is_predefined parameter.
3799         (Symbol::init_base_output_segment): Likewise.
3800         (Symbol::init_base_constant): Likewise.
3801         (Symbol::is_predefined_): New data member.
3802         (Sized_symbol::init_output_data): Add is_predefined parameter.
3803         (Sized_symbol::init_output_segment): Likewise.
3804         (Sized_symbol::init_constant): Likewise.
3805         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3806
3807 2011-06-07  Cary Coutant  <ccoutant@google.com>
3808
3809         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3810         instead of emit_copy_reloc.
3811         (Copy_relocs::emit_copy_reloc): Refactor.
3812         (Copy_relocs::make_copy_reloc): New function.
3813         (Copy_relocs::add_copy_reloc): Remove.
3814         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3815         section.
3816         (Copy_relocs::make_copy_reloc): New function.
3817         (Copy_relocs::add_copy_reloc): Remove.
3818         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3819         unchanged input files.
3820         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3821         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3822         Reserve BSS space for COPY relocations.
3823         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3824         (Output_section_incremental_inputs::write_info_blocks): Record
3825         whether a symbol is copied from a shared object.
3826         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3827         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3828         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3829         (Incremental_input_entry_reader::get_output_symbol_index): Add
3830         is_copy parameter.
3831         (Incremental_binary::emit_copy_relocs): New function.
3832         (Incremental_binary::do_emit_copy_relocs): New function.
3833         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3834         new data member.
3835         (Sized_incremental_binary::add_copy_reloc): New function.
3836         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3837         (Sized_incremental_binary::Copy_reloc): New struct.
3838         (Sized_incremental_binary::Copy_relocs): New typedef.
3839         (Sized_incremental_binary::copy_relocs_): New data member.
3840         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3841         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3842         * target.h (Sized_target::emit_copy_reloc): New function.
3843         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3844
3845 2011-06-02  Cary Coutant  <ccoutant@google.com>
3846
3847         PR gold/12163
3848         * gold/archive.cc (Archive::Archive): Initialize new data member.
3849         (Archive::include_all_members): Return if archive has already been
3850         included.
3851         * gold/archive.h (Archive::include_all_members_): New data member.
3852
3853 2011-06-02  Nick Clifton  <nickc@redhat.com>
3854
3855         * dynobj.h: Fix spelling mistake in comment.
3856         * output.cc: Likewise.
3857
3858 2011-05-31  Doug Kwan  <dougkwan@google.com>
3859             Asier Llano
3860
3861         PR gold/12826
3862         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3863         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3864         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3865         redundant arm_exidx_test.so.
3866         * testsuite/Makefile.in: Regenerate.
3867         (check_SCRIPTS): Add pr12826.sh
3868         (check_DATA): Add pr12826.stdout
3869         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3870         * testsuite/pr12826.sh: New file.
3871         * testsuite/pr12826_1.s: Ditto.
3872         * testsuite/pr12826_1.s: Ditto.
3873
3874 2011-05-30  Ian Lance Taylor  <iant@google.com>
3875
3876         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3877         sections.
3878
3879 2011-05-29  Ian Lance Taylor  <iant@google.com>
3880
3881         PR gold/12804
3882         * testsuite/Makefile.am: Use different file name for two_file_test
3883         temporary file for each incremental test.
3884         * testsuite/Makefile.in: Rebuild.
3885
3886 2011-05-29  Ian Lance Taylor  <iant@google.com>
3887
3888         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3889         binary input file is empty.
3890
3891 2011-05-27  Ian Lance Taylor  <iant@google.com>
3892
3893         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3894         (ver_test_9.so): Likewise.
3895         * testsuite/Makefile.in: Rebuild.
3896
3897 2011-05-26 Cary Coutant  <ccoutant@google.com>
3898
3899         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3900         * incremental.cc (Incremental_inputs::report_input_section): Fix
3901         comment, indentation.
3902         (Incremental_inputs::report_comdat_group): New function.
3903         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3904         of data for incremental input file entry.
3905         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3906         group count, COMDAT group signatures.
3907         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3908         an unchanged input file.
3909         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3910         Initialize new data member.
3911         (Incremental_object_entry::add_comdat_group): New function.
3912         (Incremental_object_entry::get_comdat_group_count): New function.
3913         (Incremental_object_entry::get_comdat_signature_key): New function.
3914         (Incremental_object_entry::groups_): New data member.
3915         (Incremental_inputs::report_comdat_group): New function.
3916         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3917         data for incremental input file entry.
3918         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3919         (Incremental_input_entry_reader::get_input_section): Adjust size of
3920         data for incremental input file entry.
3921         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3922         (Incremental_input_entry_reader::get_comdat_group_signature): New
3923         function.
3924         * object.cc (Sized_relobj::include_section_group): Report kept
3925         COMDAT groups for incremental links.
3926
3927 2011-05-24  David Meyer  <pdox@google.com>
3928
3929         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3930         with name parameter.  Add found_name parameter.
3931         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3932         * dirsearch.h (class Dirsearch): Update declaration.
3933
3934 2011-05-24  Ian Lance Taylor  <iant@google.com>
3935
3936         * archive.cc (Library_base::should_include_member): Pull in object
3937         from archive if it defines the entry symbol.
3938         * parameters.cc (Parameters::entry): New function.
3939         * parameters.h (class Parameters): Declare entry.
3940         * output.h (class Output_file_header): Remove entry_ field.
3941         * output.cc (Output_file_header::Output_file_header): Remove entry
3942         parameter.  Change all callers.
3943         (Output_file_header::entry): Use parameters->entry.
3944         * gold.cc (queue_middle_tasks): Likewise.
3945         * plugin.cc (Plugin_hook::run): Likewise.
3946
3947 2011-05-24 Cary Coutant  <ccoutant@google.com>
3948
3949         * gold.cc (queue_initial_tasks): Pass incremental base filename
3950         to Output_file::open_base_file; don't print error message.
3951         * incremental-dump.cc (main): Adjust call to
3952         Output_file::open_for_modification.
3953         * incremental-dump.cc (main): Likewise.
3954         * incremental.cc (Incremental_inputs::report_command_line):
3955         Ignore --incremental-base option when comparing command lines.
3956         Ignore parameter when given as separate argument.
3957         * options.h (class General_options): Add --incremental-base.
3958         * output.cc (Output_file::Output_file):
3959         (Output_file::open_base_file): Add base_name and writable parameters;
3960         read base file into new file; print error message here.
3961         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3962         callers.
3963         * output.h (Output_file::open_for_modification): Rename to...
3964         (Output_file::open_base_file): ...this; add base_name and
3965         writable parameters; adjust all callers.
3966         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3967         callers.
3968         * testsuite/Makefile.am (incremental_test_4): Test
3969         --incremental-base.
3970         * testsuite/Makefile.in: Regenerate.
3971
3972 2011-05-24 Cary Coutant  <ccoutant@google.com>
3973
3974         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3975         incremental_test_4.
3976         * testsuite/Makefile.in: Regenerate.
3977         * testsuite/two_file_test_1_v1.cc: New test source file.
3978         * testsuite/two_file_test_1b_v1.cc: New test source file.
3979         * testsuite/two_file_test_2_v1.cc: New test source file.
3980
3981 2011-05-24 Cary Coutant  <ccoutant@google.com>
3982
3983         * dynobj.h (Dynobj::do_dynobj): New function.
3984         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3985         flag and soname for shared objects.
3986         * incremental.cc (Incremental_inputs::report_object): Make
3987         either Incremental_object_entry or Incremental_dynobj_entry; add
3988         soname to string table.
3989         (Incremental_inputs::report_input_section): Add assertion.
3990         (Output_section_incremental_inputs::set_final_data_size): Adjust
3991         type of input file entry for shared libraries; adjust size of
3992         shared library info entry.
3993         (Output_section_incremental_inputs::write_input_files): Write
3994         as_needed flag for shared libraries.
3995         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3996         of input file entry for shared libraries; write soname.
3997         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3998         soname from incremental info.
3999         * incremental.h (enum Incremental_input_flags): Add
4000         INCREMENTAL_INPUT_AS_NEEDED.
4001         (Incremental_input_entry::Incremental_input_entry): Initialize new
4002         data member.
4003         (Incremental_input_entry::set_as_needed): New function.
4004         (Incremental_input_entry::as_needed): New function.
4005         (Incremental_input_entry::do_dynobj_entry): New function.
4006         (Incremental_input_entry::as_needed_): New data member.
4007         (Incremental_object_entry::Incremental_object_entry): Don't check
4008         for shared library.
4009         (Incremental_object_entry::do_type): Likewise.
4010         (class Incremental_dynobj_entry): New class.
4011         (Incremental_input_entry_reader::as_needed): New function.
4012         (Incremental_input_entry_reader::get_soname): New function.
4013         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4014         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4015         size of shared library info entry.
4016         * layout.cc (Layout::finish_dynamic_section): Don't test for
4017         incremental link when adding DT_NEEDED entries.
4018         * object.h (Object::Object): Initialize new data member.
4019         (Object::dynobj): New function.
4020         (Object::set_as_needed): New function.
4021         (Object::as_needed): New function.
4022         (Object::do_dynobj): New function.
4023         (Object::as_needed_): New data member.
4024
4025 2011-05-24 Cary Coutant  <ccoutant@google.com>
4026
4027         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4028         info; adjust display of GOT entries.
4029         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4030         vector of input objects; remove file_status_.
4031         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4032         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4033         got_plt reader; call target hooks to reserve GOT entries.
4034         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4035         of input file info header and GOT info entry.
4036         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4037         relocation info.
4038         (Got_plt_view_info::got_descriptor): Remove.
4039         (Got_plt_view_info::sym_index): New data member.
4040         (Got_plt_view_info::input_index): New data member.
4041         (Local_got_offset_visitor::visit): Write input file index.
4042         (Global_got_offset_visitor::visit): Write 0 for input file index.
4043         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4044         with sym_index and input_index.
4045         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4046         incremental info GOT entry; replace got_descriptor with input_index.
4047         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4048         map from input file index to object.
4049         (Sized_relobj_incr::do_layout): Replace direct data member reference
4050         with accessor function.
4051         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4052         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4053         Adjust size of input file info header.
4054         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4055         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4056         (Incremental_input_entry_reader::get_input_section): Adjust size of
4057         input file info header.
4058         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4059         of incremental info GOT entry.
4060         (Incremental_got_plt_reader::get_got_desc): Remove.
4061         (Incremental_got_plt_reader::get_got_symndx): New function.
4062         (Incremental_got_plt_reader::get_got_input_index): New function.
4063         (Sized_incremental_binary::Sized_incremental_binary): Remove
4064         file_status_; add input_objects_.
4065         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4066         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4067         (Sized_incremental_binary::file_is_unchanged): Remove.
4068         (Sized_incremental_binary::set_input_object): New function.
4069         (Sized_incremental_binary::input_object): New function.
4070         (Sized_incremental_binary::file_status_): Remove.
4071         (Sized_incremental_binary::input_objects_): New data member.
4072         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4073         references.
4074         (Sized_relobj_incr::invalid_address): Move to base class.
4075         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4076         class.
4077         (Sized_relobj_incr::do_output_section_offset): Likewise.
4078         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4079         (Sized_relobj_incr::section_offsets_): Likewise.
4080         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4081         function.
4082         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4083         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4084         with accessor function.
4085         (Sized_relobj_file::do_layout): Likewise.
4086         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4087         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4088         (Sized_relobj_file::compute_final_local_value): Replace refs to
4089         section_offsets_ with accessor function.
4090         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4091         * object.h (Relobj::Relobj): Initialize new data members.
4092         (Relobj::add_dyn_reloc): New function.
4093         (Relobj::first_dyn_reloc): New function.
4094         (Relobj::dyn_reloc_count): New function.
4095         (Relobj::first_dyn_reloc_): New data member.
4096         (Relobj::dyn_reloc_count_): New data member.
4097         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4098         references.
4099         (Sized_relobj::Address): New typedef.
4100         (Sized_relobj::invalid_address): Move here from child class.
4101         (Sized_relobj::Sized_relobj): Initialize new data members.
4102         (Sized_relobj::sized_relobj): New function.
4103         (Sized_relobj::is_output_section_offset_invalid): Move here from
4104         child class.
4105         (Sized_relobj::get_output_section_offset): Likewise.
4106         (Sized_relobj::local_has_got_offset): Likewise.
4107         (Sized_relobj::local_got_offset): Likewise.
4108         (Sized_relobj::set_local_got_offset): Likewise.
4109         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4110         (Sized_relobj::clear_got_offsets): New function.
4111         (Sized_relobj::section_offsets): Move here from child class.
4112         (Sized_relobj::do_output_section_offset): Likewise.
4113         (Sized_relobj::do_set_section_offset): Likewise.
4114         (Sized_relobj::Local_got_offsets): Likewise.
4115         (Sized_relobj::local_got_offsets_): Likewise.
4116         (Sized_relobj::section_offsets_): Likewise.
4117         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4118         references.
4119         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4120         class.
4121         (Sized_relobj_file::sized_relobj): New function
4122         (Sized_relobj_file::local_has_got_offset): Move to base class.
4123         (Sized_relobj_file::local_got_offset): Likewise.
4124         (Sized_relobj_file::set_local_got_offset): Likewise.
4125         (Sized_relobj_file::get_output_section_offset): Likewise.
4126         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4127         (Sized_relobj_file::do_output_section_offset): Likewise.
4128         (Sized_relobj_file::do_set_section_offset): Likewise.
4129         (Sized_relobj_file::Local_got_offsets): Likewise.
4130         (Sized_relobj_file::local_got_offsets_): Likewise.
4131         (Sized_relobj_file::section_offsets_): Likewise.
4132         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4133         (all constructors).
4134         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4135         (Output_reloc::get_symbol_index): Likewise.
4136         (Output_reloc::local_section_offset): Likewise.
4137         (Output_reloc::get_address): Likewise.
4138         (Output_reloc::symbol_value): Likewise.
4139         (Output_data_got::reserve_slot): Move to class definition.
4140         (Output_data_got::reserve_local): New function.
4141         (Output_data_got::reserve_slot_for_global): Remove.
4142         (Output_data_got::reserve_global): New function.
4143         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4144         (all constructors, two instantiations).
4145         (Output_reloc::get_relobj): New function (two instantiations).
4146         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4147         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4148         (Output_data_reloc::add_global): Adjust type of relobj.
4149         (Output_data_reloc::add_global_relative): Likewise.
4150         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4151         (Output_data_reloc::add_local): Likewise.
4152         (Output_data_reloc::add_local_relative): Likewise.
4153         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4154         (Output_data_reloc::add_local_section): Likewise.
4155         (Output_data_reloc::add_output_section): Likewise.
4156         (Output_data_reloc::add_absolute): Likewise.
4157         (Output_data_reloc::add_target_specific): Likewise.
4158         (Output_data_got::reserve_slot): Move definition here.
4159         (Output_data_got::reserve_local): New function.
4160         (Output_data_got::reserve_global): New function.
4161         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4162         section_offsets_ with accessor function.
4163         (Sized_relobj_file::write_sections): Likewise.
4164         (Sized_relobj_file::do_relocate_sections): Likewise.
4165         * target.h (Sized_target::reserve_local_got_entry): New function.
4166         (Sized_target::reserve_global_got_entry): New function.
4167         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4168         (Target_x86_64::reserve_global_got_entry): New function.
4169         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4170
4171 2011-05-23 Cary Coutant  <ccoutant@google.com>
4172
4173         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4174         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4175         bit when checking got_type.
4176         * incremental.cc (Sized_incremental_binary::setup_readers):
4177         Store symbol table and string table locations; initialize bit vector
4178         of file status flags.
4179         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4180         unchanged files.
4181         (Sized_incremental_binary::do_process_got_plt): New function.
4182         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4183         (Output_section_incremental_inputs::set_final_data_size): Record
4184         file index for each input file.
4185         (Output_section_incremental_inputs::write_got_plt): Store file index
4186         instead of input entry offset for each GOT entry.
4187         * incremental.h
4188         (Incremental_input_entry::Incremental_input_entry): Initialize new
4189         data member.
4190         (Incremental_input_entry::set_offset): Store file index.
4191         (Incremental_input_entry::get_file_index): New function.
4192         (Incremental_input_entry::file_index_): New data member.
4193         (Incremental_binary::process_got_plt): New function.
4194         (Incremental_binary::do_process_got_plt): New function.
4195         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4196         data members.
4197         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4198         (Sized_incremental_binary::set_file_is_unchanged): New function.
4199         (Sized_incremental_binary::file_is_unchanged): New function.
4200         (Sized_incremental_binary::do_process_got_plt): New function.
4201         (Sized_incremental_binary::file_status_): New data member.
4202         (Sized_incremental_binary::main_symtab_loc_): New data member.
4203         (Sized_incremental_binary::main_strtab_loc_): New data member.
4204         * output.cc (Output_data_got::Got_entry::write): Add case
4205         RESERVED_CODE.
4206         (Output_data_got::add_global): Call add_got_entry.
4207         (Output_data_got::add_global_plt): Likewise.
4208         (Output_data_got::add_global_with_rel): Likewise.
4209         (Output_data_got::add_global_with_rela): Likewise.
4210         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4211         (Output_data_got::add_global_pair_with_rela): Likewise.
4212         (Output_data_got::add_local): Call add_got_entry.
4213         (Output_data_got::add_local_plt): Likewise.
4214         (Output_data_got::add_local_with_rel): Likewise.
4215         (Output_data_got::add_local_with_rela): Likewise.
4216         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4217         (Output_data_got::add_local_pair_with_rela): Likewise.
4218         (Output_data_got::reserve_slot): New function.
4219         (Output_data_got::reserve_slot_for_global): New function.
4220         (Output_data_got::add_got_entry): New function.
4221         (Output_data_got::add_got_entry_pair): New function.
4222         (Output_section::add_output_section_data): Edit FIXME.
4223         * output.h
4224         (Output_section_data_build::Output_section_data_build): New
4225         constructor with size parameter.
4226         (Output_data_space::Output_data_space): Likewise.
4227         (Output_data_got::Output_data_got): Initialize new data member; new
4228         constructor with size parameter.
4229         (Output_data_got::add_constant): Call add_got_entry.
4230         (Output_data_got::reserve_slot): New function.
4231         (Output_data_got::reserve_slot_for_global): New function.
4232         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4233         (Output_data_got::add_got_entry): New function.
4234         (Output_data_got::add_got_entry_pair): New function.
4235         (Output_data_got::free_list_): New data member.
4236         * target.h (Sized_target::init_got_plt_for_update): New function.
4237         (Sized_target::register_global_plt_entry): New function.
4238         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4239         Initialize new data member; call init; add constructor with PLT count.
4240         (Output_data_plt_x86_64::init): New function.
4241         (Output_data_plt_x86_64::add_relocation): New function.
4242         (Output_data_plt_x86_64::reserve_slot): New function.
4243         (Output_data_plt_x86_64::free_list_): New data member.
4244         (Target_x86_64::init_got_plt_for_update): New function.
4245         (Target_x86_64::register_global_plt_entry): New function.
4246         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4247         incremental updates.
4248         (Output_data_plt_x86_64::add_relocation): New function.
4249         * testsuite/object_unittest.cc (Object_test): Set default options.
4250
4251 2011-05-16  Ian Lance Taylor  <iant@google.com>
4252
4253         * options.h (class General_options): Make -i a synonym for -r.
4254
4255 2011-05-16  Ian Lance Taylor  <iant@google.com>
4256
4257         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4258
4259 2011-05-10 Cary Coutant  <ccoutant@google.com>
4260
4261         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4262         strip_all (-s).
4263
4264 2011-05-06  Ian Lance Taylor  <iant@google.com>
4265
4266         * layout.cc (Layout::layout): If the output section flags change,
4267         update the ordering.
4268
4269 2011-04-25 Cary Coutant  <ccoutant@google.com>
4270
4271         * incremental-dump.cc (dump_incremental_inputs): Print local
4272         symbol info for each input file.
4273         * incremental.cc
4274         (Output_section_incremental_inputs::set_final_data_size): Add local
4275         symbol info to input file entries in incremental info.
4276         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4277         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4278         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4279         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4280         implementation.
4281         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4282         (Sized_incr_relobj::do_relocate): Write the local symbols.
4283         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4284         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4285         Adjust size of input file header.
4286         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4287         (Incremental_inputs_reader::get_local_symbol_count): New function.
4288         (Incremental_inputs_reader::get_input_section): Adjust size of input
4289         file header.
4290         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4291         (Sized_incr_relobj::This): New typedef.
4292         (Sized_incr_relobj::sym_size): New const data member.
4293         (Sized_incr_relobj::Local_symbol): New struct.
4294         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4295         (Sized_incr_relobj::do_local_symbol_offset): New function.
4296         (Sized_incr_relobj::local_symbol_count_): New data member.
4297         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4298         (Sized_incr_relobj::local_symbol_index_): New data member.
4299         (Sized_incr_relobj::local_symbol_offset_): New data member.
4300         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4301         (Sized_incr_relobj::local_symbols_): New data member.
4302         * object.h (Relobj::output_local_symbol_count): New function.
4303         (Relobj::local_symbol_offset): New function.
4304         (Relobj::do_output_local_symbol_count): New function.
4305         (Relobj::do_local_symbol_offset): New function.
4306         (Sized_relobj::do_output_local_symbol_count): New function.
4307         (Sized_relobj::do_local_symbol_offset): New function.
4308
4309 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4310
4311         * descriptors.cc (set_close_on_exec): New function.
4312         (Descriptors::open): Use set_close_on_exec.
4313         * output.cc (S_ISLNK): Define if not defined.
4314
4315 2011-04-22 Cary Coutant  <ccoutant@google.com>
4316
4317         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4318         global symbol map.
4319         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4320         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4321         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4322         relocations.
4323         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4324         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4325         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4326         * incremental.h
4327         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4328         function.
4329         (Incremental_binary::apply_incremental_relocs): New function.
4330         (Incremental_binary::do_apply_incremental_relocs): New function.
4331         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4332         data member.
4333         (Sized_incremental_binary::add_global_symbol): New function.
4334         (Sized_incremental_binary::global_symbol): New function.
4335         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4336         (Sized_incremental_binary::symbol_map_): New data member.
4337         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4338         * target.h (Sized_target::apply_relocation): New function.
4339         * target-reloc.h (apply_relocation): New function.
4340         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4341
4342 2011-04-22  Doug Kwan  <dougkwan@google.com>
4343
4344         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4345         flag of a SHT_ARM_EXIDX section.
4346         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4347         * testsuite/Makefile.in: Regenerate.
4348         * testsuite/arm_exidx_test.s: New file.
4349         * testsuite/arm_exidx_test.sh: Same.
4350
4351 2011-04-20 Cary Coutant  <ccoutant@google.com>
4352
4353         PR gold/12689
4354         * archive.h (Incremental_archive_entry::Archive_member):
4355         Initialize arg_serial_ (second constructor).
4356
4357 2011-04-17  Ian Lance Taylor  <iant@google.com>
4358
4359         * object.cc (Relocate_info::location): Simplify location string.
4360         * errors.cc (Errors::error_at_location): Don't print program
4361         name.
4362         (Errors::warning_at_location): Likewise.
4363         (Errors::undefined_symbol): Likewise.
4364         * testsuite/debug_msg.sh: Update accordingly.
4365
4366 2011-04-14 Cary Coutant  <ccoutant@google.com>
4367
4368         * gold/layout.cc (Layout::symtab_section_offset): New function.
4369         * gold/layout.h (Layout::symtab_section_offset): New function.
4370         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4371
4372 2011-04-12  Ian Lance Taylor  <iant@google.com>
4373
4374         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4375         with MREMAP_MAYMOVE.
4376         * output.h (class Output_file): Add map_is_allocated_ field.
4377         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4378         not available, provide stubs.  If mremap is not available, #define
4379         it to gold_mremap.
4380         (MREMAP_MAYMOVE): Define if not defined.
4381         (Output_file::Output_file): Initialize map_is_allocated_.
4382         (Output_file::resize): Check map_is_allocated_.
4383         (Output_file::map_anonymous): If mmap fails, use malloc.
4384         (Output_file::unmap): Don't do anything for an anonymous map.
4385         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4386         is not available, provide stubs.
4387         (File_read::View::~View): Use free rather than delete[].
4388         (File_read::make_view): Use malloc rather than new[].  If mmap
4389         fails, use malloc.
4390         (File_read::find_or_make_view): Use malloc rather than new[].
4391         * gold.h: Remove HAVE_REMAP code.
4392         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4393         exists.  Rename mremap to gold_mremap.  If mmap is not available
4394         don't do anything.
4395         * configure, config.in: Rebuild.
4396
4397 2011-04-11  Ian Lance Taylor  <iant@google.com>
4398
4399         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4400         initialize local variable v.
4401
4402 2011-04-11  Cary Coutant  <ccoutant@google.com>
4403
4404         * archive.cc (Archive::include_member): Adjust call to
4405         report_object.
4406         (Add_archive_symbols::run): Track argument serial numbers.
4407         (Lib_group::include_member): Likewise.
4408         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4409         * archive.h (Incremental_archive_entry::Archive_member):
4410         Initialize arg_serial_.
4411         (Archive_member::arg_serial_): New data member.
4412         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4413         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4414         incremental link.
4415         (Sized_dynobj::do_for_all_local_got_entries): New function.
4416         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4417         function.
4418         * fileread.cc (get_mtime): New function.
4419         * fileread.h (get_mtime): New function.
4420         * gold.cc (queue_initial_tasks): Check for incremental update.
4421         (process_incremental_input): New function.
4422         (queue_middle_tasks): Don't force valid target for incremental
4423         update.
4424         * incremental-dump.cc (find_input_containing_global): Adjust
4425         size of symbol info entry.
4426         (dump_incremental_inputs): Dump argument serial number and
4427         in_system_directory flag; bias shndx by 1; print symbol names
4428         when dumping per-file symbol lists; use new symbol info readers.
4429         * incremental.cc
4430         (Output_section_incremental_inputs:update_data_size): New function.
4431         (Sized_incremental_binary::setup_readers): Setup input readers
4432         for each input file; build maps for files added from libraries
4433         and scripts.
4434         (Sized_incremental_binary::check_input_args): New function.
4435         (Sized_incremental_binary::do_check_inputs): Build map of argument
4436         serial numbers to input arguments.
4437         (Sized_incremental_binary::do_file_has_changed): Rename
4438         do_file_is_unchanged to this; compare file modification times.
4439         (Sized_incremental_binary::do_init_layout): New function.
4440         (Sized_incremental_binary::do_reserve_layout): New function.
4441         (Sized_incremental_binary::do_get_input_reader): Remove.
4442         (Sized_incremental_binary::get_symtab_view): New function.
4443         (Incremental_checker::can_incrementally_link_output_file): Remove.
4444         (Incremental_inputs::report_command_line): Exclude --debug options.
4445         (Incremental_inputs::report_archive_begin): Add parameter; track
4446         argument serial numbers; don't put input file entry for archive
4447         before archive members.
4448         (Incremental_inputs::report_archive_end): Put input file entry
4449         for archive after archive members.
4450         (Incremental_inputs::report_object): Add parameter; track argument
4451         serial numbers and in_system_directory flag.
4452         (Incremental_inputs::report_script): Add parameter; track argument
4453         serial numbers.
4454         (Output_section_incremental_inputs::set_final_data_size): Adjust
4455         size of symbol info entry; check for forwarding symbols.
4456         (Output_section_incremental_inputs::write_input_files): Write
4457         in_system_directory flag and argument serial number.
4458         (Output_section_incremental_inputs::write_info_blocks): Map section
4459         indices between incremental info and original input file; store
4460         input section index for each symbol.
4461         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4462         change operator() to visit().
4463         (class Global_got_offset_visitor): Likewise.
4464         (class Global_symbol_visitor_got_plt):
4465         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4466         classes.
4467         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4468         (Sized_incr_relobj::do_read_symbols): New function.
4469         (Sized_incr_relobj::do_layout): New function.
4470         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4471         (Sized_incr_relobj::do_add_symbols): New function.
4472         (Sized_incr_relobj::do_should_include_member): New function.
4473         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4474         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4475         (Sized_incr_relobj::do_section_size): New function.
4476         (Sized_incr_relobj::do_section_name): New function.
4477         (Sized_incr_relobj::do_section_contents): New function.
4478         (Sized_incr_relobj::do_section_flags): New function.
4479         (Sized_incr_relobj::do_section_entsize): New function.
4480         (Sized_incr_relobj::do_section_address): New function.
4481         (Sized_incr_relobj::do_section_type): New function.
4482         (Sized_incr_relobj::do_section_link): New function.
4483         (Sized_incr_relobj::do_section_info): New function.
4484         (Sized_incr_relobj::do_section_addralign): New function.
4485         (Sized_incr_relobj::do_initialize_xindex): New function.
4486         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4487         (Sized_incr_relobj::do_read_relocs): New function.
4488         (Sized_incr_relobj::do_gc_process_relocs): New function.
4489         (Sized_incr_relobj::do_scan_relocs): New function.
4490         (Sized_incr_relobj::do_count_local_symbols): New function.
4491         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4492         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4493         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4494         (Sized_incr_relobj::do_relocate): New function.
4495         (Sized_incr_relobj::do_set_section_offset): New function.
4496         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4497         (Sized_incr_dynobj::do_read_symbols): New function.
4498         (Sized_incr_dynobj::do_layout): New function.
4499         (Sized_incr_dynobj::do_add_symbols): New function.
4500         (Sized_incr_dynobj::do_should_include_member): New function.
4501         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4502         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4503         (Sized_incr_dynobj::do_section_size): New function.
4504         (Sized_incr_dynobj::do_section_name): New function.
4505         (Sized_incr_dynobj::do_section_contents): New function.
4506         (Sized_incr_dynobj::do_section_flags): New function.
4507         (Sized_incr_dynobj::do_section_entsize): New function.
4508         (Sized_incr_dynobj::do_section_address): New function.
4509         (Sized_incr_dynobj::do_section_type): New function.
4510         (Sized_incr_dynobj::do_section_link): New function.
4511         (Sized_incr_dynobj::do_section_info): New function.
4512         (Sized_incr_dynobj::do_section_addralign): New function.
4513         (Sized_incr_dynobj::do_initialize_xindex): New function.
4514         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4515         (make_sized_incremental_object): New function.
4516         (Incremental_library::copy_unused_symbols): New function.
4517         (Incremental_library::do_for_all_unused_symbols): New function.
4518         * incremental.h (enum Incremental_input_flags): New type.
4519         (class Incremental_checker): Remove.
4520         (Incremental_input_entry::Incremental_input_entry): Add argument
4521         serial number.
4522         (Incremental_input_entry::arg_serial): New function.
4523         (Incremental_input_entry::set_is_in_system_directory): New function.
4524         (Incremental_input_entry::is_in_system_directory): New function.
4525         (Incremental_input_entry::arg_serial_): New data member.
4526         (Incremental_input_entry::is_in_system_directory_): New data member.
4527         (class Script_info): Move here from script.h.
4528         (Script_info::Script_info): Add filename parameter.
4529         (Script_info::filename): New function.
4530         (Script_info::filename_): New data member.
4531         (Incremental_script_entry::Incremental_script_entry): Add argument
4532         serial number.
4533         (Incremental_object_entry::Incremental_object_entry): Likewise.
4534         (Incremental_object_entry::add_input_section): Build list of input
4535         sections with map to original shndx.
4536         (Incremental_object_entry::get_input_section_index): New function.
4537         (Incremental_object_entry::shndx_): New data member.
4538         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4539         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4540         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4541         serial number.
4542         (Incremental_inputs::report_archive_begin): Likewise.
4543         (Incremental_inputs::report_object): Likewise.
4544         (Incremental_inputs::report_script): Likewise.
4545         (class Incremental_global_symbol_reader): New class.
4546         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4547         and store flags and input file type.
4548         (Incremental_input_entry_reader::arg_serial): New function.
4549         (Incremental_input_entry_reader::type): Extract type from flags.
4550         (Incremental_input_entry_reader::is_in_system_directory): New function.
4551         (Incremental_input_entry_reader::get_input_section_count): Call
4552         accessor function for type.
4553         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4554         function for type; adjust size of global symbol entry.
4555         (Incremental_input_entry_reader::get_global_symbol_count): Call
4556         accessor function for type.
4557         (Incremental_input_entry_reader::get_object_count): Likewise.
4558         (Incremental_input_entry_reader::get_object_offset): Likewise.
4559         (Incremental_input_entry_reader::get_member_count): Likewise.
4560         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4561         (Incremental_input_entry_reader::get_member_offset): Likewise.
4562         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4563         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4564         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4565         (Incremental_input_entry_reader::get_global_symbol_reader): New
4566         function.
4567         (Incremental_input_entry_reader::get_output_symbol_index): New
4568         function.
4569         (Incremental_input_entry_reader::type_): Remove.
4570         (Incremental_input_entry_reader::flags_): New data member.
4571         (Incremental_inputs_reader::input_file_offset): New function.
4572         (Incremental_inputs_reader::input_file_index): New function.
4573         (Incremental_inputs_reader::input_file): Call input_file_offset.
4574         (Incremental_inputs_reader::input_file_at_offset): New function.
4575         (Incremental_relocs_reader::get_r_type): Reformat.
4576         (Incremental_relocs_reader::get_r_shndx): Reformat.
4577         (Incremental_relocs_reader::get_r_offset): Reformat.
4578         (Incremental_relocs_reader::data): New function.
4579         (Incremental_binary::Incremental_binary): Initialize new data members.
4580         (Incremental_binary::check_inputs): Add cmdline parameter.
4581         (Incremental_binary::file_is_unchanged): Remove.
4582         (Input_reader::arg_serial): New function.
4583         (Input_reader::get_unused_symbol_count): New function.
4584         (Input_reader::get_unused_symbol): New function.
4585         (Input_reader::do_arg_serial): New function.
4586         (Input_reader::do_get_unused_symbol_count): New function.
4587         (Input_reader::do_get_unused_symbol): New function.
4588         (Incremental_binary::input_file_count): New function.
4589         (Incremental_binary::get_input_reader): Change signature to use
4590         index instead of filename.
4591         (Incremental_binary::file_has_changed): New function.
4592         (Incremental_binary::get_input_argument): New function.
4593         (Incremental_binary::get_library): New function.
4594         (Incremental_binary::get_script_info): New function.
4595         (Incremental_binary::init_layout): New function.
4596         (Incremental_binary::reserve_layout): New function.
4597         (Incremental_binary::output_file): New function.
4598         (Incremental_binary::do_check_inputs): New function.
4599         (Incremental_binary::do_file_is_unchanged): Remove.
4600         (Incremental_binary::do_file_has_changed): New function.
4601         (Incremental_binary::do_init_layout): New function.
4602         (Incremental_binary::do_reserve_layout): New function.
4603         (Incremental_binary::do_input_file_count): New function.
4604         (Incremental_binary::do_get_input_reader): Change signature.
4605         (Incremental_binary::input_args_map_): New data member.
4606         (Incremental_binary::library_map_): New data member.
4607         (Incremental_binary::script_map_): New data member.
4608         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4609         new data members.
4610         (Sized_incremental_binary::output_section): New function.
4611         (Sized_incremental_binary::inputs_reader): Add const.
4612         (Sized_incremental_binary::symtab_reader): Add const.
4613         (Sized_incremental_binary::relocs_reader): Add const.
4614         (Sized_incremental_binary::got_plt_reader): Add const.
4615         (Sized_incremental_binary::get_symtab_view): New function.
4616         (Sized_incremental_binary::Inputs_reader): New typedef.
4617         (Sized_incremental_binary::Input_entry_reader): New typedef.
4618         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4619         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4620         (Sized_incremental_binary::do_file_has_changed): New function.
4621         (Sized_incremental_binary::do_init_layout): New function.
4622         (Sized_incremental_binary::do_reserve_layout): New function.
4623         (Sized_input_reader::Inputs_reader): Remove.
4624         (Sized_input_reader::Input_entry_reader): Remove.
4625         (Sized_input_reader::do_arg_serial): New function.
4626         (Sized_input_reader::do_get_unused_symbol_count): New function.
4627         (Sized_input_reader::do_get_unused_symbol): New function.
4628         (Sized_incremental_binary::do_input_file_count): New function.
4629         (Sized_incremental_binary::do_get_input_reader): Change signature;
4630         use index instead of filename.
4631         (Sized_incremental_binary::section_map_): New data member.
4632         (Sized_incremental_binary::input_entry_readers_): New data member.
4633         (class Sized_incr_relobj): New class.
4634         (class Sized_incr_dynobj): New class.
4635         (make_sized_incremental_object): New function.
4636         (class Incremental_library): New class.
4637         * layout.cc (Free_list::num_lists): New static data member.
4638         (Free_list::num_nodes): New static data member.
4639         (Free_list::num_removes): New static data member.
4640         (Free_list::num_remove_visits): New static data member.
4641         (Free_list::num_allocates): New static data member.
4642         (Free_list::num_allocate_visits): New static data member.
4643         (Free_list::init): New function.
4644         (Free_list::remove): New function.
4645         (Free_list::allocate): New function.
4646         (Free_list::dump): New function.
4647         (Free_list::print_stats): New function.
4648         (Layout_task_runner::run): Resize output file for incremental updates.
4649         (Layout::Layout): Initialize new data members.
4650         (Layout::set_incremental_base): New function.
4651         (Layout::init_fixed_output_section): New function.
4652         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4653         incremental updates.
4654         (Layout::create_gold_note): Do not create gold note section for
4655         incremental updates.
4656         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4657         for incremental updates.
4658         (Layout::set_section_offsets): For incremental updates, allocate space
4659         from free list.
4660         (Layout::create_symtab_sections): Layout with offsets relative to
4661         start of section; for incremental updates, allocate space from free
4662         list.
4663         (Layout::create_shdrs): For incremental updates, allocate space from
4664         free list.
4665         (Layout::finish_dynamic_section): For incremental updates, do not
4666         check --as-needed (fixed in subsequent patch).
4667         * layout.h (class Free_list): New class.
4668         (Layout::set_incremental_base): New function.
4669         (Layout::incremental_base): New function.
4670         (Layout::init_fixed_output_section): New function.
4671         (Layout::allocate): New function.
4672         (Layout::incremental_base_): New data member.
4673         (Layout::free_list_): New data member.
4674         * main.cc (main): Print Free_list statistics.
4675         * object.cc (Relobj::finalize_incremental_relocs): Add
4676         clear_counts parameter; clear counts only when clear_counts is set.
4677         (Sized_relobj::Sized_relobj): Initialize new base class.
4678         (Sized_relobj::do_layout): Don't report special sections.
4679         (Sized_relobj::do_for_all_local_got_entries): New function.
4680         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4681         symtab_off to all symbol table offsets.
4682         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4683         * object.h (class Got_offset_list): Move to top of file.
4684         (Object::Object): Allow case where input_file == NULL.
4685         (Object::~Object): Likewise.
4686         (Object::input_file): Assert that input_file != NULL.
4687         (Object::lock): Allow case where input_file == NULL.
4688         (Object::unlock): Likewise.
4689         (Object::is_locked): Likewise.
4690         (Object::token): Likewise.
4691         (Object::release): Likewise.
4692         (Object::is_incremental): New function.
4693         (Object::get_mtime): New function.
4694         (Object::for_all_local_got_entries): New function.
4695         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4696         (Object::set_is_in_system_directory): New function.
4697         (Object::is_in_system_directory): New function.
4698         (Object::do_is_incremental): New function.
4699         (Object::do_get_mtime): New function.
4700         (Object::do_for_all_local_got_entries): New function.
4701         (Object::is_in_system_directory_): New data member.
4702         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4703         (class Sized_relobj_base): New class.
4704         (class Sized_relobj): Derive from Sized_relobj_base.
4705         (class Sized_relobj::Symbols): Redeclare from base class.
4706         (class Sized_relobj::local_got_offset_list): Remove.
4707         (class Sized_relobj::Output_sections): Redeclare from base class.
4708         (class Sized_relobj::do_for_all_local_got_entries): New function.
4709         (class Sized_relobj::write_local_symbols): Add offset parameter.
4710         (class Sized_relobj::local_symbol_offset_): Update comment.
4711         (class Sized_relobj::local_dynsym_offset_): Update comment.
4712         * options.cc (Input_arguments::add_file): Remove const.
4713         * options.h (Input_file_argument::Input_file_argument):
4714         Initialize arg_serial_ (all constructors).
4715         (Input_file_argument::set_arg_serial): New function.
4716         (Input_file_argument::arg_serial): New function.
4717         (Input_file_argument::arg_serial_): New data member.
4718         (Input_arguments::Input_arguments): Initialize file_count_.
4719         (Input_arguments::add_file): Remove const.
4720         (Input_arguments::number_of_input_files): New function.
4721         (Input_arguments::file_count_): New data member.
4722         (Command_line::number_of_input_files): Call
4723         Input_arguments::number_of_input_files.
4724         * output.cc (Output_segment_headers::Output_segment_headers):
4725         Set current size.
4726         (Output_section::Input_section::current_data_size): New function.
4727         (Output_section::Output_section): Initialize new data members.
4728         (Output_section::add_input_section): Don't do merge sections for
4729         an incremental link; allocate space from free list for an
4730         incremental update.
4731         (Output_section::add_output_section_data): Allocate space from
4732         free list for an incremental update.
4733         (Output_section::update_data_size): New function.
4734         (Output_section::set_fixed_layout): New function.
4735         (Output_section::reserve): New function.
4736         (Output_segment::set_section_addresses): Remove const.
4737         (Output_segment::set_section_list_addresses): Remove const; allocate
4738         space from free list for an incremental update.
4739         (Output_segment::set_offset): Adjust size of RELRO segment for an
4740         incremental update.
4741         * output.h (Output_data::current_data_size): Move here from
4742         child classes.
4743         (Output_data::pre_finalize_data_size): New function.
4744         (Output_data::update_data_size): New function.
4745         (Output_section_headers::update_data_size): new function.
4746         (Output_section_data_build::current_data_size): Move to Output_data.
4747         (Output_data_strtab::update_data_size): New function.
4748         (Output_section::current_data_size): Move to Output_data.
4749         (Output_section::set_fixed_layout): New function.
4750         (Output_section::has_fixed_layout): New function.
4751         (Output_section::reserve): New function.
4752         (Output_section::update_data_size): New function.
4753         (Output_section::has_fixed_layout_): New data member.
4754         (Output_section::free_list_): New data member.
4755         (Output_segment::set_section_addresses): Remove const.
4756         (Output_segment::set_section_list_addresses): Remove const.
4757         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4758         New function.
4759         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4760         New function.
4761         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4762         parameter when calling Add_symbols constructor; store argument
4763         serial number for members of a lib group.
4764         (Add_symbols::locks): Allow case where token == NULL.
4765         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4766         (Read_member::~Read_member): New function.
4767         (Read_member::is_runnable): New function.
4768         (Read_member::locks): New function.
4769         (Read_member::run): New function.
4770         (Check_script::~Check_script): New function.
4771         (Check_script::is_runnable): New function.
4772         (Check_script::locks): New function.
4773         (Check_script::run): New function.
4774         (Check_library::~Check_library): New function.
4775         (Check_library::is_runnable): New function.
4776         (Check_library::locks): New function.
4777         (Check_library::run): New function.
4778         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4779         (Add_symbols::library_): New data member.
4780         (class Read_member): New class.
4781         (class Check_script): New class.
4782         (class Check_library): New class.
4783         * reloc.cc (Read_relocs::is_runnable): Allow case where
4784         token == NULL.
4785         (Read_relocs::locks): Likewise.
4786         (Scan_relocs::locks): Likewise.
4787         (Relocate_task::locks): Likewise.
4788         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4789         to clear counters.
4790         (Sized_relobj::incremental_relocs_scan): Fix comment.
4791         (Sized_relobj::do_relocate): Pass output file offset to
4792         write_local_symbols.
4793         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4794         from class declaration.
4795         * script.cc (read_input_script): Allocate Script_info; pass
4796         argument serial number to report_script.
4797         * script.h (class Script_info): Move to incremental.h.
4798         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4799         * symtab.h (Symbol_table::add_from_incrobj): New function.
4800         (Symbol_table::set_file_offset): New function.
4801
4802 2011-04-05  Cary Coutant  <ccoutant@google.com>
4803
4804         * incremental-dump.cc (dump_incremental_inputs): Change signature
4805         to take a Sized_incremental_binary; change caller.  Use readers
4806         in Sized_incremental_binary.
4807         * incremental.cc
4808         (Sized_incremental_binary::find_incremental_inputs_sections):
4809         Rename do_find_incremental_inputs_sections to this.
4810         (Sized_incremental_binary::setup_readers): New function.
4811         (Sized_incremental_binary::do_check_inputs): Check
4812         has_incremental_info_ flag; move setup code to setup_readers;
4813         use input readers.
4814         (Sized_incremental_binary::do_file_is_unchanged): New function.
4815         (Sized_incremental_binary::do_get_input_reader): New function.
4816         * incremental.h (class Incremental_binary): Move to end of file.
4817         (Incremental_binary::file_is_unchanged): New function.
4818         (Incremental_binary::do_file_is_unchanged): New function.
4819         (Incremental_binary::Input_reader): New class.
4820         (Incremental_binary::get_input_reader): New function.
4821         (class Sized_incremental_binary): Move to end of file.
4822         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4823         input section reader classes.
4824         (Sized_incremental_binary::has_incremental_info): New function.
4825         (Sized_incremental_binary::inputs_reader): New function.
4826         (Sized_incremental_binary::symtab_reader): New function.
4827         (Sized_incremental_binary::relocs_reader): New function.
4828         (Sized_incremental_binary::got_plt_reader): New function.
4829         (Sized_incremental_binary::do_file_is_unchanged): New function.
4830         (Sized_incremental_binary::Sized_input_reader): New class.
4831         (Sized_incremental_binary::get_input_reader): New function.
4832         (Sized_incremental_binary::find_incremental_inputs_sections):
4833         Rename do_find_incremental_inputs_sections to this.
4834         (Sized_incremental_binary::setup_readers): New function.
4835         (Sized_incremental_binary::has_incremental_info_): New data member.
4836         (Sized_incremental_binary::inputs_reader_): New data member.
4837         (Sized_incremental_binary::symtab_reader_): New data member.
4838         (Sized_incremental_binary::relocs_reader_): New data member.
4839         (Sized_incremental_binary::got_plt_reader_): New data member.
4840         (Sized_incremental_binary::current_input_file_): New data member.
4841
4842 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4843
4844         PR gold/12640
4845         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4846         violation.
4847
4848 2011-03-30  Cary Coutant  <ccoutant@google.com>
4849
4850         * archive.cc (Archive::include_member): Adjust call to report_object.
4851         (Add_archive_symbols::run): Add script_info to call to
4852         report_archive_begin.
4853         (Lib_group::include_member): Adjust call to report_object.
4854         (Add_lib_group_symbols::run): Adjust call to report_object.
4855         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4856         blocks.  Add object count for script input files.
4857         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4858         script_info parameter; change all callers.
4859         (Incremental_inputs::report_object): Add script_info parameter;
4860         change all callers.
4861         (Incremental_inputs::report_script): Store backpointer to
4862         incremental info entry.
4863         (Output_section_incremental_inputs::set_final_data_size): Record
4864         additional information for scripts.
4865         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4866         * incremental.h (Incremental_script_entry::add_object): New function.
4867         (Incremental_script_entry::get_object_count): New function.
4868         (Incremental_script_entry::get_object): New function.
4869         (Incremental_script_entry::objects_): New data member; adjust
4870         constructor.
4871         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4872         (Incremental_inputs::report_object): Add script_info parameter.
4873         (Incremental_inputs_reader::get_object_count): New function.
4874         (Incremental_inputs_reader::get_object_offset): New function.
4875         * options.cc (Input_arguments::add_file): Return reference to
4876         new input argument.
4877         * options.h (Input_argument::set_script_info): New function.
4878         (Input_argument::script_info): New function.
4879         (Input_argument::script_info_): New data member; adjust all
4880         constructors.
4881         (Input_file_group::add_file): Return reference to new input argument.
4882         (Input_file_lib::add_file): Likewise.
4883         (Input_arguments::add_file): Likewise.
4884         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4885         * script.cc (Parser_closure::Parser_closure): Add script_info
4886         parameter; adjust all callers.
4887         (Parser_closure::script_info): New function.
4888         (Parser_closure::script_info_): New data member.
4889         (read_input_script): Report scripts earlier to incremental info.
4890         (script_add_file): Set script_info in Input_argument.
4891         (script_add_library): Likewise.
4892         * script.h (Script_options::Script_info): Rewrite class.
4893
4894 2011-03-29  Cary Coutant  <ccoutant@google.com>
4895
4896         * archive.cc (Library_base::should_include_member): Move
4897         method here from class Archive.
4898         (Archive::Archive): Initialize base class.
4899         (Archive::should_include_member): Move to base class.
4900         (Archive::do_for_all_unused_symbols): New function.
4901         (Add_archive_symbols::run): Remove redundant access to
4902         incremental_inputs.
4903         (Lib_group::Lib_group): Initialize base class.
4904         (Lib_group::do_filename): New function.
4905         (Lib_group::include_member): Pass pointer to Lib_group to
4906         report_object.
4907         (Lib_group::do_for_all_unused_symbols): New function.
4908         (Add_lib_group_symbols::run): Report archive information for
4909         incremental links.
4910         * archive.h (class Library_base): New base class.
4911         (class Archive): Derive from Library_base.
4912         (Archive::filename): Move to base class.
4913         (Archive::set_incremental_info): Likewise.
4914         (Archive::incremental_info): Likewise.
4915         (Archive::Should_include): Likewise.
4916         (Archive::should_include_member): Likewise.
4917         (Archive::Armap_entry): Remove.
4918         (Archive::Unused_symbol_iterator): Remove.
4919         (Archive::unused_symbols_begin): Remove.
4920         (Archive::unused_symbols_end): Remove.
4921         (Archive::do_filename): New function.
4922         (Archive::do_get_mtime): New function.
4923         (Archive::do_for_all_unused_symbols): New function.
4924         (Archive::task_): Move to base class.
4925         (Archive::incremental_info_): Likewise.
4926         (class Lib_group): Derive from Library_base.
4927         (Lib_group::do_filename): New function.
4928         (Lib_group::do_get_mtime): New function.
4929         (Lib_group::do_for_all_unused_symbols): New function.
4930         (Lib_group::task_): Move to base class.
4931         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4932         function.
4933         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4934         function.
4935         * incremental.cc (Incremental_inputs::report_archive_begin):
4936         Use Library_base; call library's get_mtime; add incremental inputs
4937         entry before members.
4938         (class Unused_symbol_visitor): New class.
4939         (Incremental_inputs::report_archive_end): Use Library_base; use
4940         visitor class to record unused symbols; don't add incremental inputs
4941         entry after members.
4942         (Incremental_inputs::report_object): Use Library_base.
4943         * incremental.h
4944         (Incremental_archive_entry::Incremental_archive_entry): Remove
4945         unused Archive parameter.
4946         (Incremental_inputs::report_archive_begin): Use Library_base.
4947         (Incremental_inputs::report_archive_end): Likewise.
4948         (Incremental_inputs::report_object): Likewise.
4949         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4950         function.
4951         * object.h (Object::for_all_global_symbols): New function.
4952         (Object::do_for_all_global_symbols): New function.
4953         (Sized_relobj::do_for_all_global_symbols): New function.
4954         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4955         function.
4956         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4957         function.
4958
4959 2011-03-27  Ian Lance Taylor  <iant@google.com>
4960
4961         * archive.cc (Archive::interpret_header): Return -1 if something
4962         goes wrong.  Change callers accordingly.
4963
4964 2011-03-25  Cary Coutant  <ccoutant@google.com>
4965
4966         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4967         * testsuite/Makefile.in: Regenerate.
4968
4969 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4970
4971         * plugin.cc (get_view): New.
4972         (Plugin::load): Pass get_view to the plugin.
4973         (Plugin_manager::get_view): New.
4974
4975 2011-03-21  Ian Lance Taylor  <iant@google.com>
4976
4977         * testsuite/final_layout.sh: Rewrite to not use dc.
4978         * testsuite/relro_test.sh: Fail if dc is not present.
4979
4980 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4981
4982         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4983         Change == to -eq.
4984         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4985         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4986         Change == to -eq.
4987         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4988         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4989
4990 2011-03-14  Ian Lance Taylor  <iant@google.com>
4991
4992         * script-sections.cc (Sort_output_sections::script_compare):
4993         Rename from is_before, change return type.
4994         (Sort_output_sections::operator()): Adjust accordingly.
4995
4996 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4997
4998         PR gold/12572
4999         * testsuite/odr_violation2.cc: Add comment to make all error line
5000         numbers double digits.
5001         * testsuite/debug_msg.sh: Adjust expected errors.
5002
5003 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5004
5005         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5006         but mark earlier ones as non-canonical
5007         (offset_to_iterator): Update search target and example
5008         (do_addr2line): Return extra lines in a vector*
5009         (format_file_lineno): Extract from do_addr2line
5010         (one_addr2line): Add vector* out-param
5011         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5012         when a lineno entry appeared last for its instruction
5013         (Dwarf_line_info): Add vector* out-param
5014         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5015         * symtab.cc (Odr_violation_compare): Include the lineno in the
5016         comparison again.
5017         (linenos_from_loc): New. Combine the canonical line for an
5018         address with its other lines.
5019         (True_if_intersect): New. Helper functor to make
5020         std::set_intersection a query.
5021         (detect_odr_violations): Compare sets of lines instead of just
5022         one line for each function. This became less deterministic, but
5023         has fewer false positives.
5024         * symtab.h: Declarations.
5025         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5026         mix an optimized and non-optimized object in the same binary
5027         (odr_violation2.so): Same.
5028         * testsuite/Makefile.in: Regenerate from Makefile.am.
5029         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5030         * testsuite/debug_msg.sh: Update line numbers and add
5031         assertions.
5032         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5033         non-optimized context.
5034         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5035         isn't inlined, and use OdrDerived in an optimized context.
5036         * testsuite/odr_header1.h: Defines OdrDerived, where
5037         optimization will change the
5038         first-instruction-in-the-destructor's file and line number.
5039         * testsuite/odr_header2.h: Defines OdrBase.
5040
5041 2011-03-09  Ian Lance Taylor  <iant@google.com>
5042
5043         * fileread.cc (File_read::clear_views): Don't delete the whole
5044         file view.
5045
5046 2011-03-08  Ian Lance Taylor  <iant@google.com>
5047
5048         PR gold/12525
5049         * fileread.cc: #include <climits>.
5050         (GOLD_IOV_MAX): Define.
5051         (File_read::read_multiple): Limit number of entries by iov_max.
5052         * fileread.h (class File_read): Always set max_readv_entries to
5053         128.
5054
5055 2011-03-07  Ian Lance Taylor  <iant@google.com>
5056
5057         PR gold/12525
5058         * options.h (class General_options): Add -dy and -dn.
5059
5060 2011-03-02  Cary Coutant  <ccoutant@google.com>
5061
5062         * testsuite/script_test_9.t: Add TLS segment.
5063
5064 2011-03-02  Simon Baldwin  <simonb@google.com>
5065
5066         * configure.ac: Add check for gnu_indirect_function support in
5067         the toolchain building binutils.
5068         * configure: Rebuild.
5069
5070 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5071
5072         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5073         plugin only symbols.
5074         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5075         in plugin files as not needed in the symbol table.
5076
5077 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5078
5079         * output.cc (Output_section::add_input_section): Delay fill
5080         generation for section ordering.
5081
5082 2011-02-09  Ian Lance Taylor  <iant@google.com>
5083
5084         PR gold/12316
5085         * object.h (class Sized_relobj): Remove clear_local_symbols.
5086         * reloc.cc (Sized_relobj::do_relocate): Don't call
5087         clear_local_symbols.
5088
5089 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5090
5091         * plugin.cc (is_visible_from_outside): Return true for symbols
5092         in the -u option.
5093
5094 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5095
5096         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5097         filename.
5098
5099 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5100
5101         * icf.h (is_section_foldable_candidate): Change type of parameter
5102         to std::string.
5103         * icf.cc (Icf::find_identical_sections): Change type of local variable
5104         section_name to be std::string.
5105         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5106
5107 2011-01-25  Ian Lance Taylor  <iant@google.com>
5108
5109         * script.cc (script_add_extern): Rewrite to use
5110         add_symbol_reference.
5111
5112 2011-01-25  Doug Kwan  <dougkwan@google.com>
5113
5114         * icf.cc (get_section_contents): Always lock section's object.
5115
5116 2011-01-24  Ian Lance Taylor  <iant@google.com>
5117
5118         * options.h (class General_options): Accept
5119         --no-detect-odr-violations.
5120
5121 2011-01-24  Ian Lance Taylor  <iant@google.com>
5122
5123         * version.cc (version_string): Bump to 1.11.
5124
5125 2011-01-24  Ian Lance Taylor  <iant@google.com>
5126
5127         * plugin.cc (class Plugin_rescan): Define new class.
5128         (Plugin_manager::claim_file): Set any_claimed_.
5129         (Plugin_manager::save_archive): New function.
5130         (Plugin_manager::save_input_group): New function.
5131         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5132         necessary.
5133         (Plugin_manager::new_undefined_symbol): New function.
5134         (Plugin_manager::rescan): New function.
5135         (Plugin_manager::rescannable_defines): New function.
5136         (Plugin_manager::add_input_file): Set any_added_.
5137         * plugin.h (class Plugin_manager): define new fields rescannable_,
5138         undefined_symbols_, any_claimed_, and any_added_.  Declare
5139         Plugin_rescan as friend.  Declare new functions.
5140         (Plugin_manager::Rescannable): Define type.
5141         (Plugin_manager::Rescannable_list): Define type.
5142         (Plugin_manager::Undefined_symbol_list): Define type.
5143         (Plugin_manager::Plugin_manager): Initialize new fields.
5144         * archive.cc (Archive::defines_symbol): New function.
5145         (Add_archive_symbols::run): Pass archive to plugins if any.
5146         * archive.h (class Archive): Declare defines_symbol.
5147         * readsyms.cc (Input_group::~Input_group): New function.
5148         (Finish_group::run): Pass input_group to plugins if any.
5149         * readsyms.h (class Input_group): Declare destructor.
5150         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5151         any.
5152
5153 2011-01-10  Ian Lance Taylor  <iant@google.com>
5154
5155         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5156         section as relro.
5157         (Layout::set_segment_offsets): Reset increase_relro before calling
5158         set_section_addresses a second time.
5159
5160 2011-01-04  Cary Coutant  <ccoutant@google.com>
5161
5162         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5163         sections before NOBITS sections.
5164
5165 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5166
5167         * version.cc (print_version): Update copyright to 2011.
5168
5169 2010-12-23  Cary Coutant  <ccoutant@google.com>
5170
5171         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5172         of OS to this->add.  Add OD parameter to second form of the function.
5173
5174 2010-12-20  Ian Lance Taylor  <iant@google.com>
5175
5176         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5177         second of two consecutive entries with same offset.
5178
5179 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5180
5181         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5182         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5183         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5184         to avoid unneeded links against $(LDADD).
5185         * testsuite/Makefile.in: Regenerate.
5186
5187 2010-12-15  Ian Lance Taylor  <iant@google.com>
5188
5189         PR gold/12324
5190         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5191         for R_X86_64_32 and R_X86_64_PC32.
5192         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5193         ver_matching_def_pic.o.
5194         (ver_matching_def_pic.o): New target.
5195
5196 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5197
5198         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5199         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5200         Move definition before File_read::View member definitions.
5201         (File_read::View::~View): Initialize and hold lock before
5202         updating current_mapped_bytes.
5203
5204 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5205
5206         * dwarf_reader.cc: Remove outdated comment.
5207         * gold-threads.cc: Fix typo in error message.
5208         * archive.cc: Fix typos in comments.
5209         * archive.h: Likewise.
5210         * arm-reloc-property.cc: Likewise.
5211         * arm-reloc-property.h: Likewise.
5212         * arm-reloc.def: Likewise.
5213         * arm.cc: Likewise.
5214         * attributes.h: Likewise.
5215         * cref.cc: Likewise.
5216         * ehframe.cc: Likewise.
5217         * fileread.h: Likewise.
5218         * gold.h: Likewise.
5219         * i386.cc: Likewise.
5220         * icf.cc: Likewise.
5221         * incremental.h: Likewise.
5222         * int_encoding.cc: Likewise.
5223         * layout.h: Likewise.
5224         * main.cc: Likewise.
5225         * merge.h: Likewise.
5226         * object.cc: Likewise.
5227         * object.h: Likewise.
5228         * options.cc: Likewise.
5229         * readsyms.cc: Likewise.
5230         * reduced_debug_output.cc: Likewise.
5231         * reloc.cc: Likewise.
5232         * script-sections.cc: Likewise.
5233         * sparc.cc: Likewise.
5234         * symtab.h: Likewise.
5235         * target-reloc.h: Likewise.
5236         * target.cc: Likewise.
5237         * target.h: Likewise.
5238         * timer.cc: Likewise.
5239         * timer.h: Likewise.
5240         * x86_64.cc: Likewise.
5241
5242 2010-12-09  Cary Coutant  <ccoutant@google.com>
5243
5244         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5245         stack.
5246         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5247         parameter; change all callers.
5248         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5249         * options.h (warn_execstack): New option.
5250
5251 2010-12-07  Doug Kwan  <dougkwan@google.com>
5252
5253         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5254         like function call relocations.
5255
5256 2010-12-07  Ian Lance Taylor  <iant@google.com>
5257
5258         * archive.cc (Archive::get_elf_object_for_member): Permit
5259         punconfigured to be NULL.
5260         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5261         (Archive::include_member): Pass NULL to get_elf_object_for_member
5262         if we searched for the archive and this is the first included
5263         object.
5264
5265 2010-12-01  Ian Lance Taylor  <iant@google.com>
5266
5267         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5268         track_relocs_type_ field.
5269         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5270         Set track_relocs_type_.
5271         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5272         contents when using RELA relocs.
5273         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5274         reloc_map_.
5275         * reloc.cc (Track_relocs::next_addend): New function.
5276         * reloc.h (class Track_relocs): Declare next_addend.
5277
5278 2010-12-01  Ian Lance Taylor  <iant@google.com>
5279
5280         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5281         virtual destructor.
5282
5283 2010-12-01  Ian Lance Taylor  <iant@google.com>
5284
5285         * README: Update compilers known to work and fail.
5286
5287 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5288
5289         * configure.in: For --enable-gold, handle value `default' instead of
5290         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5291         not the default.
5292         * configure: Regenerate.
5293
5294 2010-11-18  Doug Kwan  <dougkwan@google.com>
5295
5296         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5297         and right_alignment to be zero.  Store result alignment only if it is
5298         greater than existing alignment.
5299
5300 2010-11-16  Cary Coutant  <ccoutant@google.com>
5301
5302         PR gold/12220
5303         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5304         Check for ".zdebug_line".
5305
5306 2010-11-16  Doug Kwan  <dougkwan@google.com>
5307             Cary Coutant  <ccoutant@google.com>
5308
5309         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5310         by reference; adjust all callers.
5311         * output.cc (Output_segment::set_section_addresses): Adjust references
5312         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5313         list is empty.
5314         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5315         end at page boundary.
5316
5317 2010-11-16  Cary Coutant  <ccoutant@google.com>
5318
5319         PR gold/12220
5320         * layout.cc (Layout::choose_output_section): Transform names of
5321         compressed sections even when using a script with a SECTIONS clause.
5322         (Layout::output_section_name): Remove code to transform
5323         compressed debug section names.
5324         * output.cc (Output_section::add_input_section): Use uncompressed
5325         section size when tracking input sections.
5326
5327 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5328
5329         * symtab.h (Symbol::NON_PIC_REF): Remove.
5330         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5331         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5332         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5333         (Symbol::use_plt_offset): Take a flags argument and pass it
5334         directly to needs_dynamic_reloc.  Restrict check for undefined
5335         weak symbols to function calls.
5336         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5337         (Target_arm::Scan::global): Use it.
5338         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5339         (Target_arm::Relocate::relocate): Likewise.
5340         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5341         parameter with an r_type parameter.  Use get_reference_flags
5342         to get the flags.
5343         (Target_arm::Relocate::relocate): Update accordingly.
5344         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5345         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5346         (Target_i386::Scan::global): Likewise.
5347         (Target_i386::Relocate::relocate): Likewise.
5348         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5349         parameter with an r_type parameter.  Use get_reference_flags
5350         to get the flags.
5351         (Target_i386::Relocate::relocate): Update accordingly.
5352         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5353         (Target_powerpc::Scan::global): Use it.
5354         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5355         (Target_powerpc::Relocate::relocate): Likewise.
5356         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5357         (Target_sparc::Scan::global): Use it.
5358         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5359         (Target_sparc::Relocate::relocate): Likewise.
5360         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5361         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5362         (Target_x86_64::Scan::global): Likewise.
5363         (Target_x86_64::Relocate::relocate): Likewise.
5364
5365 2010-11-08  Doug Kwan  <dougkwan@google.com>
5366             Cary Coutant  <ccoutant@google.com>
5367
5368         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5369         (Arm_exidx_merge_section::section_contents_): New data member.
5370         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5371         (Arm_input_section::~Arm_input_section): De-allocate memory.
5372         (Arm_input_section::original_contents_): New data member.
5373         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5374         in parameters instead of calling Object::section_contents without
5375         locking.
5376         (Arm_output_section::group_section): New parameter TASK.  Pass it
5377         to callees that need locking objects.
5378         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5379         to lock EXIDX input sections.  Fix a formatting issue.  Call
5380         Arm_exidx_merged_section::build_contents to create merged section
5381         contents.
5382         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5383         to lock object of stub table owner.
5384         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5385         TEXT_SIZE to initialize data member TEXT_SIZE_.
5386         (Arm_exidx_input_section::addralign): Fix typo in comment.
5387         (Arm_exidx_input_section::text_size): New method.
5388         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5389         that require locking objects.  Lock objects before scanning for stubs
5390         and updating local symbols.
5391         (Arm_input_section<big_endian>::init): Copy contents of original
5392         input section.
5393         (Arm_input_section<big_endian>::do_write): Use saved contents of
5394         original input section instead of calling Object::section_contents
5395         without locking.
5396         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5397         size without calling Object::section_size().
5398         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5399         for size.  Allocate a buffer for merged EXIDX entries.
5400         (Arm_exidx_merged_section::build_contents): New method.
5401         (Arm_exidx_merged_section::do_write): Move merge section contents
5402         building code to Arm_exidx_merged_section::build_contetns.  Write
5403         out contetns in buffer instead of building it on the fly.
5404         (Arm_relobj::make_exidx_input_section): Also pass text section size
5405         to Arm_exidx_input_section constructor.
5406         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5407         (Arm_dynobj::do_read_symbols): Fix memory leak.
5408         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5409         * target.h: (class Task): Add forward declaration.
5410         (Target::relax): Add new parameter TASK and pass it to
5411         Target::do_relax().
5412         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5413
5414 2010-11-05  Cary Coutant  <ccoutant@google.com>
5415
5416         PR gold/10708
5417         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5418         object when reading from the file.
5419         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5420         second layout pass.
5421         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5422         when reading section contents.
5423         (get_section_contents): Likewise.
5424         (icf::find_identical_sections): Likewise.
5425         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5426         object when reading from the file.
5427         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5428         the object when doing deferred section layout.
5429
5430 2010-11-03  Nick Clifton  <nickc@redhat.com>
5431
5432         PR gold/12001
5433         * script.h (class Symbol_assignment: name): New member.  Returns
5434         the name of the symbol.
5435         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5436         Returns true if the given symbol name is on the list of
5437         assignments wating to be processed.
5438         * archive.cc (should_incldue_member): If the symbol is undefined,
5439         check to see if it is on the list of symbols pending assignment.
5440
5441 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5442
5443         * script-sections.cc (Script_sections::find_memory_region): Check
5444         for a NULL output section pointer.
5445
5446 2010-10-29  Doug Kwan  <dougkwan@google.com>
5447
5448         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5449         Output_section::add_relaxed_input_section.
5450         * output.cc (Output_section::add_relaxed_input_section): Add new
5451         arguments LAYOUT and NAME.  Set section order index.
5452         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5453         Copy section order index.
5454         * output.h (Output_section::add_relaxed_input_section): Add new
5455         arguments LAYOUT and NAME.
5456
5457 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5458
5459         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5460         NATIVE_OR_CROSS_LINKER.
5461         * testsuite/Makefile.in: Regenerate.
5462
5463 2010-10-20  Doug Kwan  <dougkwan@google.com>
5464
5465         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5466         without SHF_LINK_ORDER flags.
5467         * layout.cc (Layout::choose_output_section): Do not filter
5468         SHF_LINK_ORDER flag in a relocatable link.
5469
5470 2010-10-17  Cary Coutant  <ccoutant@google.com>
5471
5472         * output.h (Output_segment::set_section_addresses): Change function
5473         signature.  Update all callers.
5474         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5475         sections.
5476         (Output_segment::set_section_addresses): Align after last TLS
5477         section.  Add padding before last relro section instead of after.
5478
5479 2010-10-17  Doug Kwan  <dougkwan@google.com>
5480
5481         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5482         GOT output section to be writable.
5483
5484 2010-10-14  Cary Coutant  <ccoutant@google.com>
5485
5486         * debug.h (DEBUG_INCREMENTAL): New flag.
5487         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5488         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5489         mode.
5490         * incremental.cc (report_command_line): Ignore all forms of
5491         --incremental.
5492         * layout.cc (Layout::Layout): Check parameters for incremental link
5493         mode.
5494         * options.cc (General_options::parse_incremental): New function.
5495         (General_options::parse_no_incremental): New function.
5496         (General_options::parse_incremental_full): New function.
5497         (General_options::parse_incremental_update): New function.
5498         (General_options::incremental_mode_): New data member.
5499         (General_options::finalize): Check incremental_mode_.
5500         * options.h (General_options): Update help text for --incremental.
5501         Add --no-incremental, --incremental-full, --incremental-update.
5502         (General_options::Incremental_mode): New enum type.
5503         (General_options::incremental_mode): New function.
5504         (General_options::incremental_mode_): New data member.
5505         * parameters.cc (Parameters::incremental_mode_): New data member.
5506         (Parameters::set_options): Set incremental_mode_.
5507         (Parameters::set_incremental_full): New function.
5508         (Parameters::incremental): New function.
5509         (Parameters::incremental_update): New function.
5510         (set_parameters_incremental_full): New function.
5511         * parameters.h (Parameters::set_incremental_full): New function.
5512         (Parameters::incremental): New function.
5513         (Parameters::incremental_update): New function.
5514         (Parameters::incremental_mode_): New data member.
5515         (set_parameters_incremental_full): New function.
5516         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5517         incremental link mode.
5518         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5519         (Sized_relobj::do_relocate_sections): Likewise.
5520         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5521         option.
5522         * testsuite/Makefile.in: Regenerate.
5523         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5524
5525 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5526
5527         * script-sections.h (class Script_sections): Make
5528         Sections_elements typedef public.
5529         * script-sections.cc (class Sort_output_sections): Add elements_
5530         field.  Add constructor which sets it; change all callers.
5531         (Sort_output_sections::is_before): New function.
5532         (Sort_output_sections::operator()): Call is_before.
5533         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5534         conditional.
5535         * testsuite/script_test_10.sh: New test. Test script section
5536         order.
5537         * testsuite/script_test_10.t: Likewise.
5538         * testsuite/script_test_10.s: Likewise.
5539         * testsuite/Makefile.am: Wrap the cross linker tests and the
5540         common tests into NATIVE_OR_CROSS_LINKER.
5541         (check_SCRIPTS): Add script_test_10.sh.
5542         (check_DATA): Add script_test_10.stdout.
5543         (script_test_10.o, script_test_10): New targets.
5544         (script_test_10.stdout): New target.
5545         * configure, testsuite/Makefile.in: Regenerate.
5546
5547 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5548
5549         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5550         error for the deprecated relocations.
5551         (Target_arm::Scan::global): Likewise.
5552         (Target_arm::Relocate::relocate): Likewise.
5553
5554 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5555
5556         * fileread.cc (Input_file::find_file): Initialize *found_name
5557         and *namep when using the fallback search for case 4.
5558
5559 2010-10-11  Cary Coutant  <ccoutant@google.com>
5560
5561         * options.h (class General_options): Redefine -z lazy as an alias for
5562         the negation of -z now.
5563
5564 2010-10-11  Ian Lance Taylor  <iant@google.com>
5565
5566         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5567         binding.
5568
5569 2010-10-06  Nick Clifton  <nickc@redhat.com>
5570
5571         * script-sections.cc(class Memory_region): Remove
5572         current_lma_offset_ field.  Rename current_vma_offset_ to
5573         current_offset_.  Add last_section_ field.
5574         (Memory_region::get_current_vma_address): Rename to
5575         get_current_address.
5576         (Memory_region::get_current_lma_address): Delete.
5577         (Memory_region::increment_vma_offset): Rename to
5578         increment_offset.
5579         (Memory_region::increment_lma_offset): Delete.
5580         (Memory_region::attributes_compatible): New method.  Returns
5581         true if the provided section is compatible with the region.
5582         (Memory_region::get_last_section): New method.  Returns the last
5583         section to use the region.
5584         (Memory_region::set_last_section): New method.  Stores the last
5585         section to use the region.
5586         (Script_sections::block_in_region): New method.  Returns true if
5587         a block of memory is contained within a region.
5588         (Script_sections::find_memory_region): New method.  Locates a
5589         memory region to be used to set a VMA or LMA address.
5590         (Output_section_definition::set_section_addresses): Add code to
5591         check for addresses set by memory regions.
5592         (Output_segment::set_section_addresses): Remove memory region
5593         walking code.
5594         (Script_sections::create_segment): Add a warning if a header
5595         segment is created outside of any region.
5596         * script-sections.h (class Script_sections): Add prototypes for
5597         find_memory_region and block_in_region methods.
5598         * testsuite/memory_test.s: Use .long instead of .word.
5599         * testsuite/memory_test.t: Add some more output sections.
5600         * testsuite/memory_test.sh: Update expected output.
5601
5602 2010-10-02  Doug Kwan  <dougkwan@google.com>
5603
5604         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5605         defintion to symtab.h
5606         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5607         declaration to defintion.
5608
5609 2010-10-01  Nick Clifton  <nickc@redhat.com>
5610
5611         * expression.cc (eval): Replace dummy argument with NULL.
5612         (eval_maybe_dot): Check for a NULL result section pointer.
5613         (Symbol_expression::value): Likewise.
5614         (Dot_expression::value): Likewise.
5615         (BINARY_EXPRESSION): Likewise.
5616         (Max_expression::value): Likewise.
5617         (Min_expression::value): Likewise.
5618         (Absolute_expression::value): Likewise.
5619         (Addr_expression::value_from_output_section): Likewise.
5620         (Loaddddr_expression::value_from_output_section): Likewise.
5621         (Segment_start_expression::value): Likewise.
5622         * script-sections.cc
5623         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5624         argument with NULL.
5625         (Sections_elememt_dot_assignment::set_section_addresses):
5626         Likewise.
5627         (Output_data_expression::do_write_to_buffer): Likewise.
5628         (Output_section_definition::finalize_symbols): Likewise.
5629         (Output_section_definition::set_section_addresses): Likewise.
5630
5631 2010-09-30  Doug Kwan  <dougkwan@google.com>
5632
5633         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5634
5635 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5636
5637         * target.h (Target::can_icf_inline_merge_sections): New virtual
5638         function.
5639         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5640         virtual function.
5641         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5642         virtual function.
5643         * icf.cc (get_section_contents): Inline merge sections only when
5644         target allows it.
5645
5646 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5647
5648         * configure: Regenerate.
5649
5650 2010-09-17  Ian Lance Taylor  <iant@google.com>
5651
5652         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5653         * testsuite/Makefile.am (memory_test.o): New target.
5654         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5655         memory_test.t.
5656         * testsuite/Makefile.in: Rebuild.
5657
5658 2010-09-17  Doug Kwan  <dougkwan@google.com>
5659
5660         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5661         defintion if relocation uses GOT entries of the symbol.
5662         * testsuite/icf_safe_test.sh: Fix test.
5663         * testsuite/icf_safe_so_test.sh: Fix test.
5664
5665 2010-09-16  Cary Coutant  <ccoutant@google.com>
5666
5667         * script_sections.cc (class Memory_region): Remove "NULL" from
5668         vector initializations.
5669
5670 2010-09-15  Cary Coutant  <ccoutant@google.com>
5671
5672         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5673         Resolve forwarding symbols.
5674
5675 2010-09-15  Doug Kwan  <dougkwan@google.com>
5676
5677         * gold/testsuite/script_test_3.t: Add ARM special sections.
5678         * gold/testsuite/script_test_4.t: Same.
5679         * gold/testsuite/script_test_5.t: Same.
5680         * gold/testsuite/script_test_6.t: Same.
5681         * gold/testsuite/script_test_7.t: Same.
5682         * gold/testsuite/script_test_7.t: Same.
5683         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5684
5685 2010-09-14  Cary Coutant  <ccoutant@google.com>
5686
5687         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5688         (Target_x86_64::Relocate::relocate_tls): Replace check for
5689         saw_tls_block_reloc_ with test for executable section.
5690
5691 2010-09-12  Cary Coutant  <ccoutant@google.com>
5692
5693         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5694         position-independent executables to shared libraries need dynamic
5695         relocations.
5696         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5697         position-independent executables.
5698         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5699         * testsuite/Makefile.in: Regenerate.
5700
5701 2010-09-10  Nick Clifton  <nickc@redhat.com>
5702
5703         PR gold/11997
5704         * testsuite/memory_test.t: Discard any sections that are not
5705         needed.
5706
5707 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5708
5709         PR gold/11996
5710         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5711         "This::" to work around a bug in gcc 4.2.
5712
5713         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5714
5715 2010-09-09  Rafael Espindola  <espindola@google.com>
5716
5717         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5718         sections with different PF_X flags in the same segment.
5719         (Layout::find_first_load_seg): Search all segments to find the first
5720         one.
5721         * options.h (rosegment): New.
5722
5723 2010-09-08  Rafael Espindola  <espindola@google.com>
5724
5725         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5726
5727 2010-09-08  Doug Kwan  <dougkwan@google.com>
5728
5729         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5730         (Arm_relobj::do_relocate_sections): Add new parameter for output
5731         file to match the parent.
5732         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5733         of local symbols instead of input values.  Update code to track
5734         changes in gold::relocate_section.
5735         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5736         (Sized_relobj::compute_final_local_value_internal): New methods.
5737         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5738         body into private version of Sized_relobj::compute_final_local_value.
5739         Call the inline method.
5740         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5741         merged symbol value if there is one.
5742         (Symbol_value::has_output_value): New method defintiion.
5743         (Sized_relobj::Compute_final_local_value_status): New enum type.
5744         (Sized_relobj::compute_final_local_value): New methods.
5745         (Sized_relobj::compute_final_local_value_internal): New methods.
5746         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5747         and arm_cortex_a8.sh.
5748         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5749         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5750         New tests.
5751         * Makefile.in: Regenerate.
5752         * testsuite/arm_bl_out_of_range.s: Update test.
5753         * testsuite/thumb_bl_out_of_range.s: Ditto.
5754         * testsuite/thumb_blx_out_of_range.s: Ditto.
5755         * testsuite/arm_branch_out_of_range.sh: New file.
5756         * testsuite/arm_cortex_a8.sh: Ditto.
5757         * testsuite/arm_cortex_a8_b.s: Ditto.
5758         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5759         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5760         * testsuite/arm_cortex_a8_bl.s: Ditto.
5761         * testsuite/arm_cortex_a8_blx.s: Ditto.
5762         * testsuite/arm_cortex_a8_local.s: Ditto.
5763         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5764         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5765
5766 2010-09-08  Rafael Espindola  <espindola@google.com>
5767
5768         * Makefile.am (memory_test.stdout): Run readelf with -W.
5769         * Makefile.in: Regenerate.
5770         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5771         64 bit output.
5772
5773 2010-09-08  Rafael Espindola  <espindola@google.com>
5774
5775         * script-sections.cc (Script_sections::add_memory_region): Convert
5776         field precision to int.
5777         * script.cc (script_set_section_region, script_set_section_region):
5778         Convert field precision to int.
5779
5780 2010-09-08  Rafael Espindola  <espindola@google.com>
5781
5782         * arm.cc (do_finalize_sections): Create the __exidx_start and
5783         __exdix_end symbols even when the section is missing.
5784
5785 2010-09-08  Nick Clifton  <nickc@redhat.com>
5786
5787         * README: Remove claim that MEMORY is not supported.
5788         * expression.cc (script_exp_function_origin)
5789         (script_exp_function_length): Move from here to ...
5790         * script.cc: ... here.
5791         (script_set_section_region, script_add_memory)
5792         (script_parse_memory_attr, script_include_directive): New
5793         functions.
5794         * script-sections.cc
5795         (class Memory_region): New class.
5796         (class Output_section_definition): Add set_memory_region,
5797         set_section_vma, set_section_lma and get_section_name methods.
5798         (class Script_Sections): Add add_memory_region,
5799         find_memory_region, find_memory_region_origin,
5800         find_memory_region_length and set_memory_region methods.
5801         Have set_section_addresses method walk the list of set memory
5802         regions.
5803         Extend the print methos to display memory regions.
5804         * script-sections.h: Add prototypes for new methods.
5805         Add enum for MEMORY region attributes.
5806         * yyscript.y: Add support for parsing MEMORY regions.
5807         * script-c.h: Add prototypes for new functions.
5808         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5809         * testsuite/Makefile.in: Regenerate.
5810         * testsuite/memory_test.sh: New script.
5811         * testsuite/memory_test.s: New assembler source file.
5812         * testsuite/memory_test.t: New linker script.
5813
5814 2010-08-27  Doug Kwan  <dougkwan@google.com>
5815
5816         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5817         reference override an existing dynamic weak reference.
5818         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5819         * testsuite/Makefile.in: Regenerate.
5820         * testsuite/dyn_weak_ref.sh: New file.
5821         * testsuite/dyn_weak_ref_1.c: Ditto.
5822         * testsuite/dyn_weak_ref_2.c: Ditto.
5823
5824 2010-08-27  Ian Lance Taylor  <iant@google.com>
5825
5826         * incremental.h (class Incremental_input_entry): Add virtual
5827         destructor.
5828
5829 2010-08-27  Ian Lance Taylor  <iant@google.com>
5830
5831         * testsuite/start_lib_test_3.c: Mark t3 as used.
5832
5833 2010-08-27  Nick Clifton  <nickc@redhat.com>
5834
5835         * options.cc (version_script): Fix small typo in previous
5836         whitespace tidyup.
5837
5838 2010-08-25  Nick Clifton  <nickc@redhat.com>
5839
5840         * archive.cc: Formatting fixes: Remove whitespace between
5841         typename and following asterisk.  Remove whitespace between
5842         function name and opening parenthesis.
5843         * archive.h: Likewise.
5844         * arm.cc: Likewise.
5845         * attributes.cc: Likewise.
5846         * attributes.h: Likewise.
5847         * common.cc: Likewise.
5848         * copy-relocs.cc: Likewise.
5849         * dirsearch.h: Likewise.
5850         * dynobj.cc: Likewise.
5851         * ehframe.cc: Likewise.
5852         * ehframe.h: Likewise.
5853         * expression.cc: Likewise.
5854         * fileread.cc: Likewise.
5855         * fileread.h: Likewise.
5856         * gc.h: Likewise.
5857         * gold-threads.cc: Likewise.
5858         * gold.cc: Likewise.
5859         * i386.cc: Likewise.
5860         * icf.h: Likewise.
5861         * incremental-dump.cc: Likewise.
5862         * incremental.cc: Likewise.
5863         * layout.cc: Likewise.
5864         * layout.h: Likewise.
5865         * main.cc: Likewise.
5866         * merge.cc: Likewise.
5867         * merge.h: Likewise.
5868         * object.cc: Likewise.
5869         * object.h: Likewise.
5870         * options.cc: Likewise.
5871         * options.h: Likewise.
5872         * output.cc: Likewise.
5873         * output.h: Likewise.
5874         * plugin.cc: Likewise.
5875         * plugin.h: Likewise.
5876         * powerpc.cc: Likewise.
5877         * reloc.cc: Likewise.
5878         * script-c.h: Likewise.
5879         * script-sections.cc: Likewise.
5880         * script.cc: Likewise.
5881         * stringpool.cc: Likewise.
5882         * symtab.cc: Likewise.
5883         * symtab.h: Likewise.
5884         * target.cc: Likewise.
5885         * timer.cc: Likewise.
5886         * timer.h: Likewise.
5887         * version.cc: Likewise.
5888         * x86_64.cc: Likewise.
5889
5890 2010-08-24  Nick Clifton  <nickc@redhat.com>
5891
5892         PR 11899
5893         * layout.cc (segment_precedes): Sort segments by their physical
5894         addresses, if they have been set.
5895
5896 2010-08-23  Cary Coutant  <ccoutant@google.com>
5897
5898         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5899         symbols data.
5900         (Lib_group::include_member): Unlock object after deleting its
5901         symbols data.
5902         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5903         the bug fixed here.
5904
5905 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5906             Cary Coutant  <ccoutant@google.com>
5907
5908         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5909         constructor, and set_blocker.
5910         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5911         readsyms_blocker_.
5912         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5913         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5914         * testsuite/Makefile.am (start_lib_test): New test case.
5915         * testsuite/Makefile.in: Regenerate.
5916         * testsuite/start_lib_test_main.c: New file.
5917         * testsuite/start_lib_test_1.c: New file.
5918         * testsuite/start_lib_test_2.c: New file.
5919         * testsuite/start_lib_test_3.c: New file.
5920
5921 2010-08-19  Ian Lance Taylor  <iant@google.com>
5922
5923         * Makefile.in: Rebuild with automake 1.11.1.
5924         * aclocal.m4: Likewise.
5925         * testsuite/Makefile.in: Likewise.
5926
5927 2010-08-19  Ian Lance Taylor  <iant@google.com>
5928
5929         PR 10893
5930         * i386.cc (class Output_data_plt_i386): Update declarations.
5931         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5932         local_ifuncs_ fields.
5933         (Target_i386::do_plt_section_for_global): New function.
5934         (Target_i386::do_plt_section_for_local): New function.
5935         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5936         parameter; change all callers.  Initialize global_ifuncs_ and
5937         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5938         __rel_iplt_end.
5939         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5940         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5941         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5942         symbols.
5943         (Target_i386::make_plt_section): New function, broken out of
5944         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5945         (Target_i386::make_plt_entry): Call make_plt_section.
5946         (Target_i386::make_local_ifunc_plt_entry): New function.
5947         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5948         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5949         R_386_IRELATIVE to switch.
5950         (Target_i386::Scan::global): Likewise.
5951         (Target_i386::Relocate::relocate): Likewise.
5952         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5953         switch.
5954         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5955         (Target_x86_64::do_plt_section_for_global): New function.
5956         (Target_x86_64::do_plt_section_for_local): New function.
5957         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5958         parameter; change all callers.  If doing a static link define
5959         __rela_iplt_start and __rela_iplt_end.
5960         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5961         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5962         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5963         to point to .plt.
5964         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5965         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5966         switch.
5967         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5968         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5969         R_X86_64_IRELATIVE to switch.
5970         (Target_x86_64::Scan::global): Likewise.
5971         (Target_x86_64::Relocate::relocate): Likewise.
5972         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5973         switch.
5974         * target.h (class Target): Add plt_section_for_global and
5975         plt_section_for_local functions.  Add do_plt_section_for_global
5976         and do_plt_section_for_local virtual functions.
5977         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5978         clarifying comments.
5979         (Symbol::use_plt_offset): Handle IFUNC symbol.
5980         * object.cc (Sized_relobj::Sized_relobj): Initialize
5981         local_plt_offsets_.
5982         (Sized_relobj::local_has_plt_offset): New function.
5983         (Sized_relobj::local_plt_offset): New function.
5984         (Sized_relobj::set_local_plt_offset): New function.
5985         (Sized_relobj::do_count): Handle IFUNC symbol.
5986         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5987         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5988         is_ifunc_symbol functions.
5989         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5990         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5991         local_plt_offsets_ field.
5992         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5993         * output.h (class Output_section_data): Add non-const
5994         output_section function.
5995         (class Output_data_got): Update declarations.
5996         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5997         Add use_plt_offset parameter to global and local constructors.
5998         Change all callers.  Change local_sym_index_ field to 31 bits.
5999         Change GSYM_CODE and CONSTANT_CODE accordingly.
6000         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6001         doing a static link don't set sh_link field.
6002         (Output_data_got::Got_entry::write): Use PLT offset if
6003         appropriate.
6004         (Output_data_got::add_global_plt): New function.
6005         (Output_data_got::add_local_plt): New function.
6006         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6007         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6008         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6009         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6010         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6011         IFUNC conditional.
6012         * testsuite/ifunc-sel.h: New file.
6013         * testsuite/ifuncmain1.c: New file.
6014         * testsuite/ifuncmain1vis.c: New file.
6015         * testsuite/ifuncmod1.c: New file.
6016         * testsuite/ifuncdep2.c: New file.
6017         * testsuite/ifuncmain2.c: New file.
6018         * testsuite/ifuncmain3.c: New file.
6019         * testsuite/ifuncmod3.c: New file.
6020         * testsuite/ifuncmain4.c: New file.
6021         * testsuite/ifuncmain5.c: New file.
6022         * testsuite/ifuncmod5.c: New file.
6023         * testsuite/ifuncmain6pie.c: New file.
6024         * testsuite/ifuncmod6.c: New file.
6025         * testsuite/ifuncmain7.c: New file.
6026         * configure, testsuite/Makefile.in: Rebuild.
6027
6028 2010-08-18  Ian Lance Taylor  <iant@google.com>
6029
6030         * incremental.cc
6031         (Output_section_incremental_inputs::write_input_files): Add cast
6032         to avoid signed/unsigned comparison warning.
6033         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6034
6035 2010-08-12  Cary Coutant  <ccoutant@google.com>
6036
6037         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6038
6039 2010-08-13  Ian Lance Taylor  <iant@google.com>
6040
6041         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6042
6043 2010-08-12  Cary Coutant  <ccoutant@google.com>
6044             Doug Kwan  <dougkwan@google.com>
6045
6046         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6047         defintion overrides non-weak undef, remember that the original undef
6048         is not weak.
6049         * symtab.cc (Symbol_table::sized_write_global): For undef without
6050         an original weak binding, set binding to global in output.
6051         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6052         * testsuite/Makefile.in: Regenerate.
6053         * testsuite/strong_ref_weak_def.sh: New file.
6054         * testsuite/strong_ref_weak_def_1.c: Ditto.
6055         * testsuite/strong_ref_weak_def_2.c: Ditto.
6056
6057 2010-08-12  Cary Coutant  <ccoutant@google.com>
6058
6059         * testsuite/incremental_test.sh: Rewrite.
6060         * testsuite/incremental_test_1.c: Rewrite.
6061         * testsuite/incremental_test_2.c: Rewrite.
6062
6063 2010-08-12  Cary Coutant  <ccoutant@google.com>
6064
6065         * arm.cc (Target_arm::got_size): Add const.
6066         (Target_arm::got_entry_count): New function.
6067         (Target_arm::plt_entry_count): New function.
6068         (Target_arm::first_plt_entry_offset): New function.
6069         (Target_arm::plt_entry_size): New function.
6070         (Output_data_plt_arm::entry_count): New function.
6071         (Output_data_plt_arm::first_plt_entry_offset): New function.
6072         (Output_data_plt_arm::get_plt_entry_size): New function.
6073         * i386.cc (Target_i386::got_size): Add const.
6074         (Target_i386::got_entry_count): New function.
6075         (Target_i386::plt_entry_count): New function.
6076         (Target_i386::first_plt_entry_offset): New function.
6077         (Target_i386::plt_entry_size): New function.
6078         (Output_data_plt_i386::entry_count): New function.
6079         (Output_data_plt_i386::first_plt_entry_offset): New function.
6080         (Output_data_plt_i386::get_plt_entry_size): New function.
6081         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6082         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6083         * incremental.cc: Include target.h.
6084         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6085         parameter.  Adjust all callers.  Find incremental_got_plt section.
6086         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6087         section.
6088         (Output_section_incremental_inputs::set_final_data_size): Calculate
6089         size of incremental_got_plt section.
6090         (Output_section_incremental_inputs::do_write): Write the
6091         incremental_got_plt section.
6092         (Got_plt_view_info): New struct.
6093         (Local_got_offset_visitor): New class.
6094         (Global_got_offset_visitor): New class.
6095         (Global_symbol_visitor_got_plt): New class.
6096         (Output_section_incremental_inputs::write_got_plt): New function.
6097         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6098         Add parameter.  Adjust all callers.
6099         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6100         (Incremental_inputs::got_plt_section): New function.
6101         (Incremental_inputs::got_plt_section_): New data member.
6102         (Incremental_got_plt_reader): New class.
6103         * layout.cc (Layout::create_incremental_info_sections): Add the
6104         incremental_got_plt section.
6105         * object.h (Got_offset_list::get_list): New function.
6106         (Got offset_list::for_all_got_offsets): New function.
6107         (Sized_relobj::local_got_offset_list): New function.
6108         * powerpc.cc (Target_powerpc::got_size): Add const.
6109         (Target_powerpc::got_entry_count): New function.
6110         (Target_powerpc::plt_entry_count): New function.
6111         (Target_powerpc::first_plt_entry_offset): New function.
6112         (Target_powerpc::plt_entry_size): New function.
6113         (Output_data_plt_powerpc::entry_count): New function.
6114         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6115         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6116         * sparc.cc (Target_sparc::got_size): Add const.
6117         (Target_sparc::got_entry_count): New function.
6118         (Target_sparc::plt_entry_count): New function.
6119         (Target_sparc::first_plt_entry_offset): New function.
6120         (Target_sparc::plt_entry_size): New function.
6121         (Output_data_plt_sparc::entry_count): New function.
6122         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6123         (Output_data_plt_sparc::get_plt_entry_size): New function.
6124         * symtab.h (Symbol::got_offset_list): New function.
6125         (Symbol_table::for_all_symbols): New function.
6126         * target.h (Sized_target::got_entry_count): New function.
6127         (Sized_target::plt_entry_count): New function.
6128         (Sized_target::plt_entry_size): New function.
6129         * x86_64.cc (Target_x86_64::got_size): Add const.
6130         (Target_x86_64::got_entry_count): New function.
6131         (Target_x86_64::plt_entry_count): New function.
6132         (Target_x86_64::first_plt_entry_offset): New function.
6133         (Target_x86_64::plt_entry_size): New function.
6134         (Output_data_plt_x86_64::entry_count): New function.
6135         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6136         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6137
6138 2010-08-12  Cary Coutant  <ccoutant@google.com>
6139
6140         * archive.cc: Include incremental.h.
6141         (Archive::Archive): Initialize incremental_info_.
6142         (Archive::include_member): Record archive members in incremental info.
6143         (Add_archive_symbols::run): Record begin and end of an archive in
6144         incremental info.
6145         (Lib_group::include_member): Record objects in incremental info.
6146         * archive.h (Incremental_archive_entry): Forward declaration.
6147         (Archive::set_incremental_info): New member function.
6148         (Archive::incremental_info): New member function.
6149         (Archive::Unused_symbol_iterator): New class.
6150         (Archive::unused_symbols_begin): New member function.
6151         (Archive::unused_symbols_end): New member function.
6152         (Archive::incremental_info_): New data member.
6153         * incremental-dump.cc (find_input_containing_global): New function.
6154         (dump_incremental_inputs): Dump new incremental info sections.
6155         * incremental.cc: Include symtab.h.
6156         (Output_section_incremental_inputs): New class.
6157         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6158         new incremental info sections.
6159         (Sized_incremental_binary::do_check_inputs): Likewise.
6160         (Incremental_inputs::report_archive): Remove.
6161         (Incremental_inputs::report_archive_begin): New function.
6162         (Incremental_inputs::report_archive_end): New function.
6163         (Incremental_inputs::report_object): New function.
6164         (Incremental_inputs::finalize_inputs): Remove.
6165         (Incremental_inputs::report_input_section): New function.
6166         (Incremental_inputs::report_script): Rewrite.
6167         (Incremental_inputs::finalize): Do nothing but finalize string table.
6168         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6169         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6170         (Incremental_inputs::create_data_sections): New function.
6171         (Incremental_inputs::relocs_entsize): New function.
6172         (Output_section_incremental_inputs::set_final_data_size): New function.
6173         (Output_section_incremental_inputs::do_write): New function.
6174         (Output_section_incremental_inputs::write_header): New function.
6175         (Output_section_incremental_inputs::write_input_files): New function.
6176         (Output_section_incremental_inputs::write_info_blocks): New function.
6177         (Output_section_incremental_inputs::write_symtab): New function.
6178         * incremental.h (Incremental_script_entry): Forward declaration.
6179         (Incremental_object_entry): Forward declaration.
6180         (Incremental_archive_entry): Forward declaration.
6181         (Incremental_inputs): Forward declaration.
6182         (Incremental_inputs_header_data): Remove.
6183         (Incremental_inputs_header): Remove.
6184         (Incremental_inputs_header_write): Remove.
6185         (Incremental_inputs_entry_data): Remove.
6186         (Incremental_inputs_entry): Remove.
6187         (Incremental_inputs_entry_write): Remove.
6188         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6189         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6190         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6191         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6192         Likewise.
6193         (Incremental_input_entry): New class.
6194         (Incremental_script_entry): New class.
6195         (Incremental_object_entry): New class.
6196         (Incremental_archive_entry): New class.
6197         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6198         (Incremental_inputs::report_inputs): Remove.
6199         (Incremental_inputs::report_archive): Remove.
6200         (Incremental_inputs::report_archive_begin): New function.
6201         (Incremental_inputs::report_archive_end): New function.
6202         (Incremental_inputs::report_object): Change prototype.
6203         (Incremental_inputs::report_input_section): New function.
6204         (Incremental_inputs::report_script): Change prototype.
6205         (Incremental_inputs::get_reloc_count): New function.
6206         (Incremental_inputs::set_reloc_count): New function.
6207         (Incremental_inputs::create_data_sections): New function.
6208         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6209         (Incremental_inputs::inputs_section): New function.
6210         (Incremental_inputs::symtab_section): New function.
6211         (Incremental_inputs::relocs_section): New function.
6212         (Incremental_inputs::get_stringpool): Add const.
6213         (Incremental_inputs::command_line): Add const.
6214         (Incremental_inputs::inputs): Remove.
6215         (Incremental_inputs::command_line_key): New function.
6216         (Incremental_inputs::input_file_count): New function.
6217         (Incremental_inputs::input_files): New function.
6218         (Incremental_inputs::relocs_entsize): New function.
6219         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6220         (Incremental_inputs::finalize_inputs): Remove.
6221         (Incremental_inputs::Input_info): Remove.
6222         (Incremental_inputs::lock_): Remove.
6223         (Incremental_inputs::inputs_): Change type.
6224         (Incremental_inputs::inputs_map_): Remove.
6225         (Incremental_inputs::current_object_entry_): New data member.
6226         (Incremental_inputs::inputs_section_): New data member.
6227         (Incremental_inputs::symtab_section_): New data member.
6228         (Incremental_inputs::relocs_section_): New data member.
6229         (Incremental_inputs::reloc_count_): New data member.
6230         (Incremental_inputs_reader): New class.
6231         (Incremental_symtab_reader): New class.
6232         (Incremental_relocs_reader): New class.
6233         * layout.cc (Layout::finalize): Move finalization of incremental info
6234         and creation of incremental info sections to follow finalization of
6235         symbol table.  Set offsets for postprocessing sections.
6236         (Layout::create_incremental_info_sections): Call
6237         Incremental_inputs::create_data_sections.  Add incremental symtab
6238         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6239         sections to layout after input sections.
6240         * layout.h (struct Timespec): Forward declaration.
6241         (Layout::incremental_inputs): Add const.
6242         (Layout::create_incremental_info_sections): Add parameter.
6243         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6244         * object.cc: Include incremental.h.
6245         (Relobj::finalize_incremental_relocs): New function.
6246         (Sized_relobj::do_layout): Record input sections in incremental info.
6247         * object.h (Object::output_section): New function.
6248         (Object::output_section_offset): Moved from Relobj.
6249         (Object::get_incremental_reloc_base): New function.
6250         (Object::get_incremental_reloc_count): New function.
6251         (Object::do_output_section): New function.
6252         (Object::do_output_section_offset): Moved from Relobj.
6253         (Object::do_get_incremental_reloc_base): New function.
6254         (Object::do_get_incremental_reloc_count): New function.
6255         (Object::Object): Initialize new data members.
6256         (Relobj::output_section): Renamed do_output_section and moved to
6257         protected.
6258         (Relobj::output_section_offset): Moved to Object.
6259         (Relobj::do_get_incremental_reloc_base): New function.
6260         (Relobj::do_get_incremental_reloc_count): New function.
6261         (Relobj::allocate_incremental_reloc_counts): New function.
6262         (Relobj::count_incremental_reloc): New function.
6263         (Relobj::finalize_incremental_relocs): New function.
6264         (Relobj::next_incremental_reloc_index): New function.
6265         (Relobj::reloc_counts_): New data member.
6266         (Relobj::reloc_bases_): New data member.
6267         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6268         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6269         (Sized_relobj::incremental_relocs_scan): New function.
6270         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6271         (Sized_relobj::incremental_relocs_write): New function.
6272         (Sized_relobj::incremental_relocs_write_reltype): New function.
6273         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6274         incremental link.
6275         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6276         archives and object files elsewhere.
6277         (Add_symbols::run): Report object files here.
6278         (Finish_group::run): Report end of archive at end of group.
6279         * reloc.cc: Include layout.h, incremental.h.
6280         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6281         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6282         (Sized_relobj::incremental_relocs_scan): New function.
6283         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6284         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6285         (Sized_relobj::incremental_relocs_write): New function.
6286         (Sized_relobj::incremental_relocs_write_reltype): New function.
6287         * script.cc (read_input_script): Rewrite test for incremental link.
6288         Change call to Incremental_inputs::report_script.
6289         * symtab.h (Symbol_table::first_global_index): New function.
6290         (Symbol_table::output_count): New function.
6291
6292 2010-08-12  Doug Kwan  <dougkwan@google.com>
6293
6294         * arm.cc (Target_arm::merge_object_attributes): Check command line
6295         options --no-wchar-size-warning and --no-enum-size-warning.
6296         * options.h (General_options): Add ld-compatible options
6297         --no-enum-size-warning and --no-wchar-size-warning.
6298
6299 2010-08-04  Ian Lance Taylor  <iant@google.com>
6300
6301         * x86_64.cc (Target_x86_64::Scan::local): Use
6302         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6303         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6304         (Target_x86_64::Scan::global): Likewise.
6305         (Target_x86_64::Relocate::relocate): Likewise.
6306         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6307         Likewise.
6308
6309 2010-08-03  Cary Coutant  <ccoutant@google.com>
6310
6311         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6312         to reserve space in merged_strings vector. Keep total input size
6313         for stats.
6314         (Output_merge_string::do_print_merge_stats): Print total input size.
6315         * merge.h (Output_merge_string): Add input_size_ field.
6316         * stringpool.cc (Stringpool_template::string_length): Move
6317         implementations out of Stringpool_template class and place in
6318         stringpool.h.
6319         * stringpool.h (string_length): Move out of Stringpool_template.
6320
6321 2010-08-03  Ian Lance Taylor  <iant@google.com>
6322
6323         PR 11712
6324         * layout.cc (relaxation_loop_body): If address of load segment is
6325         set, adjust address to include headers if possible.
6326
6327 2010-08-03  Ian Lance Taylor  <iant@google.com>
6328
6329         * version.cc (version_string): Bump to 1.10.
6330
6331 2010-08-03  Ian Lance Taylor  <iant@google.com>
6332
6333         PR 11805
6334         * layout.h (enum Output_section_order): Define.
6335         (class Layout): Update declarations.
6336         * layout.cc (Layout::get_output_section): Add order parameter.
6337         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6338         is_first_non_relro parameters.  Change all callers.
6339         (Layout::choose_output_section): Likewise.
6340         (Layout::add_output_section_data): Likewise.
6341         (Layout::make_output_section): Likewise.  Set order.
6342         (Layout::default_section_order): New function.
6343         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6344         * output.cc (Output_section::Output_section): Initialize order_.
6345         Don't initialize deleted fields.
6346         (Output_segment::Output_segment): Don't initialize deleted
6347         fields.
6348         (Output_segment::add_output_section_to_load): New function
6349         replacing add_output_section.  Change all callers to call this or
6350         add_output_section_to_nonload.
6351         (Output_segment::add_output_section_to_nonload): New function.
6352         (Output_segment::remove_output_section): Rewrite.
6353         (Output_segment::add_initial_output_data): Likewise.
6354         (Output_segment::has_any_data_sections): Likewise.
6355         (Output_segment::is_first_section_relro): Likewise.
6356         (Output_segment::maximum_alignment): Likewise.
6357         (Output_segment::has_dynamic_reloc): New function replacing
6358         dynamic_reloc_count.  Change all callers.
6359         (Output_segment::has_dynamic_reloc_list): New function replacing
6360         dynamic_reloc_count_list.  Change all callers.
6361         (Output_segment::set_section_addresses): Rewrite.
6362         (Output_segment::set_offset): Rewrite.
6363         (Output_segment::find_first_and_last_list): Remove.
6364         (Output_segment::set_tls_offsets): Rewrite.
6365         (Output_segment::first_section_load_address): Likewise.
6366         (Output_segment::output_section_count): Likewise.
6367         (Output_segment::section_with_lowest_load_address): Likewise.
6368         (Output_segment::write_section_headers): Likewise.
6369         (Output_segment::print_sections_to_map): Likewise.
6370         * output.h (class Output_data): Remove dynamic_reloc_count_
6371         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6372         (Output_data::add_dynamic_reloc): Rewrite.
6373         (Output_data::has_dynamic_reloc): New function.
6374         (Output_data::dynamic_reloc_count): Remove.
6375         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6376         is_last_relro_, is_first_non_relro_, is_interp_,
6377         is_dynamic_linker_section_ fields.  Add order and set_order
6378         functions.  Remove is_relro_local, set_is_relro_local,
6379         is_last_relro, set_is_last_relro, is_first_non_relro,
6380         set_is_first_non_relro functions, is_interp, set_is_interp,
6381         is_dynamic_linker_section, and set_is_dynamic_linker_section
6382         functions.
6383         (class Output_segment): Change Output_data_list from std::list to
6384         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6385         output_bss_ fields.  Update declarations.
6386
6387 2010-08-02  Ian Lance Taylor  <iant@google.com>
6388
6389         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6390         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6391         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6392
6393 2010-08-02  Ian Lance Taylor  <iant@google.com>
6394
6395         PR 11855
6396         * script.cc (Script_options::Script_options): Initialize
6397         symbol_definitions_ and symbol_references_.
6398         (Script_options::add_symbol_assignment): Update
6399         symbol_definitions_ and symbol_references_.
6400         (Script_options::add_symbol_reference): New function.
6401         (script_symbol): New function.
6402         * script.h (class Script_options): Add symbol_definitions_ and
6403         symbol_references_ fields.
6404         (Script_options::referenced_const_iterator): New type.
6405         (Script_options::referenced_begin): New function.
6406         (Script_options::referenced_end): New function.
6407         (Script_options::is_referenced): New function.
6408         (Script_options::any_unreferenced): New function.
6409         * script-c.h (script_symbol): Declare.
6410         * yyscript.y (exp): Call script_symbol.
6411         * symtab.cc: Include "script.h".
6412         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6413         Change all callers.  Check symbols referenced by scripts.
6414         (Symbol_table::add_undefined_symbols_from_command_line): Add
6415         layout parameter.  Change all callers.
6416         (Symbol_table::do_add_undefined_symbols_from_command_line):
6417         Likewise.  Break out loop body.  Check symbols referenced by
6418         scripts.
6419         (Symbol_table::add_undefined_symbol_from_command_line): New
6420         function broken out of
6421         do_add_undefined_symbols_from_command_line.
6422         * symtab.h (class Symbol_table): Update declarations.
6423         * archive.cc: Include "layout.h".
6424         (Archive::should_include_member): Add layout parameter.  Change
6425         all callers.  Check for symbol mentioned in expression.
6426         * archive.h (class Archive): Update declaration.
6427         * object.cc (Sized_relobj::do_should_include_member): Add layout
6428         parameter.
6429         * object.h (Object::should_include_member): Add layout parameter.
6430         Change all callers.
6431         (Object::do_should_include_member): Add layout parameter.
6432         (class Sized_relobj): Update declaration.
6433         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6434         parameter.
6435         * dynobj.h (class Sized_dynobj): Update declaration.
6436         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6437         layout parameter.
6438         * plugin.h (class Sized_pluginobj): Update declaration.
6439
6440 2010-08-02  Ian Lance Taylor  <iant@google.com>
6441
6442         PR 11866
6443         * output.cc (Output_segment::set_offset): Search for the first and
6444         last sections rather than assuming that the list is in order.
6445         (Output_segment::find_first_and_last_list): New function.
6446         * output.h (class Output_segment): Update declarations.
6447         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6448         (relro_strip_test_SOURCES): New variable.
6449         (relro_strip_test_DEPENDENCIES): New variable.
6450         (relro_strip_test_LDFLAGS): New variable.
6451         (relro_strip_test_LDADD): New variable.
6452         (relro_strip_test.so): New target.
6453
6454 2010-08-02  Ian Lance Taylor  <iant@google.com>
6455
6456         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6457         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6458         (Target_i386::got_tlsdesc_section): New function.
6459         (Target_i386::got_section): Create space for GOT entries for
6460         TLSDESC relocations.
6461         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6462         R_386_TLS_GOTDESC.
6463         (Target_i386::Scan::global): Likewise.
6464         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6465         using TLSDESC GOT.
6466         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6467         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6468         (Target_x86_64::got_tlsdesc_section): New function.
6469         (Target_x86_64::got_section): Create space for GOT entries for
6470         TLSDESC relocations.
6471         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6472         R_386_TLS_GOTDESC.
6473         (Target_x86_64::Scan::global): Likewise.
6474         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6475         using TLSDESC GOT.
6476
6477 2010-08-02  Ian Lance Taylor  <iant@google.com>
6478
6479         * testsuite/final_layout.sh: Use dc to convert from hex to
6480         decimal.
6481
6482 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6483
6484         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6485         paramter to the call to gold::gc_process_relocs.
6486         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6487         paramter to the call to gold::gc_process_relocs.
6488         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6489         parameter to the call to gold::gc_process_relocs.
6490         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6491         template parameter to the call to gold::gc_process_relocs.
6492         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6493         paramter to the call to gold::gc_process_relocs.
6494         * gc.h (get_embedded_addend_size): New function.
6495         (gc_process_relocs): Save the size of the reloc for use by ICF.
6496         * icf.cc (get_section_contents): Get the addend from the text section
6497         for SHT_REL relocation sections.
6498         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6499         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6500         * int_encoding.h (read_from_pointer): New overloaded function.
6501         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6502         * testsuite/icf_sht_rel_addend_test.sh: New file.
6503         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6504         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6505
6506 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6507
6508         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6509         * Makefile.in: Regenerate.
6510         * testsuite/Makefile.in: Regenerate.
6511
6512 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6513
6514         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6515         * gold/testsuite/debug_msg.cc: Likewise.
6516         * gold/testsuite/odr_violation1.cc
6517         * gold/testsuite/odr_violation2.cc
6518
6519 2010-07-21  Cary Coutant  <ccoutant@google.com>
6520
6521         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6522         string, and length fields.
6523         (Output_merge_string::Merged_strings_list): New type.
6524         (Output_merge_string::Merged_strings_lists): New typedef.
6525         (Output_merge_string): Replace merged_strings_ with
6526         merged_strings_lists_.
6527         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6528         Merged_strings_list per input object and section.  Don't store pointer
6529         to the string.  Don't store length with each merged string entry.
6530         (Output_merge_string::finalize_merged_data): Loop over list of merged
6531         strings lists.  Recompute length of each merged string.
6532
6533 2010-07-15  Cary Coutant  <ccoutant@google.com>
6534
6535         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6536         here.
6537
6538 2010-07-14  Ian Lance Taylor  <iant@google.com>
6539
6540         * descriptors.cc (Descriptors::open): Report correct name in error
6541         message.
6542
6543 2010-07-13  Doug Kwan  <dougkwan@google.com>
6544
6545         * arm.cc (Arm_input_section::Arm_input_section): For a
6546         SHT_ARM_EXIDX section, always keeps the input sections.
6547         (Arm_input_section::set_exidx_section_link): New method.
6548         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6549         has_errors_ to false.
6550         (Arm_exidx_input_section::has_errors,
6551         Arm_exidx_input_section::set_has_errors): New methods.
6552         (Arm_exidx_input_section::has_errors_): New data member.
6553         (Arm_relobj::get_exidx_shndx_list): New method.
6554         (Arm_output_section::append_text_sections_to_list): Do not skip
6555         section without SHF_EXECINSTR.
6556         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6557         errors.
6558         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6559         section header.  Make error messages more verbose.  Check for
6560         a non-executable section linked to an EXIDX section.
6561         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6562         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6563         check that there is no deferred EXIDX section if we exit early.
6564         Instead of not making an EXIDX section in case of an error, make one
6565         and set the has_errors flag of it.
6566         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6567         in a relocatable link.
6568         (Target_arm::do_relax): Look for the EXIDX output section instead of
6569         assuming that it is called .ARM.exidx.
6570         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6571         section list.  Do not check for SHF_EXECINSTR section flags but
6572         skip any input section with errors.
6573         * output.cc (Output_section::Output_section): Initialize
6574         always_keeps_input_sections_ to false.
6575         (Output_section::add_input_section): Check for
6576         always_keeps_input_sections_.
6577         *  output.h (Output_section::always_keeps_input_sections,
6578         Output_section::set_always_keeps_input_sections): New methods.
6579         (Output_section::always_keeps_input_sections): New data member.
6580
6581 2010-07-13  Rafael Espindola  <espindola@google.com>
6582
6583         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6584         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6585
6586 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6587             Ian Lance Taylor  <iant@google.com>
6588
6589         * output.h (Output_section_lookup_maps::add_merge_section):
6590         Correct check of whether value was inserted.
6591         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6592         (Output_section_lookup_maps::add_relaxed_input_section):
6593         Likewise.
6594         * arm.cc (Target_arm::got_section): Remove used local os.
6595         * i386.cc (Target_i386::got_section): Likewise.
6596         * x86_64.cc (Target_x86_64::got_section): Likewise.
6597         * sparc.cc (Target_sparc::got_section): Likewise.
6598         (Target_sparc::relocate): Remove unused local have_got_offset.
6599         * powerpc.cc (Target_powerpc::relocate): Likewise.
6600
6601 2010-07-13  Ian Lance Taylor  <iant@google.com>
6602
6603         * compressed_output.cc (zlib_decompress): Fix signature in
6604         !HAVE_ZLIB_H case.
6605
6606         * archive.cc (Archive::include_member): Unlock an external member
6607         of a thin archive.  Don't bother to delete an object we know is
6608         NULL.
6609
6610 2010-07-12  Cary Coutant  <ccoutant@google.com>
6611
6612         * compressed_output.cc (zlib_decompress): New function.
6613         (get_uncompressed_size): New function.
6614         (decompress_input_section): New function.
6615         * compressed_output.h (get_uncompressed_size): New function.
6616         (decompress_input_section): New function.
6617         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6618         Handle compressed debug sections.
6619         * layout.cc (is_compressed_debug_section): New function.
6620         (Layout::output_section_name): Map compressed section names to
6621         canonical names.
6622         * layout.h (is_compressed_debug_section): New function.
6623         (is_debug_info_section): Recognize compressed debug sections.
6624         * merge.cc: Include compressed_output.h.
6625         (Output_merge_data::do_add_input_section): Handle compressed
6626         debug sections.
6627         (Output_merge_string::do_add_input_section): Handle compressed
6628         debug sections.
6629         * object.cc: Include compressed_output.h.
6630         (Sized_relobj::Sized_relobj): Initialize new data members.
6631         (build_compressed_section_map): New function.
6632         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6633         * object.h (Object::section_is_compressed): New method.
6634         (Object::do_section_is_compressed): New method.
6635         (Sized_relobj::Compressed_section_map): New type.
6636         (Sized_relobj::do_section_is_compressed): New method.
6637         (Sized_relobj::compressed_sections_): New data member.
6638         * output.cc (Output_section::add_input_section): Handle compressed
6639         debug sections.
6640         * reloc.cc: Include compressed_output.h.
6641         (Sized_relobj::write_sections): Handle compressed debug sections.
6642
6643 2010-07-08  Cary Coutant  <ccoutant@google.com>
6644
6645         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6646         weak when resolving to a dynamic def.
6647         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6648         for weak undef/dynamic def cases. Adjust callers.
6649         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6650         undef_binding_weak_.
6651         (Symbol_table::sized_write_globals): Adjust symbol binding.
6652         (Symbol_table::sized_write_symbol): Add binding parameter.
6653         * symtab.h (Symbol::set_undef_binding): New method.
6654         (Symbol::is_undef_binding_weak): New method.
6655         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6656         (Symbol_table::should_override): Add new parameter.
6657         (Symbol_table::sized_write_symbol): Add new parameter.
6658
6659         * testsuite/weak_undef_file1.cc: Add new test case.
6660         * testsuite/weak_undef_file2.cc: Fix header comment.
6661         * testsuite/weak_undef_test.cc: Add new test case.
6662
6663 2010-06-29  Doug Kwan  <dougkwan@google.com>
6664
6665         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6666         Initialize USE_SYMBOL_.
6667         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6668         definition.
6669         (Arm_reloc_property::uses_symbol_): New data member declaration.
6670         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6671         uses symbol value and symbol is undefined but not weakly undefined.
6672
6673 2010-06-28  Rafael Espindola  <espindola@google.com>
6674
6675         * plugin.cc (Plugin::load): Use dlerror.
6676
6677 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6678
6679         * symtab.cc (detect_odr_violations): When reporting an ODR
6680         violation, report an object where the symbol is defined.
6681
6682 2010-06-25  Doug Kwan  <dougkwan@google.com>
6683
6684         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6685         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6686         definition.
6687         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6688         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6689         target hook to detect function points.
6690         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6691         * icf.h (Icf::check_section_for_function_pointers): Change type of
6692         parameter SECTION_NAME to const reference to std::string.  Use
6693         target hook to determine if section may have unsafe pointers.
6694         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6695         method definition.
6696
6697 2010-06-21  Rafael Espindola  <espindola@google.com>
6698
6699         * fileread.cc (Input_file::find_fie): New
6700         (Input_file::open): Use Input_file::find_fie.
6701         * fileread.h (Input_file::find_fie): New
6702         * plugin.cc (set_extra_library_path): New.
6703         (Plugin::load): Add set_extra_library_path to the transfer vector.
6704         (Plugin_manager::set_extra_library_path): New.
6705         (Plugin_manager::add_input_file): Use the extra search path if set.
6706         (set_extra_library_path(): New.
6707         * plugin.h (Plugin_manager): Add set_extra_library_path and
6708         extra_search_path_.
6709
6710 2010-06-19  Cary Coutant  <ccoutant@google.com>
6711
6712         * layout.cc (gdb_sections): Add .debug_types.
6713         (lines_only_debug_sections): Likewise.
6714
6715 2010-06-18  Rafael Espindola  <espindola@google.com>
6716
6717         * plugin.cc (add_input_file,add_input_library)
6718         (Plugin_manager::add_input_file): Make filename arguments const.
6719         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6720         const.
6721
6722 2010-06-16  Doug Kwan  <dougkwan@google.com>
6723
6724         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6725         .ARM.attributes section if we have not merged any input
6726         attributes sections.
6727
6728 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6729
6730         * arm.cc: Allow combining objects with no EABI version
6731         information.
6732
6733 2010-06-15  Rafael Espindola  <espindola@google.com>
6734
6735         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6736
6737 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6738
6739         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6740         (struct iovec): Correct !HAVE_READV definition.
6741
6742 2010-06-10  Cary Coutant  <ccoutant@google.com>
6743
6744         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6745         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6746         reloc sections.
6747         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6748
6749         PR 11683
6750         * symtab.h (Symbol::is_placeholder): New member function.
6751         * target-reloc.h (relocate_section): Check for placeholder symbols.
6752
6753         * testsuite/Makefile.am (plugin_test_8): New test.
6754         (plugin_test_9): New test.
6755         * testsuite/Makefile.in: Regenerate.
6756
6757 2010-06-09  Nick Clifton  <nickc@redhat.com>
6758
6759         * yyscript.y (input_list_element): Allow strings prefixed with
6760         the '-' character.  Treat these as libraries.
6761         * script.cc (script_add_library): New function.  Adds a library
6762         specified by "-l<name>" found in an input script.
6763         * script-c.h: Add prototype for script_add_library.
6764
6765 2010-06-07  Doug Kwan  <dougkwan@google.com>
6766
6767         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6768         Restrict stub-group size to be within long conditional branch
6769         range when working around cortex-A8 erratum.
6770
6771 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6772
6773         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6774         #ifdef typo.
6775
6776 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6777
6778         PR gold/11658
6779         * output.cc
6780         (Output_section::Input_section_sort_entry::compare_section_ordering):
6781         Change to return non-zero correctly.
6782         (Output_section::Input_section_sort_section_order_index_compare
6783         ::operator()): Change to fix ambiguity in comparisons.
6784
6785 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6786
6787         * gold.h (is_wildcard_string): New function.
6788         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6789         (Layout::layout_eh_frame): Ditto.
6790         (Layout::find_section_order_index): New method.
6791         (Layout::read_layout_from_file): New method.
6792         * layout.h (Layout::find_section_order_index): New method.
6793         (Layout::read_layout_from_file): New method.
6794         (Layout::input_section_position_): New private member.
6795         (Layout::input_section_glob_): New private member.
6796         * main.cc (main): Call read_layout_from_file here.
6797         * options.h (--section-ordering-file): New option.
6798         * output.cc (Output_section::input_section_order_specified_): New
6799         member.
6800         (Output_section::Output_section): Initialize new member.
6801         (Output_section::add_input_section): Add new parameter.
6802         Keep input sections when --section-ordering-file is used.
6803         (Output_section::set_final_data_size): Sort input sections when
6804         section ordering file is specified.
6805         (Output_section::Input_section_sort_entry): Add new parameter.
6806         Check sorting type.
6807         (Output_section::Input_section_sort_entry::compare_section_ordering):
6808         New method.
6809         (Output_section::Input_section_sort_compare::operator()): Change to
6810         consider section_order_index.
6811         (Output_section::Input_section_sort_init_fini_compare::operator()):
6812         Change to consider section_order_index.
6813         (Output_section::Input_section_sort_section_order_index_compare
6814         ::operator()): New method.
6815         (Output_section::sort_attached_input_sections): Change to sort
6816         according to section order when specified.
6817         (Output_section::add_input_section<32, true>): Add new parameter.
6818         (Output_section::add_input_section<64, true>): Add new parameter.
6819         (Output_section::add_input_section<32, false>): Add new parameter.
6820         (Output_section::add_input_section<64, false>): Add new parameter.
6821         * output.h (Output_section::add_input_section): Add new parameter.
6822         (Output_section::input_section_order_specified): New
6823         method.
6824         (Output_section::set_input_section_order_specified): New method.
6825         (Input_section::Input_section): Initialize section_order_index_.
6826         (Input_section::section_order_index): New method.
6827         (Input_section::set_section_order_index): New method.
6828         (Input_section::section_order_index_): New member.
6829         (Input_section::Input_section_sort_section_order_index_compare): New
6830         struct.
6831         (Output_section::input_section_order_specified_): New member.
6832         * script-sections.cc (is_wildcard_string): Delete and move modified
6833         method to gold.h.
6834         (Output_section_element_input::Output_section_element_input): Modify
6835         call to is_wildcard_string.
6836         (Output_section_element_input::Input_section_pattern
6837         ::Input_section_pattern): Ditto.
6838         (Output_section_element_input::Output_section_element_input): Ditto.
6839         * testsuite/Makefile.am (final_layout): New test case.
6840         * testsuite/Makefile.in: Regenerate.
6841         * testsuite/final_layout.cc: New file.
6842         * testsuite/final_layout.sh: New file.
6843
6844 2010-06-01  Rafael Espindola  <espindola@google.com>
6845
6846         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6847
6848 2010-06-01  Rafael Espindola  <espindola@google.com>
6849
6850         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6851         visibility of symbols.
6852
6853 2010-05-27  Doug Kwan  <dougkwan@google.com>
6854
6855         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6856         from start of output section instead of address for a local symbol
6857         in a merged or relaxed section when doing a relocatable link.
6858
6859 2010-05-26  Rafael Espindola  <espindola@google.com>
6860
6861         PR 11604
6862         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6863         adding sections the garbage collector removed.
6864         * gold/testsuite/Makefile.am: Add test.
6865         * gold/testsuite/Makefile.in: Regenerate.
6866         * gold/testsuite/plugin_test_7.sh: New.
6867         * gold/testsuite/plugin_test_7_1.c: New.
6868         * gold/testsuite/plugin_test_7_2.c: New.
6869
6870 2010-05-26  Rafael Espindola  <espindola@google.com>
6871
6872         * script-sections.cc (Output_section_definition::set_section_addresses):
6873         Check for --section-start.
6874
6875 2010-05-26  Doug Kwan  <dougkwan@google.com>
6876
6877         * arm.cc (Arm_scan_relocatable_relocs): New class.
6878         (Target_arm::relocate_special_relocatable): New method.
6879         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6880         (Arm_relocate_functions::thumb_branch_common): Same.
6881         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6882         instead of Default_scan_relocatable_relocs.
6883         * target-reloc.h (relocate_for_relocatable): Let target handle
6884         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6885         * target.h (Sized_target::relocate_special_relocatable): New method.
6886
6887 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6888
6889         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6890
6891 2010-05-23  Doug Kwan  <dougkwan@google.com>
6892
6893         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6894         instead of a cast.
6895         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6896         with a direct branch, not a conditional branch, to a stub.
6897         * merge.cc (Output_merge_base::record_input_section): New method
6898         defintion.
6899         (Output_merge_data::do_add_input_section): Record input section if
6900         keeps-input-sections flag is set.
6901         (Output_merge_string::do_add_input_section): Ditto.
6902         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6903         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6904         INPUT_SECTIONS_.
6905         (Output_merge_base::keeps_input_sections,
6906         Output_merge_base::set_keeps_input_sections,
6907         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6908         method definitions.
6909         (Output_merge_base::Input_sections): New type declaration.
6910         (Output_merge_base::input_sections_begin,
6911         Output_merge_base::input_sections_end,
6912         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6913         (Output_merge_base::bool keeps_input_sections_,
6914         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6915         Output_merge_base::input_sections_): New data members.
6916         (Output_merge_data::do_set_keeps_input_sections): New method
6917         defintion.
6918         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6919         * output.cc (Output_section::Input_section::relobj): Move method
6920         defintion from class declaration to here and handle merge sections.
6921         (Output_section::Input_section::shndx): Ditto.
6922         (Output_section::Output_section): Remove initializations of removed
6923         data members and initialize new data member LOOKUP_MAPS_.
6924         (Output_section::add_input_section): Set keeps-input-sections flag
6925         for a newly created merge output section as appropriate.  Adjust code
6926         to use Output_section_lookup_maps class.
6927         (Output_section::add_relaxed_input_section): Adjst code for lookup
6928         maps code refactoring.
6929         (Output_section::add_merge_input_section): Add a new parameter
6930         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6931         class.  If adding input section to a newly created merge output
6932         section fails, remove the new merge section.
6933         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6934         Adjust code for use of the Output_section_lookup_maps class.
6935         (Output_section::find_merge_section): Ditto.
6936         (Output_section::build_lookup_maps): New method defintion.
6937         (Output_section::find_relaxed_input_section): Adjust code to use
6938         Output_section_lookup_maps class.
6939         (Output_section::get_input_sections): Export merge sections.  Adjust
6940         code to use Output_section_lookup_maps class.
6941         (Output_section:::add_script_input_section): Adjust code to use
6942         Output_section_lookup_maps class.  Update lookup maps for merge
6943         sections also.
6944         (Output_section::discard_states): Use Output_section_lookup_maps.
6945         (Output_section::restore_states): Same.
6946         * output.h (Merge_section_properties): Move class defintion out of
6947         Output_section.
6948         (Output_section_lookup_maps): New class.
6949         (Output_section::Input_section::is_merge_section): New method
6950         defintion.
6951         (Output_section::Input_section::relobj): Move defintion out of class
6952         defintion.  Declare method only.
6953         (Output_section::Input_section::shndx): Ditto.
6954         (Output_section::Input_section::output_merge_base): New method defintion.
6955         (Output_section::Input_section::u2_.pomb): New union field.
6956         (Output_section::Merge_section_by_properties_map,
6957         Output_section::Output_section_data_by_input_section_map,
6958         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6959         Remove types.
6960         (Output_section::add_merge_input_section): Add new parameter
6961         KEEPS_INPUT_SECTIONS.
6962         (Output_section::build_lookup_maps): New method declaration.
6963         (Output_section::merge_section_map_,
6964         Output_section::merge_section_by_properties_map_,
6965         Output_section::relaxed_input_section_map_,
6966         Output_section::is_relaxed_input_section_map_valid_): Remove data
6967         members.
6968         (Output_section::lookup_maps_): New data member.
6969
6970 2010-05-21  Doug Kwan  <dougkwan@google.com>
6971
6972         PR gold/11619
6973         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6974         avoid a compilation error.
6975
6976 2010-05-19  Rafael Espindola  <espindola@google.com>
6977
6978         * script-sections.cc (Output_section_definition::allocate_to_segment):
6979         Update the phdrs_list even when the output section is NULL.
6980         * testsuite/Makefile.am: Add test.
6981         * testsuite/Makefile.in: Regenerate.
6982         * testsuite/script_test_9.cc: New.
6983         * testsuite/script_test_9.sh: New.
6984         * testsuite/script_test_9.t: New.
6985
6986 2010-05-19  Doug Kwan  <dougkwan@google.com>
6987
6988         * arm.cc (Arm_input_section::original_size): New method.
6989         (Arm_input_section::do_addralign): Add a cast.
6990         (Arm_input_section::do_output_offset): Remove static cast.
6991         (Arm_input_section::original_addralign,
6992          Arm_input_section::original_size_): Change type to uint32_t.
6993         (Arm_input_section::init): Add safe casts for section alignment
6994         and size.
6995         (Arm_input_section::set_final_data_size): Do not set address and
6996         offset of stub table.
6997         (Arm_output_section::fix_exidx_coverage): Change use of of
6998         Output_section::Simple_input_section to that of
6999         Output_section::Input_section.
7000         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7001         except for the first pass.
7002         * output.cc (Output_section::get_input_sections): Change type of
7003         input_sections to std::list<Input_section>.
7004         (Output_section::add_script_input_section): Rename from
7005         Output_section::add_simple_input_section.  Change type of SIS
7006         parameter from Simple_input_section to Input_section.
7007         * output.h (Output_section::Simple_input_section): Remove class.
7008         (Output_section::Input_section): Change class visibility to public.
7009         (Output_section::Input_section::addralign): Use stored alignments
7010         for special input sections if set.
7011         (Output_section::Input_section::set_addralign): New method.
7012         (Output_section::get_input_sections): Change parameter type from
7013         list of Simple_input_section to list of Input_section.
7014         (Output_section::add_script_input_section): Rename from
7015         Output_section::add_simple_input_section. Change first parameter's
7016         type from Simple_input_section to Input_section and remove the
7017         second and third parameters.
7018         * script-sections.cc (Input_section::Input_section_list): Change
7019         type to list of Output_section::Input_section/
7020         (Input_section_info::Input_section_info): Change parameter type of
7021         INPUT_SECTION to Output_section::Input_section.
7022         (Input_section_info::input_section): Change return type.
7023         (Input_section_info::input_section_): Change type to
7024         Output_section::Input_section.
7025         (Output_section_element_input::set_section_addresses): Adjust code
7026         to use Output_section::Input_section instead of
7027         Output_section::Simple_input_section.  Adjust code for renaming
7028         of Output_section::add_simple_input_section.
7029         (Orphan_output_section::set_section_addresses): Ditto.
7030
7031 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7032
7033         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7034         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7035
7036 2010-05-18  Rafael Espindola  <espindola@google.com>
7037
7038         * options.cc (General_options::finalize): Handle -nostdlib.
7039         * options.h (nostdlib): New option.
7040         * script.cc (script_add_search_dir): Handle -nostdlib.
7041
7042 2010-05-12  Doug Kwan  <dougkwan@google.com>
7043
7044         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7045         attributes section only if there no attributes section after merging.
7046         (Target_arm::merge_object_attributes): Move value of
7047         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7048         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7049         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7050         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7051         and arm_attr_merge_7.stdout.
7052         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7053         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7054         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7055         arm_attr_merge_7b.o): New rules.
7056         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7057         arm_attr_merge_7
7058         * testsuite/Makefile.in: Regenerate.
7059         * testsuite/arm_attr_merge.sh: New file.
7060         * testsuite/arm_attr_merge_[67][ab].s: Same.
7061
7062 2010-05-05  Nick Clifton  <nickc@redhat.com>
7063
7064         * po/es.po: Updated Spanish translation.
7065
7066 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7067
7068         * Makefile.am (install-exec-local): Properly install gold as
7069         default cross linker.
7070         * Makefile.in: Regenerated.
7071
7072 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7073             Nick Clifton  <nickc@redhat.com>
7074
7075         * configure.ac (install_as_default): Define and set to false
7076         unless --enable-gold or --enable-gold=both/gold has been
7077         specified.
7078         * configure: Regenerate.
7079
7080         * Makefile.am (install-exec-local): Install the executable as
7081         'ld.gold'.  If install_as_default is true then also install it as
7082         'ld'.
7083         * Makefile.in: Regenerated.
7084
7085 2010-04-24  Ian Lance Taylor  <iant@google.com>
7086
7087         * layout.cc (Layout::layout_reloc): In relocatable link don't
7088         combine reloc sections for grouped sections.
7089
7090 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7091
7092         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7093         sections that are not ordinary to icf.
7094         * icf.cc (get_section_contents): Handle relocation pointing to section
7095         with no object or shndx information.
7096         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7097         * testsuite/Makefile.in: Regenerate.
7098         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7099         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7100
7101 2010-04-22  Ian Lance Taylor  <iant@google.com>
7102
7103         * expression.cc (Expression::Expression_eval_info): Add
7104         result_alignment_pointer field.
7105         (Expression::eval_with_dot): Add result_alignment_pointer
7106         parameter.  Change all callers.
7107         (Expression::eval_maybe_dot): Likewise.
7108         (class Binary_expression): Add alignment_pointer parameter to
7109         left_value and right_value.  Change all callers.
7110         (BINARY_EXPRESSION): Set result alignment.
7111         (class Trinary_expression): Add alignment_pointer parameter to
7112         arg2_value and arg3_value.  Change all callers.
7113         (Trinary_cond::value): Set result alignment.
7114         (Max_expression::value, Min_expression::value): Likewise.
7115         (Align_expression::value): Likewise.
7116         * script-sections.cc (class Sections_element): Add dot_alignment
7117         parameter to set_section_addresses virtual function.  Update
7118         instantiations.
7119         (class Output_section_element): Likewise.
7120         (Script_sections::create_segments): Add dot_alignment parameter.
7121         Change all callers.
7122         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7123         (Script_sections::set_phdrs_clause_addresses): Likewise.
7124         * script-sections.h: Update declarations.
7125         * script.h: Update declarations.
7126         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7127         min_p_align.
7128         * testsuite/script_test_3.t: Set large alignment.
7129         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7130         segment has expected alignment.
7131
7132 2010-04-22  Nick Clifton  <nickc@redhat.com>
7133
7134         * po/gold.pot: Updated by the Translation project.
7135         * po/vi.po: Updated Vietnamese translation.
7136
7137 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7138
7139         * testsuite/Makefile.am (check_PROGRAMS): Add
7140         icf_virtual_function_folding_test.
7141         * testsuite/Makefile.in: Regenerated.
7142
7143 2010-04-15  Andrew Haley  <aph@redhat.com>
7144
7145         * options.h (merge_exidx_entries): New option.
7146         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7147         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7148         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7149         (Target_arm::merge_exidx_entries): New function.
7150         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7151         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7152         to Arm_exidx_fixup constructor.
7153         Add new arg, merge_exidx_entries.
7154         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7155         Arm_output_section::fix_exidx_coverage.
7156
7157 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7158
7159         * icf.cc (get_section_contents): Check for preemptible functions.
7160         Ignore addend when appropriate.
7161         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7162         section folded.
7163         (add_from_relobj): Check for section folded.
7164         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7165         * symtab.h (should_add_dynsym_entry): Add new parameter.
7166         * target-reloc.h (scan_relocs): Check for section folded.
7167         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7168         Check reloc types for function pointers in shared objects.
7169         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7170         case.
7171         (icf_preemptible_functions_test): New test case.
7172         (icf_string_merge_test): New test case.
7173         * testsuite.Makefile.in: Regenerate.
7174         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7175         bar_glob.  Refactor code.
7176         * testsuite/icf_preemptible_functions_test.cc: New file.
7177         * testsuite/icf_preemptible_functions_test.sh: New file.
7178         * testsuite/icf_string_merge_test.cc: New file.
7179         * testsuite/icf_string_merge_test.sh: New file.
7180         * testsuite/icf_virtual_function_folding_test.cc: New file.
7181         * testsuite/icf_virtual_function_folding_test.sh: New file.
7182
7183 2010-04-14  Doug Kwan  <dougkwan@google.com>
7184
7185         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7186         for local symbol recounting if we remove a section due to ICF.
7187         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7188         there are no regular objects in input.
7189
7190 2010-04-13  Doug Kwan  <dougkwan@google.com>
7191
7192         * arm.cc (Arm_input_section::set_final_data_size): Compute
7193         accurate final data size instead of using current data size.
7194
7195 2010-04-09  Doug Kwan  <dougkwan@google.com>
7196
7197         * layout.cc (Layout::choose_output_section): Handle script section
7198         types.
7199         (Layout::make_output_section_for_script): Add section type parameter.
7200         Handle script section types.
7201         * layout.h (Layout::make_output_section_for_script): Add section
7202         type parameter.
7203         * output.cc (Output_section::Output_section): Initialize data member
7204         is_noload_.
7205         (Output_section::do_reset_address_and_file_offset): Do not set address
7206         to 0 if section is a NOLOAD section.
7207         * output.h (Output_section::is_noload): New method.
7208         (Output_section::set_is_noload): Ditto.
7209         (Output_section::is_noload_): New data member.
7210         * script-c.h (Script_section_type): New enum type.
7211         (struct Parser_output_section_header): Add new file section_type.
7212         * script-sections.cc (Sections_element::output_section_name): Add
7213         parameter for returning script section type.
7214         (Output_section_definition::output_section_name): Ditto.
7215         (Output_section_definition::section_type)P; New method.
7216         (Output_section_definiton::script_section_type_name): Ditto.
7217         (Output_section_definition::script_section_type_): New data member.
7218         (Output_section_definition::Output_section_definition): Initialize
7219         data member Output_section_definition::script_section_type_.
7220         (Output_section_definition::create_sections): Pass script section type
7221         to Layout::make_output_section_for_script.
7222         (Output_section_definition::output_section_name): Return script
7223         section type to caller.
7224         (Output_section_definition::set_section_address): Do not advance
7225         dot value and load address if section type is NOLOAD.  Set address
7226         of NOLOAD sections regardless of section flags.
7227         (Output_section_definition::print): Print section type if it is
7228         not SCRIPT_SECTION_TYPE_NONE.
7229         (Output_section_definition::section_type): New method.
7230         (Output_section_definition::script_section_type_name): Ditto.
7231         (Script_sections::output_section_name): Add new parameter
7232         PSECTION_TYPE for returning script section type.  Pass it to
7233         section elements.  Handle discard sections.
7234         (Sort_output_sections::operator()): Handle NOLOAD sections.
7235         * script-sections.h (Script_sections::Section_type): New enum type.
7236         (Script_sections::output_section_name): Add a new parameter for
7237         returning script section type.
7238         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7239         INFO and NOLOAD.
7240         * yyscript.y (union): Add new field SECTION_TYPE.
7241         (COPY, DSECT, INFO, NOLOAD): New tokens.
7242         (opt_address_and_section_type): Change type to output_section_header.
7243         (section_type): New non-terminal
7244         (section_header): Handle section type.
7245         (opt_address_and_section_type): Return section type value.
7246
7247 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7248
7249         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7250         * testsuite/plugin_common_test_2.c (foo): Likewise.
7251
7252 2010-04-08  Doug Kwan  <dougkwan@google.com>
7253
7254         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7255         Output_merge_data.
7256         * output.cc (Output_section::add_merge_input_section): Simplify
7257         code and return status of Output_merge_base::add_input_section.
7258         Update merge section map only if Output_merge_base::add_input_section
7259         returns true.
7260
7261 2010-04-07  Doug Kwan  <dougkwan@google.com>
7262
7263         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7264         if section is marked as containing instructions but has no mapping
7265         symbols.
7266         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7267         correct section index.
7268         (Arm_relobj::find_linked_text_section): Ditto.
7269
7270 2010-04-07  Cary Coutant  <ccoutant@google.com>
7271
7272         * archive.cc (include_member): Destroy Read_symbols_data object before
7273         releasing file.
7274         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7275         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7276         (Read_symbols_data::~Read_symbols_data) New destructor.
7277         (Section_relocs::Section_relocs) New constructor.
7278         (Section_relocs::~Section_relocs) New destructor.
7279         (Read_relocs_data::Read_relocs_data) New constructor.
7280         (Read_relocs_data::~Read_relocs_data) New destructor.
7281         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7282         pointers to NULL after deleting.
7283
7284 2010-04-07  Doug Kwan  <dougkwan@google.com>
7285
7286         * arm.cc: Replace "endianity" with "endianness" in comments.
7287         (Arm_exidx_cantunwind): Ditto.
7288         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7289         (Arm_relobj::merge_flags_and_attributes): New method.
7290         (Arm_relobj::merge_flags_and_attributes_): New data member.
7291         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7292         (Arm_relobj::scan_sections_for_stubs): Ditto.
7293         (Arm_relobj::do_read_symbols): Check to see if we really want to
7294         merge processor-specific flags and attributes.  Exit early if
7295         an object is empty except for section names and the undefined symbol.
7296         (Target_arm::do_finalize_sections): Move check for ELF format to
7297         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7298         attributes from a regular object only when we have determined that
7299         it is aapropriate.  Do not create an .ARM.attributes section in
7300         output if there is no regular input object.
7301         (Target_arm::merge_processor_specific_flags): Check
7302         --warn-mismatch before printing any error.
7303         (Target_arm::merge_object_attributes): Ditto.
7304         * gold.cc (queue_middle_tasks): Handle the case in which there is
7305         no regular object in input.
7306         * options.cc (General_options::parse_EB): New method.
7307         (General_options::parse_EL): Same.
7308         (General_options::General_options): Initialize endianness_.
7309         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7310         New options.
7311         (General_options::Endianness): New enum.
7312         (General_options::endianness): New method.
7313         (General_options::endianness_): New data member.
7314         * parameters.cc (Parameters::set_options): Check target endianness.
7315         (Parameters::set_target_once): Ditto.
7316         (Parameters::check_target_endianness): New method.
7317         (parameters_force_valid_target): If either -EL or -EB is specified,
7318         use it to define endianness of default target.
7319         * parameters.h (Parameters::check_target_endianness): New method
7320         declaration.
7321         * target.h (class Target): Change "endianity" to "endianness"
7322         in comments.
7323
7324 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7325
7326         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7327         * configure: Regenerate.
7328         * Makefile.in: Regenerate.
7329         * testsuite/Makefile.in: Regenerate.
7330
7331 2010-04-06  Cary Coutant  <ccoutant@google.com>
7332
7333         gcc PR lto/42757
7334         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7335         prevailing definitions of common symbols.
7336         * testsuite/plugin_test_6.sh: New test case.
7337         * testsuite/plugin_common_test_1.c: New test case.
7338         * testsuite/plugin_common_test_2.c: New test case.
7339         * testsuite/Makefile.am (plugin_test_6): New test case.
7340         * testsuite/Makefile.in: Regenerate.
7341
7342 2010-04-06  Nick Clifton  <nickc@redhat.com>
7343
7344         * po/vi.po: New Vietnamese translation.
7345
7346 2010-03-30  Doug Kwan  <dougkwan@google.com>
7347
7348         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7349
7350 2010-03-25  Doug Kwan  <dougkwan@google.com>
7351
7352         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7353         to avoid a conversion warning on a 32-bit host.
7354
7355 2010-03-24  Ian Lance Taylor  <iant@google.com>
7356
7357         * testsuite/script_test_3.t: Add a TLS segment.
7358         * testsuite/Makefile.am (check_PROGRAMS): Add
7359         tls_phdrs_script_test.
7360         (tls_phdrs_script_test_SOURCES): Define.
7361         (tls_phdrs_script_test_DEPENDENCIES): Define.
7362         (tls_phdrs_script_test_LDFLAGS): Define.
7363         (tls_phdrs_script_test_LDADD): Define.
7364         * testsuite/Makefile.in: Rebuild.
7365
7366 2010-03-23  Cary Coutant  <ccoutant@google.com>
7367
7368         * fileread.cc (find_or_make_view): Fix comment.
7369
7370 2010-03-23  Ian Lance Taylor  <iant@google.com>
7371
7372         * script-sections.cc (class Orphan_section_placement): Define
7373         PLACE_TLS and PLACE_TLS_BSS.
7374         (Orphan_section_placement::Orphan_section_placement): Initialize
7375         new places.
7376         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7377         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7378         (tls_script_test_SOURCES): Define.
7379         (tls_script_test_DEPENDENCIES): Define.
7380         (tls_script_test_LDFLAGS): Define.
7381         (tls_script_test_LDADD): Define.
7382         * testsuite/Makefile.in: Rebuild.
7383
7384 2010-03-22  Doug Kwan  <dougkwan@google.com>
7385
7386         * arm.cc (Arm_relocate_functions::abs8,
7387         Arm_relocate_functions::abs16): Use correct check for overflow
7388         specified in the ARM ELF specs.
7389         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7390         target of a BLX instruction specially.
7391         (Reloc_stub::stub_type_for_reloc): Ditto.
7392         (Relocate::relocate): Use symbolic names instead of numeric relocation
7393         codes to report error.
7394         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7395         workaround.
7396         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7397         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7398         thumb2_blx_out_of_range.stdout
7399         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7400         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7401         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7402         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7403         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7404         thumb2_blx_in_range, thumb2_blx_in_range.o,
7405         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7406         thumb2_blx_out_of_range.o): New rules.
7407         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7408         thumb2_blx_in_range and thumb2_blx_out_of_range.
7409         * testsuite/Makefile.in: Regenerate.
7410         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7411         * testsuite/thumb_blx_in_range.s: New file.
7412         * testsuite/thumb_blx_out_of_range.s: New file.
7413
7414 2010-03-22  Rafael Espindola  <espindola@google.com>
7415
7416         * archive.cc (Should_include): Move to archive.h.
7417         (should_include_member): Make it a member of Archive.
7418         (Lib_group): New.
7419         (Add_lib_group_symbols): New.
7420         * archive.h: Include options.h.
7421         (Archive_member): Moved from Archive.
7422         (Should_include): Moved from archive.cc.
7423         (Lib_group): New.
7424         (Add_lib_group_symbols): New.
7425         * dynobj.cc (do_should_include_member): New.
7426         * dynobj.h (do_should_include_member): New.
7427         * gold.cc (queue_initial_tasks): Update call to queue.
7428         * main.cc (main): Print lib group stats.
7429         * object.cc (do_should_include_member): New.
7430         * object.h: Include archive.h.
7431         (Object::should_include_member): New.
7432         (Object::do_should_include_member): New.
7433         (Sized_relobj::do_should_include_member): New.
7434         * options.cc (General_options::parse_start_lib): New.
7435         (General_options::parse_end_lib): New.
7436         (Input_arguments::add_file): Handle lib groups.
7437         (Input_arguments::start_group): Check we are not in a lib.
7438         (Input_arguments::start_lib): New.
7439         (Input_arguments::end_lib): New.
7440         * options.h (General_options): Add start_lib and end_lib.
7441         (Input_argument::lib_): New.
7442         (Input_argument::lib): New.
7443         (Input_argument::is_lib): New.
7444         (Input_file_lib): New.
7445         (Input_arguments::in_lib_): New.
7446         (Input_arguments::in_lib): New.
7447         (Input_arguments::start_lib): New.
7448         (Input_arguments::end_lib_): New.
7449         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7450         in unused members as preempted.
7451         (Sized_pluginobj::do_should_include_member): New.
7452         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7453         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7454         return the blocker.
7455         (Read_symbols::do_whole_lib_group): New.
7456         (Read_symbols::do_lib_group): New.
7457         (Read_symbols::do_read_symbols): Handle lib groups.
7458         (Read_symbols::get_name): Handle lib groups.
7459         * readsyms.h (Read_symbols): Add an archive member pointer.
7460         (Read_symbols::do_whole_lib_group): New.
7461         (Read_symbols::do_lib_group): New.
7462         (Read_symbols::member_): New.
7463         * script.cc (read_input_script): Update call to queue_soon.
7464
7465 2010-03-19  Doug Kwan  <dougkwan@google.com>
7466
7467         * arm.cc (Stub_table::Stub_table): Initialize new data members
7468         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7469         (Stub_table::add_reloc_stub): Assign stub offset and update
7470         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7471         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7472         New data members.
7473         (Stub_table::update_data_size_and_addralign): Use
7474         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7475         instead of going over all reloc stubs.
7476         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7477         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7478         Stringpool_template::offset_ to size of Stringpool_char.
7479         (Stringpool_template::new_key_offset): Remove code to initialize
7480         Stringpool_template::offset_.
7481         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7482         Stringpool_template::offset_ to zero.
7483
7484 2010-03-15  Doug Kwan  <dougkwan@google.com>
7485
7486         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7487         offset_.
7488         (Stringpool_template::new_key_offset): New method.
7489         (Stringpool_template::add_string): Assign offsets when adding new
7490         strings.
7491         (Stringpool_template::set_string_offsets): Do not set string offsets
7492         when not optimizing.
7493         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7494         member size_.
7495         (Chunked_vector::clear): Clear size_.
7496         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7497         (Chunked_vector::size): Return size_.
7498         (Chunked_vector::push_back): Use size_ to find insert position.
7499         (Chunked_vector::size_): New data member.
7500         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7501         (Stringpool_template::new_key_offset): New method declaration.
7502         (Stringpool_template::offset_): New data member.
7503
7504 2010-03-15   Rafael Espindola  <espindola@google.com>
7505
7506         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7507         Add_symbols' constructor.
7508         * readsyms.h (Add_symbols): Remove the input_group member.
7509
7510 2010-03-10  Ian Lance Taylor  <iant@google.com>
7511
7512         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7513         target to ask whether a reference to a symbol requires a stack
7514         split.
7515         * target.h (Target::is_call_to_non_split): New function.
7516         (Target::do_is_call_to_non_split): Declare virtual function.
7517         * target.cc: Include "symtab.h".
7518         (Target::do_is_call_to_non_split): New function.
7519         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7520
7521 2010-03-10  Cary Coutant  <ccoutant@google.com>
7522
7523         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7524         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7525         (File_read::open[2]): Add whole_file_view_ to list of views.
7526         (File_read::make_view): Remove test of whole_file_view_.
7527         (File_read::find_or_make_view): Create whole_file_view_ if
7528         necessary.
7529         (File_read::clear_views): Replace bool parameter with enum;
7530         adjust all callers.  Don't delete views with permanent data;
7531         do delete cached views and views from archives if
7532         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7533         if clearing the corresponding view.
7534         * fileread.h (File_read::Clear_views_mode): New enum.
7535         (File_read::View::is_permanent_view): New method.
7536         (File_read::clear_views): Replace bool parameter
7537         with enum; adjust all callers.
7538         * options.h (General_options): Change keep_files_mapped option;
7539         add map_whole_files.
7540         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7541         releasing the file.
7542         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7543         the file.
7544
7545 2010-03-10  David S. Miller  <davem@davemloft.net>
7546
7547         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7548
7549 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7550
7551         * icf.cc (get_section_contents): Add '@' marker after processing the
7552         merge reloc.
7553
7554 2010-03-08  Doug Kwan  <dougkwan@google.com>
7555
7556         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7557         due to a conversion warning.
7558         (Arm_relobj::update_output_local_symbol_count): Check for local
7559         symbol with unset output index.
7560
7561 2010-03-05  Ian Lance Taylor  <iant@google.com>
7562
7563         * options.h (class General_options): Add --spare-dynamic-tags.
7564         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7565         --spare-dynamic-tags.
7566
7567 2010-03-05  Ian Lance Taylor  <iant@google.com>
7568
7569         * incremental.cc: Include "libiberty.h".
7570
7571 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7572
7573         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7574         function, is_info_ member.
7575         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7576         (Versions::Versions): Update caller.
7577         (Versions::define_base_version): Likewise.
7578         (Versions::add_def): Likewise.
7579
7580 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7581
7582         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7583         (Scan::possible_function_pointer_reloc): New function.
7584         (Scan::local_reloc_may_be_function_pointer): Change to call
7585         possible_function_pointer_reloc.
7586         (Scan::global_reloc_may_be_function_pointer): Ditto.
7587         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7588         relocations in ".data.rel.ro._ZTV" section.
7589         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7590         * testsuite/icf_safe_so_test.cc: Ditto.
7591         * testsuite/icf_safe_test.cc: Ditto.
7592         * testsuite/icf_safe_test.sh: Ditto.
7593
7594 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7595             Ian Lance Taylor  <iant@google.com>
7596
7597         * target-reloc.h (relocate_section): Check the symbol table index
7598         for -1U before setting the local symbol index.
7599         (scan_relocatable_relocs): If copying the relocation, record that
7600         the local symbol is required.
7601         * object.h (Symbol_value::is_output_symtab_index_set): New
7602         function.
7603         (Symbol_value::may_be_discarded_from_output_symtab): New
7604         function.
7605         (Symbol_value::has_output_symtab_entry): New function.
7606         (Symbol_value::needs_output_symtab_entry): Remove.
7607         (Symbol_value::output_symtab_index): Make sure the symbol index is
7608         set.
7609         (Symbol_value::set_output_symtab_index): Make sure the symbol
7610         index is not set.  Make sure the new index is valid.
7611         (Symbol_value::set_must_have_output_symtab_entry): New function.
7612         (Symbol_value::has_output_dynsym_entry): New function.
7613         (Symbol_value::set_output_dynsym_index): Make sure the new index
7614         is valid.
7615         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7616         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7617         local symbol if permitted.
7618         (Sized_relobj::do_finalize_local_symbols): Call
7619         is_output_symtab_index_set rather than needs_output_symtab_entry.
7620         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7621         rather than needs_output_symtab_entry.  Call
7622         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7623         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7624         is_output_symtab_index_set rather than needs_output_symtab_entry.
7625         * testsuite/discard_locals_relocatable_test.c: New file.
7626         * testsuite/discard_locals_test.sh: Test -r.
7627         * testsuite/Makefile.am (check_DATA): Add
7628         discard_locals_relocatable_test1.syms,
7629         discard_local_relocatable_test2.syms.
7630         (MOSTLYCLEANFILES): Likewise.  Also add
7631         discard_locals_relocatable_test1.lout and
7632         discard_locals_relocatable_test2.out.
7633         (discard_locals_relocatable_test1.syms): New target.
7634         (discard_locals_relocatable_test.o): New target.
7635         (discard_locals_relocatable_test1.out): New target.
7636         (discard_locals_relocatable_test2.syms): New target.
7637         (discard_locals_relocatable_test2.out): New target.
7638         (various): Add missing ../ld-new dependencies.
7639         * testsuite/Makefile.in: Rebuild.
7640
7641 2010-03-03  Nick Clifton  <nickc@redhat.com>
7642
7643         * po/fi.po: New Finnish translation.
7644
7645 2010-03-01  Doug Kwan  <dougkwan@google.com>
7646
7647         * layout.cc (Layout::Layout): Force section types of .init_array*,
7648         .preinit_array* and .fini_array* sections.
7649         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7650         Fix check of return value of std::string::find.().
7651         (Output_section::Input_section_sort_compare::operator()): Remove
7652         comment about .init_array.
7653         (Output_section::Input_section_sort_init_fini_compare::operator()):
7654         New method.
7655         (Output_section::sort_attached_input_sections): Handle .init_array
7656         and .fini_array specially.
7657         * output.h (Output_section::Inut_section_sort_compare): Update
7658         comment.
7659         (Output_section::Input_section_sort_init_fini_compare): New struct.
7660
7661 2010-02-26  Doug Kwan  <dougkwan@google.com>
7662
7663         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7664         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7665         * testsuite/debug_msg.sh: Avoid matching source line number for
7666         use of global variable undef_int.
7667
7668 2010-02-26  Doug Kwan  <dougkwan@google.com>
7669
7670         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7671         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7672         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7673         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7674         * options.cc (General_options::General_options): Initialize member
7675         fix_v4bx_.
7676         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7677         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7678         and rm_no_fix_v4bx.stdout
7679         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7680         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7681         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7682         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7683         and arm_no_fix_v4bx.
7684         * Makefile.in: Regenerate.
7685         * testsuite/arm_fix_v4bx.s: New file.
7686         * testsuite/arm_fix_v4bx.sh: Ditto.
7687
7688 2010-02-24  Doug Kwan  <dougkwan@google.com>
7689
7690         * arm.cc (Target_arm::got_section): Make the .got section the first
7691         non RELRO section in the data segment.
7692         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7693         suffixes of section names.
7694
7695 2010-02-24  Doug Kwan  <dougkwan@google.com>
7696
7697         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7698         flags and attributes merging if an input file is a binary file.
7699         * fileread.cc (Input_file::open): Record format of original file.
7700         * fileread.h (Input_file::Format): New enum type.
7701         (Input_file::Input_file): Initialize data member format_.
7702         (Input_file::format): New method definition.
7703         (Input_file::format_):: New data member.
7704
7705 2010-02-24  Doug Kwan  <dougkwan@google.com>
7706
7707         * arm.cc (Arm_output_data_got): New class.
7708         (ARM_TCB_SIZE): New constant
7709         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7710         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7711         If user uses a script with a SECTIONS clause, issue only a warning
7712         for a misplaced EXIDX input section.  Otherwise, issue an error.
7713         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7714         garbage collection.
7715         (Target_arm::got_mode_index_entry): Handle static linking.
7716         (Target_arm::Scan::local): Ditto.
7717         (Target_arm::Scan::global): Ditto.
7718         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7719         all incorrectly implemented relocations.
7720         (Target_arm::fix_exidx_coverage): Pass layout to
7721         Arm_output_section::fix_exidx_coverage.
7722         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7723         from ".ARM.exidx." and ".ARM.extab.".
7724
7725 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7726
7727         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7728         section if it does not already exist.
7729         * attributes.cc (Attributes_section_data::Attributes_section_data):
7730         Don't crash if size is zero.
7731
7732 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7733             Ian Lance Taylor  <iant@google.com>
7734
7735         * gold.cc (queue_middle_tasks): If no input files were opened,
7736         exit.
7737         * workqueue.h (Task_function::Task_function): Assert that there is
7738         a blocker.
7739
7740 2010-02-22  Doug Kwan  <dougkwan@google.com>
7741
7742         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7743         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7744         types to avoid warnings due to different uint64_t implementations
7745         on different hosts.
7746
7747 2010-02-21  Doug Kwan  <dougkwan@google.com>
7748
7749         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7750         handling of the maximum backward branch offset.
7751         (Arm_relocate_functions::thumb_branch_common): Ditto.
7752         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7753         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7754         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7755         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7756         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7757         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7758         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7759         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7760         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7761         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7762         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7763         thumb2_bl_out_of_range.o): New rules.
7764         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7765         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7766         thumb2_bl_out_of_range
7767         * testsuite/Makefile.in: Regenerate.
7768         * testsuite/arm_bl_in_range.s: New file.
7769         * testsuite/arm_bl_out_of_range.s: Ditto.
7770         * testsuite/arm_branch_in_range.sh: Ditto.
7771         * testsuite/arm_branch_range.t: Ditto.
7772         * testsuite/thumb2_branch_range.t: Ditto.
7773         * testsuite/thumb_bl_in_range.s: Ditto.
7774         * testsuite/thumb_bl_out_of_range.s: Ditto.
7775         * testsuite/thumb_branch_range.t: Ditto.
7776
7777 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7778
7779         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7780         Add reloc offset information.
7781         * icf.cc (get_section_contents): Change iterators to point to the new
7782         vectors. Add reloc offset information to the contents.
7783         * icf.h (Icf::Sections_reachable_info): New typedef.
7784         (Icf::Sections_reachable_list): New typedef.
7785         (Icf::Offset_info): New typedef.
7786         (Icf::Reloc_info): New struct typedef.
7787         (Icf::Reloc_info_list): New typedef.
7788         (Icf::symbol_reloc_list): Delete method.
7789         (Icf::addend_reloc_list): Delete method.
7790         (Icf::section_reloc_list): Delete method.
7791         (Icf::reloc_info_list): New method.
7792         (Icf::reloc_info_list_): New member.
7793
7794 2010-02-19  Doug Kwan  <dougkwan@google.com>
7795
7796         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7797         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7798         * arm.cc (Arm_relocation_functions): New forward declaration.
7799         (Target_arm::Target_arm): Initialize new data members
7800         got_mod_index_offset_ and tls_base_symbol_defined_.
7801         (Target_arm::Relocate::relocate_tls): New method.
7802         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7803          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7804         New methods.
7805         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7806         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7807         (Target_arm::got_mod_index_offset_,
7808         Target_arm::tls_base_symbol_defined_): New data members.
7809         (Target_arm::Scan::local, Target::Scan::global,
7810         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7811         relocations.
7812
7813 2010-02-18  Doug Kwan  <dougkwan@google.com>
7814
7815         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7816         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7817         text section as a parameter becuase some broken tools may not set
7818         the link in section header.
7819         (Target_arm::has_got_section): New method.
7820         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7821         without any mapping symbol as data only.  Remove warning.
7822         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7823         link in its section header, try to discover the link by inspecting the
7824         REL31 relocation at the beginning of the section.
7825         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7826         in error message.
7827         (Target_arm::Scan::global): Treat any reference to the symbol
7828         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7829
7830 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7831
7832         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7833         (Scan::global_reloc_may_be_function_pointer): New function.
7834         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7835         (Scan::global_reloc_may_be_function_pointer): New function.
7836         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7837         (Scan::global_reloc_may_be_function_pointer): New function.
7838         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7839         (Scan::global_reloc_may_be_function_pointer): New function.
7840         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7841         (Scan::global_reloc_may_be_function_pointer): New function.
7842         (Scan::possible_function_pointer_reloc): New function.
7843         (Target_x86_64::can_check_for_function_pointers): New function.
7844         * gc.h (gc_process_relocs): Scan relocation types to determine if
7845         function pointers were taken for targets that support it.
7846         * icf.cc (Icf::find_identical_sections): Include functions for
7847         folding in safe ICF whose pointer is not taken.
7848         * icf.h (Secn_fptr_taken_set): New typedef.
7849         (fptr_section_id_): New member.
7850         (section_has_function_pointers): New function.
7851         (set_section_has_function_pointers): New function.
7852         (check_section_for_function_pointers): New function.
7853         * options.h: Fix comment for safe ICF option.
7854         * target.h (can_check_for_function_pointers): New function.
7855         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7856         Modify icf_safe_test for X86-64.
7857         * testsuite/Makefile.in: Regenerate.
7858         * testsuite/icf_safe_so_test.cc: New file.
7859         * testsuite/icf_safe_so_test.sh: New file.
7860         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7861         (main): Change to take pointer to function kept_func_3.
7862         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7863         folding is done correctly for X86-64.
7864
7865 2010-02-12  David S. Miller  <davem@davemloft.net>
7866
7867         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7868         is_symbolless parameter.
7869         (Output_reloc<SHT_REL>::is_symbolless): New.
7870         (Output_reloc<SHT_REL>::is_symbolless_): New.
7871         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7872         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7873         (Output_reloc<SHT_RELA>::is_symbolless): New.
7874         (Output_data_reloc::add_global): Handle is_symbolless.
7875         (Output_data_reloc::add_global_relative): Likewise.
7876         (Output_data_reloc::add_local): Likewise.
7877         (Output_data_reloc::add_local_relative): Likewise.
7878         (Output_data_reloc::add_symbolless_global_addend): New.
7879         (Output_data_reloc::add_symbolless_local_addend): New.
7880         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7881         is_symbolless.
7882         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7883         instead of ->is_relative_
7884         (Output_reloc::write): Likewise.
7885         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7886         (Output_reloc::write_rel): Simplify.
7887
7888         * sparc.cc (Target_sparc::Scan::local): Use
7889         ->add_symbolless_local_addend as needed.
7890         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7891         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7892         based upon relocation offset.
7893
7894 2010-02-11  Doug Kwan  <dougkwan@google.com>
7895
7896         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7897         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7898         beginning of function.
7899         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7900         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7901         parameter is_32bit in calls to should_apply_static_reloc.
7902         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7903         (check_DATA): Add arm_abs_global.stdout.
7904         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7905         arm_abs_global.stdout): New rules.
7906         (MOSTLLYCLEANFILES): Add arm_abs_global
7907         * Makefile.in: Regenerate.
7908         * testsuite/arm_abs_global.s: New file.
7909         * testsuite/arm_abs_global.sh: Ditto.
7910         * testsuite/arm_abs_lib.s: Ditto.
7911
7912 2010-02-11  Ian Lance Taylor  <iant@google.com>
7913
7914         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7915         Read_relocs task.
7916         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7917         Allocate_commons_task first.
7918         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7919         task, rather than symtab_lock_.
7920         (Gc_process_relocs::~Gc_process_relocs): New function.
7921         (Gc_process_relocs::is_runnable): Check this_blocker_.
7922         (Gc_process_relocs::locks): Use next_blocker_ rather than
7923         blocker_.
7924         (Scan_relocs::~Scan_relocs): New function.
7925         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7926         symtab_lock_.
7927         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7928         next_blocker_.
7929         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7930         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7931         constructor accordingly.
7932         (class Gc_process_relocs): Likewise.
7933         (class Scan_relocs): Likewise.
7934         * common.h (class Allocate_commons_task): Remove symtab_lock_
7935         field, and corresponding constructor parameter.
7936         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7937         symtab_lock_.
7938         (Allocate_commons_task::locks): Likewise.
7939
7940 2010-02-11  Ian Lance Taylor  <iant@google.com>
7941
7942         * gold-threads.h (class Once): Define.
7943         (class Initialize_lock): Rewrite as child of Once.
7944         * gold-threads.cc (class Once_initialize): Define.
7945         (once_pointer_control): New static variable.
7946         (once_pointer, once_arg): New static variables.
7947         (c_run_once): New static function.
7948         (Once::Once, Once::run_once, Once::internal_run): New functions.
7949         (class Initialize_lock_once): Remove.
7950         (initialize_lock_control): Remove.
7951         (initialize_lock_pointer): Remove.
7952         (initialize_lock_once): Remove.
7953         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7954         (Initialize_lock::initialize): Rewrite.
7955         (Initialize_lock::do_run_once): New function.
7956         * archive.cc (Archive::interpret_header): Only clear name if it is
7957         not already empty.
7958         * fileread.cc: Include "gold-threads.h"
7959         (file_counts_lock): New static variable.
7960         (file_counts_initialize_lock): Likewise.
7961         (File_read::release): Only increment counts when using --stats.
7962         Use a lock around the increment.
7963         * parameters.cc (class Set_parameters_target_once): Define.
7964         (set_parameters_target_once): New static variable.
7965         (Parameters::Parameters): Move here from parameters.h.
7966         (Parameters::set_target): Rewrite.
7967         (Parameters::set_target_once): New function.
7968         (Parameters::clear_target): Move here and rewrite.
7969         * parameters.h (class Parameters): Update declarations.  Add
7970         set_parameters_target_once_ field.
7971         (Parameters::Parameters): Move to parameters.cc.
7972         (Parameters::clear_target): Likewise.
7973         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7974         task.
7975         (Start_group::~Start_group): New function.
7976         (Start_group::is_runnable): New function.
7977         (Start_group::locks, Start_group::run): New functions.
7978         (Finish_group::run): Change saw_undefined to size_t.
7979         * readsyms.h (class Start_group): Define.
7980         (class Finish_group): Change saw_undefined_ field to size_t.
7981         (Finish_group::Finish_group): Remove saw_undefined and
7982         this_blocker parameters.  Change all callers.
7983         (Finish_group::set_saw_undefined): New function.
7984         (Finish_group::set_blocker): New function.
7985         * symtab.h (class Symbol_table): Change saw_undefined to return
7986         size_t.  Change saw_undefined_ field to size_t.
7987         * target-select.cc (Set_target_once::do_run_once): New function.
7988         (Target_selector::Target_selector): Initialize set_target_once_
7989         field.  Don't initialize lock_ and initialize_lock_ fields.
7990         (Target_selector::instantiate_target): Rewrite.
7991         (Target_selector::set_target): New function.
7992         * target-select.h (class Set_target_once): Define.
7993         (class Target_selector): Update declarations.  Make
7994         Set_target_once a friend.  Remove lock_ and initialize_lock_
7995         fields.  Add set_target_once_ field.
7996
7997 2010-02-10  Ian Lance Taylor  <iant@google.com>
7998
7999         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8000         queueing any tasks.
8001         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8002         (queue_middle_tasks): Add all blockers before queueing any tasks.
8003         (queue_final_tasks): Likewise.
8004         * token.h (Task_token::add_blockers): New function.
8005         * object.h (Input_objects::number_of_relobjs): New function.
8006
8007 2010-02-10  Ian Lance Taylor  <iant@google.com>
8008
8009         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8010         shared, not if not position independent.
8011         * x86_64.cc (Relocate::relocate_tls): Likewise.
8012         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8013         (tls_pie_pic_test): New target.
8014         * testsuite/Makefile.in: Rebuild.
8015
8016         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8017         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8018         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8019         * testsuite/Makefile.in: Rebuild.
8020
8021 2010-02-09  David S. Miller  <davem@davemloft.net>
8022
8023         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8024         R_SPARC_RELATIVE using ->add_local_relative().
8025         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8026
8027         * output.h (Output_data_dynamic::add_section_size): New method
8028         that takes two Output_data objects.
8029         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8030         entry param.  Handle it in initializers.
8031         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8032         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8033         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8034         arg.
8035         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8036         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8037         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8038         for dynrel_includes_plt.
8039         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8040         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8041         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8042         before .rela.plt
8043         (Target_sparc::do_finalize_sections): Update to pass true for
8044         dynrel_includes_plt.
8045         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8046         output before .rela.plt
8047         (Target_powerpc::do_finalize_sections): Update to pass true for
8048         dynrel_includes_plt when 32-bit.
8049
8050 2010-02-08  Doug Kwan  <dougkwan@google.com>
8051
8052         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8053         method.
8054         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8055         Arm_relobj::scan_section_for_cortex_a8_stubs,
8056         Arm_relobj::do_relocation_section): Instead of calling
8057         Output_section::output_address, use faster
8058         Arm_relobj::simple_input_section_output_address.
8059
8060 2010-02-08  David S. Miller  <davem@davemloft.net>
8061
8062         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8063         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8064         relocation helper function.
8065
8066         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8067         just like R_SPARC_GOT{10,13,22}.
8068         (Target_sparc::Scan::local): Likewise.
8069         (Target_sparc::Relocate:relocate): Likewise.
8070
8071 2010-02-06  Ian Lance Taylor  <iant@google.com>
8072
8073         * configure.ac: Rewrite targetobjs duplicate removal code to use
8074         only shell constructs.
8075         * configure: Rebuild.
8076
8077 2010-02-05  Doug Kwan  <dougkwan@google.com>
8078
8079         PR 11247
8080         * arm.cc (Arm_relobj::section_is_scannable): New method.
8081         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8082         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8083
8084 2010-02-04  Doug Kwan  <dougkwan@google.com>
8085
8086         PR 11247
8087         * arm-reloc-property.cc (cstdio): Include.
8088         * configure.ac (targetobjs): Remove duplicates.
8089         * configure: Regenerate.
8090         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8091         big and little endian version for a given address size.
8092
8093 2010-02-03  Doug Kwan  <dougkwan@google.com>
8094
8095         * arm-reloc-property.cc
8096         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8097         definition.
8098         * arm-reloc-property.h
8099         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8100         New method definition.
8101         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8102         declaration.
8103         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8104         overflow to N.
8105         (GOT_PREL): Change implemented to Y.
8106         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8107         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8108         (Arm_relocate_functions::movw_abs_nc): Remove method.
8109         (Arm_relocate_functions::movt_abs): Ditto.
8110         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8111         (Arm_relocate_functions::thm_movt_abs): Ditto.
8112         (Arm_relocate_functions::movw_rel_nc): Ditto.
8113         (Arm_relocate_functions::movw_rel): Ditto.
8114         (Arm_relocate_functions::movt_rel): Ditto.
8115         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8116         (Arm_relocate_functions:thm_movw_rel): Ditto.
8117         (Arm_relocate_functions:thm_movt_rel): Ditto.
8118         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8119         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8120         New method definitions.
8121         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8122         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8123         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8124         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8125         (Target_arm::Relocate::relocate): Check for non-static or
8126         unimplemented relocation code and exit early.  Change calls to
8127         Target_arm::reloc_uses_thumb_bit and
8128         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8129         instead.  Refactor code to handle similar relocations to increase
8130         code sharing.  Remove check for unsupported relocation code in switch
8131         statement.
8132         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8133         relocation property table to find out size.  Change error message to
8134         print out the name of a relocation code instead of the numeric value.
8135         (Target_arm::scan_reloc_for_stub): Use relocation property table
8136         instead of calling Target_arm::reloc_uses_thumb_bit().
8137
8138 2010-02-02  Doug Kwan  <dougkwan@google.com>
8139
8140         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8141         types of relaxed input section.
8142
8143 2010-02-02  Doug Kwan  <dougkwan@google.com>
8144
8145         * Makefile.am (HFILES): Add arm-reloc-property.h.
8146         (DEFFILES): New.
8147         (TARGETSOURCES): Add arm-reloc-property.cc
8148         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8149         (libgold_a_SOURCES): $(DEFFILES)
8150         * Makefile.in: Regenerate.
8151         * arm-reloc-property.cc: New file.
8152         * arm-reloc-property.h: New file.
8153         * arm-reloc.def: New file.
8154         * arm.cc: Update comments.
8155         (arm-reloc-property.h): New included header.
8156         (arm_reloc_property_table): New global variable.
8157         (Target_arm::do_select_as_default_target): New method definition.
8158         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8159         arm-reloc-property to targ_extra_obj.
8160         * parameters.cc (set_parameters_target): Call
8161         Target::select_as_default_target().
8162         * target.h (Target::select_as_default_target): New method definition.
8163         (Target::do_select_as_default_target): Same.
8164
8165 2010-02-01  Doug Kwan  <dougkwan@google.com>
8166
8167         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8168         first_output_text_section_.
8169         (Arm_exidx_fixup::first_output_text_section): New method definition.
8170         (Arm_exidx_fixup::first_output_text_section_): New data member.
8171         (Arm_exidx_fixup::process_exidx_section): Record the first text
8172         output section seen.
8173         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8174         and entsize in output section header.
8175
8176 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8177
8178         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8179         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8180         (Arm_relocate_functions::thm_alu11): New Method.
8181         (Arm_relocate_functions::thm_pc8): New Method.
8182         (Arm_relocate_functions::thm_pc12): New Method.
8183         (Target_arm::Scan::local): Handle the relocations.
8184         (Target_arm::Scan::global): Likewise.
8185         (Target_arm::Relocate::relocate): Likewise.
8186         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8187
8188 2010-01-29  Doug Kwan  <dougkwan@google.com>
8189
8190         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8191         of relocation types as ld.
8192
8193 2010-01-29  Doug Kwan  <dougkwan@google.com>
8194
8195         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8196         to public.
8197         (Arm_relocate_functions::thumb_branch_common): Ditto.
8198         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8199         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8200         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8201         Arm_relocate_functions::jump24): Remove.
8202         (Target_arm::Relocate::relocate): Adjust code to call
8203         Arm_relocation_functions::arm_branch_common and
8204         Arm_relocation_functions::thumb_branch_common instead of their removed
8205         wrappers.  Merge switch-cases together to reduce source code size.
8206
8207 2010-01-29  Doug Kwan  <dougkwan@google.com>
8208
8209         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8210         output_local_symbol_count_needs_update_.
8211         (Arm_relobj::output_local_symbol_count_needs_update,
8212          Arm_relobj::set_output_local_symbol_count_needs_update,
8213          Arm_relobj::update_output_local_symbol_count): New methods.
8214         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8215         member.
8216         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8217         of pointed function as in a R_ARM_PREL31 relocation.
8218         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8219         for output local symbol count updating.
8220         (Target_arm::do_relax): Update output local symbol counts in objects
8221         if necessary.
8222         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8223
8224 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8225
8226         * arm.cc: Added support for the ARM relocations:
8227         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8228         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8229         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8230         movw_prel_nc).
8231         (Arm_relocate_functions::movw_rel): New method.
8232         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8233         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8234         thm_movw_prel_nc).
8235         (Arm_relocate_functions::thm_movw_rel): New method.
8236         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8237         thm_movt_prel).
8238         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8239         relocations.
8240         (Target_arm::Scan::global): Likewise.
8241         (Target_arm::Relocate::relocate): Likewise.
8242         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8243         Likewise.
8244
8245 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8246
8247         * arm.cc: Added support for ARM group relocations.
8248         (Target_arm::reloc_needs_sym_origin): New method.
8249         (Arm_relocate_functions::calc_grp_kn): New method.
8250         (Arm_relocate_functions::calc_grp_residual): New method.
8251         (Arm_relocate_functions::calc_grp_gn): New method.
8252         (Arm_relocate_functions::arm_grp_alu): New Method.
8253         (Arm_relocate_functions::arm_grp_ldr): New Method.
8254         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8255         (Arm_relocate_functions::arm_grp_ldc): New Method.
8256         (Target_arm::Scan::local): Handle the ARM group relocations.
8257         (Target_arm::Scan::global): Likewise.
8258         (Target_arm::Relocate::relocate): Likewise.
8259         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8260         Likewise.
8261
8262 2010-01-26  Doug Kwan  <dougkwan@google.com>
8263
8264         * arm.cc (set): Include.
8265         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8266         pointer type.
8267         (Arm_output_section::Text_section_list): New type.
8268         (Arm_output_section::append_text_sections_to_list): New method.
8269         (Arm_output_section::fix_exidx_coverage): Ditto.
8270         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8271         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8272         Relobj::set_section_offset() instead of
8273         Sized_relobj::invalidate_section_offset().
8274         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8275         parameter for section headers. Ignore relocation sections for
8276         unallocated sections and EXIDX sections.
8277         (Target_arm::fix_exidx_coverage): New method.
8278         (Target_arm::output_section_address_less_than): New type.
8279         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8280         linked text section instead of the EXIDX section.
8281         (Arm_output_section::create_stub_group): Add an assertion to check
8282         that this is not an EXIDX output section.
8283         (Arm_output_section::append_text_sections_to_list): New method.
8284         (Arm_output_section::fix_exidx_coverage): Ditto.
8285         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8286         Arm_relobj::section_needs_reloc_stub_scanning.
8287         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8288         first pass.
8289         (Target_arm::fix_exidx_coverage): New method.
8290         * object.h (Relobj::set_output_section): New method.
8291         (Sized_relobj::invalidate_section_offset): Remove method.
8292         (Sized_relobj::do_invalidate_section_offset): Remove method.
8293         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8294
8295 2010-01-25  Doug Kwan  <dougkwan@google.com>
8296
8297         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8298         Fix warning due to signed and unsigned comparison on a 32-bit host.
8299
8300 2010-01-22  Doug Kwan  <dougkwan@google.com>
8301
8302         * arm.cc (Target_arm::do_relax): Record an output section for section
8303         offset adjustment it contains any stub table that has changed.
8304         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8305         offsets in an output section if necessary.
8306         * output.cc (Output_section::Output_section): Initialize
8307         section_offsets_need_adjustments_.
8308         (Output_section::add_input_section_for_script): Renamed to
8309         Output_section::add_simple_input_section.
8310         (Output_section::save_states): Add a comment.
8311         (Output_section::discard_states): New method defintion.
8312         (Output_section::adjust_section_offsets): Same.
8313         * output.h (Output_section::add_input_section_for_script): Renamed to
8314         Output_section::add_simple_input_section.
8315         (Output_section::discard_states): New method declaration.
8316         (Output_section::adjust_section_offsets): Same.
8317         (Output_section::section_offsets_need_adjustment,
8318         Output_section::set_section_offsets_need_adjustment): New method
8319         definitions.
8320         (Output_section::section_offsets_need_adjustment_): New data member.
8321         * script-sections.cc
8322         (Output_section_element_input::set_section_address): Adjust code for
8323         renaming of Output_section::add_input_section_for_script.
8324         (Orphan_output_section::set_section_address): Same.
8325
8326 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8327
8328         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8329         Fix_v4bx enum values .
8330         * gold/options.h (General_options): New option definitions.
8331         (General_options::fix_v4bx): New method.
8332         (General_options::Fix_v4bx): New enum.
8333         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8334         (General_options::parse_fix_v4bx_interworking): New method.
8335
8336 2010-01-22  Doug Kwan  <dougkwan@google.com>
8337
8338         * arm.cc (Arm_exidx_fixup): New class.
8339
8340 2010-01-21  Doug Kwan  <dougkwan@google.com>
8341
8342         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8343         classes.
8344         (Arm_exidx_section_offset_map): New type.
8345
8346 2010-01-21  Doug Kwan  <dougkwan@google.com>
8347
8348         * arm.cc (Arm_exidx_input_section): New class.
8349         (Arm_relobj::exidx_input_section_by_link,
8350         Arm_relobj::exidx_input_section_by_shndx,
8351         Arm_relobj::make_exidx_input_section): New methods.
8352         (read_arm_attributes_section): Remove.
8353         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8354         information about them.
8355         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8356         to here.
8357
8358 2010-01-20  Doug Kwan  <dougkwan@google.com>
8359
8360         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8361         Input_section_specifier to Section_id.
8362         (Target_arm::new_arm_input_section: Adjust code for change of key
8363         type.
8364         (Target_arm::find_arm_input_section): Ditto.
8365         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8366         (Section_id): Remove.
8367         (Garbage_collection::Section_id_hash): Remove.
8368         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8369         (Section_id): Remove.
8370         (Icf::Section_id_hash): Remove.
8371         * object.h (Section_id, Const_section_id, Section_id_hash,
8372         Const_section_id_hash): New type definitions.
8373         * output.cc (Output_section::add_relaxed_input_section): Change to
8374         use Const_section_id instead of Input_section_specifier as key type.
8375         (Output_section::add_merge_input_section): Ditto.
8376         (Output_section::build_relaxation_map): Change to use Section_id
8377         instead of Input_section_specifier as key type.
8378         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8379         Ditto.
8380         (Output_section::convert_input_sections_to_relaxed_sections): Change
8381         to use Const_section_id instead of Input_section_specifier as key type.
8382         (Output_section::find_merge_section): Ditto.
8383         (Output_section::find_relaxed_input_section): Ditto.
8384         * output.h (Input_section_specifier): Remove class.
8385         (Output_section::Output_section_data_by_input_section_map): Change
8386         key type to Const_section_id.
8387         (Output_section::Output_relaxed_input_section_by_input_section_map):
8388         Ditto.
8389         (Output_section::Relaxation_map): Change key type to Section_id.
8390
8391 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8392
8393         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8394         (class Arm_v4bx_stub): New class.
8395         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8396         (Stub_factory::make_arm_v4bx_stub): New method.
8397         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8398         (Stub_table::empty): Handle v4bx stubs.
8399         (Stub_table::add_arm_v4bx_stub): New method.
8400         (Stub_table::find_arm_v4bx_stub): New method.
8401         (Arm_relocate_functions::v4bx): New method.
8402         (Target_arm::fix_v4bx): New method.
8403         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8404         (Stub_table::relocate_stubs): Likewise.
8405         (Stub_table::do_write): Likewise.
8406         (Stub_table::update_data_size_and_addralign): Likewise.
8407         (Stub_table::finalize_stubs):  Likewise.
8408         (Target_arm::Scan::local): Likewise.
8409         (Target_arm::Scan::global): Likewise.
8410         (Target_arm::do_finalize_sections): Likewise.
8411         (Target_arm::Relocate::relocate): Likewise.
8412         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8413         Likewise.
8414         (Target_arm::scan_reloc_for_stub): Likewise.
8415         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8416
8417 2010-01-19  Ian Lance Taylor  <iant@google.com>
8418
8419         * output.cc (Output_section_headers::do_sized_write): Write large
8420         segment count to sh_info field.
8421         (Output_file_header::do_sized_write): For large segment count,
8422         write PN_XNUM to e_phnum field.
8423
8424 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8425
8426         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8427         (Arm_relocate_functions::thm_jump8): New function.
8428         (Arm_relocate_functions::thm_jump11): New function.
8429         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8430         R_ARM_THM_JUMP11.
8431         (Target_arm::Scan::global): Likewise.
8432         (Target_arm::Relocate::relocate): Likewise.
8433         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8434         Likewise.
8435
8436 2010-01-14  Doug Kwan  <dougkwan@google.com>
8437
8438         * arm.cc (map, utility): Include headers.
8439         (Target_arm::apply_cortex_a8_workaround): New method.
8440         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8441         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8442         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8443         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8444         the --[no-]fix-cortex-a8 command line options.
8445         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8446         (Target_arm::relocate_stub): Use addend in instruction template.
8447         * options.h (DEFINE_bool): Set the user-set flag.
8448         (General_options): Add --[no-]-fix-cortex options.
8449         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8450         : Update fast look-up map after conversion.
8451
8452 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8453
8454         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8455         in the first pass of do_layout.
8456
8457 2010-01-13  Doug Kwan  <dougkwan@google.com>
8458
8459         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8460         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8461         apparent compiler problem of not folding static constant integral
8462         data members of elfcpp::Elf_sizes<32>.
8463
8464 2010-01-13  Doug Kwan  <dougkwan@google.com>
8465
8466         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8467         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8468         Arm_relobj::scan_section_for_cortex_a8_erratum,
8469         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8470         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8471         sections to scan for relocation stubs into a new method
8472         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8473         relocation and Cortex-A8 stub scanning.
8474         (Target_arm::do_relax): Force stubs to be after stubbed sections
8475         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8476         the beginning of a new relaxation pass.  Update a comment.
8477         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8478
8479 2010-01-12  Ian Lance Taylor  <iant@google.com>
8480
8481         * target-reloc.h (visibility_error): New inline function.
8482         (relocate_section): Call visibility_error.
8483         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8484         (MOSTLYCLEANFILES): Likewise.
8485         (protected_4_pic.o, protected_3.err): New targets.
8486         * testsuite/protected_4.cc: New file.
8487
8488 2010-01-12  Doug Kwan  <dougkwan@google.com>
8489
8490         * arm.cc (Cortex_a8_reloc): New class.
8491         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8492         and cortex_a8_relocs_info_.
8493         (Target_arm::fix_cortex_a8): New method definition.
8494         (Target_arm::Cortex_a8_relocs_info): New type.
8495         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8496         New data member declarations.
8497         (Target_arm::scan_reloc_for_stub): Record information about
8498         relocations for THUMB branches that might be exempted from the
8499         Cortex-A8 workaround.
8500         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8501         at the beginning of a relaxation pass.
8502
8503 2010-01-12  Doug Kwan  <dougkwan@google.com>
8504
8505         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8506         (Arm_relobj::Mapping_symbol_position,
8507          Arm_reloj::Mapping_symbol_position_less,
8508          Arm_relobj::Mapping_symbols_info): New types.
8509         (Target_arm::is_mapping_symbol_name): New method definition.
8510         (Arm_relobj::do_count_local_symbols): Save information about mapping
8511         symbols.
8512
8513 2010-01-11  Doug Kwan  <dougkwan@google.com>
8514
8515         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8516         Arm_relocate_functions::thumb32_branch_upper,
8517         Arm_relocate_functions::thumb32_branch_lower,
8518         Arm_relocate_functions::thumb32_cond_branch_offset,
8519         Arm_relocate_functions::thumb32_cond_branch_upper,
8520         Arm_relocate_functions::thumb32_cond_branch_lower,
8521         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8522         branch offset encoding.
8523         (Arm_relocate_functions::thumb_branch_common): Use new branch
8524         offset encoding methods to avoid code duplication.
8525         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8526         (Stub_addend_reader::operator()): Use new branch encoding method
8527         to avoid code duplication.
8528
8529 2010-01-11  Doug Kwan  <dougkwan@google.com>
8530
8531         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8532         (Target_arm::do_finalize_sections): Define special EXIDX section
8533         symbols only if referenced.
8534         * gc.h (Garbage_collection::add_reference): New method.
8535         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8536         code duplication.
8537
8538 2010-01-11  Ian Lance Taylor  <iant@google.com>
8539
8540         * script.cc (Version_script_info::build_expression_list_lookup):
8541         Change complaing about duplicate wildcard match from error to
8542         warning.
8543
8544         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8545         of 2009-12-30.
8546         (Version_script_info::Version_script_info): Initialize globs_,
8547         default_version_, default_is_global_, and exact_.  Don't
8548         initialize globals_ or locals_.
8549         (Version_script_info::build_lookup_tables): Build local symbols
8550         first.
8551         (Version_script_info::unquote): New function.
8552         (Version_script_info::add_exact_match): New function.
8553         (Version_script_info::build_expression_list_lookup): Remove lookup
8554         parameter.  Add is_global parameter.  Change all callers.  Handle
8555         wildcard pattern specially.  Unquote pattern.  Call
8556         add_exact_match.
8557         (Version_script_info::get_name_to_match): New function.
8558         (Version_script_info::get_symbol_version): New function.
8559         (Version_script_info::get_symbol_version_helper): Remove.
8560         (Version_script_info::check_unmatched_names): Call unquote.
8561         * script.h (class Version_script_info): Change get_symbol_version
8562         to be non-inline and add is_global parameter; change all callers.
8563         Rewrite symbol_is_local.  Update declarations.  Define struct
8564         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8565         Remove globals_ and locals_ members.  Add exact_, globs_,
8566         default_version_, is_global_.
8567         (Version_script_info::Glob): Remove pattern, add expression and
8568         is_global.  Update constructor.  Change all callers.
8569         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8570         default version.
8571         (Versions::symbol_section_contents): If a symbol is undefined, or
8572         defined in a dynamic object, set the version index to
8573         VER_NDX_LOCAL.
8574         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8575         symbol_is_local.
8576         (Symbol_table::add_from_pluginobj): Likewise.
8577         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8578
8579 2010-01-11  Doug Kwan  <dougkwan@google.com>
8580
8581         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8582         (incremental_dump_LDADD): Add linking option for libintl.
8583         * Makefile.in: Regenerate.
8584
8585 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8586
8587         PR gold/11144
8588         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8589         instead of -Ds.
8590         * testsuite/Makefile.in: Regenerated.
8591
8592 2010-01-10  Doug Kwan  <dougkwan@google.com>
8593
8594         * options.h (DEFINE_var): Use parentheses around argument varname__
8595         in macro body to avoid any unintended subsequent substitutions.
8596
8597 2010-01-10  Ian Lance Taylor  <iant@google.com>
8598
8599         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8600         candidates before doing symbol resolution.
8601
8602         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8603         ODR candidates if only one is weak.
8604
8605 2010-01-08  Ian Lance Taylor  <iant@google.com>
8606
8607         * script.cc (Version_script_info::build_expression_list_lookup):
8608         Don't warn about ambiguous version, just record the ambiguity.
8609         (Version_script_info::get_symbol_version_helper): Give error if
8610         version is ambiguous.
8611
8612 2010-01-08  Doug Kwan  <dougkwan@google.com>
8613
8614         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8615         prev_data_size_ and prev_addralign_.  Remove initializer for
8616         deleted data member has_been_changed_.
8617         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8618         to determine if the table is empty.
8619         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8620         Remove.
8621         (Stub_table::add_reloc_stub): Define method in class definition
8622         instead of just declaring it there.
8623         (Stub_table::add_cortex_a8_stub): New method definition.
8624         (Stub_table::update_data_size_and_addralign): Ditto.
8625         (Stub_table::finalize_stubs): Ditto.
8626         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8627         (Stub_table::do_addralign_): Return address alignment in the
8628         (Stub_table::do_reset_address_and_file_offset): Define method in
8629         class definition instead of declaring it there.  Set current data
8630         size to be the data size of the previous pass.
8631         (Stub_table::set_final_data_size): Use current data size as the
8632         final data size.
8633         (Stub_table::relocate_stub): Change parameter type of stub from
8634         Reloc_stub pointer to Stub pointer.
8635         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8636         (Stub_table::Cortex_a8_stub_list): New typedef.
8637         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8638          Stub_table::prev_addralign_): New data member.
8639         (Arm_relobj::Arm_relobj): Initialize data member
8640         section_has_cortex_a8_workaround_.
8641         (Arm_relobj::section_has_cortex_a8_workaround,
8642          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8643          definitions.
8644         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8645         declarations.
8646         (Target_arm::relocate_stub): Change parameter type of stub from
8647         Reloc_stub pointer to Stub pointer.
8648         (Insn_template::size, Insn_template::alignment): Handle
8649         THUMB16_SPECIAL_TYPE.
8650         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8651          Stub_table::update_data_size_and_addralign,
8652          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8653         definitions.
8654         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8655         (Stub_table::do_write): Ditto.
8656         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8657
8658 2010-01-08  Ian Lance Taylor  <iant@google.com>
8659
8660         PR 11108
8661         * symtab.h (class Symbol): Remove fields is_target_special_ and
8662         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8663         (Symbol::is_defined_in_discarded_section): New function.
8664         (Symbol::set_is_defined_in_discarded_section): New function.
8665         (Symbol::has_plt_offset): Rewrite.
8666         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8667         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8668         Don't initialize is_target_special_ or has_plt_offset_.
8669         Initialize is_defined_in_discarded_section_.
8670         (Symbol_table::add_from_relobj): If appropriate, set
8671         is_defined_in_discarded_section.
8672         * resolve.cc (Symbol::override_base_with_special): Don't test
8673         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8674         * target-reloc.h (relocate_section): Do special handling for
8675         symbols defined in discarded sections for global symbols as well
8676         as local symbols.
8677
8678 2010-01-08  Ian Lance Taylor  <iant@google.com>
8679
8680         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8681         the SHT_SYMTAB case.
8682
8683 2010-01-08  Ian Lance Taylor  <iant@google.com>
8684
8685         * object.cc (Sized_relobj::do_layout): Don't get confused if
8686         layout_eh_frame returns NULL.
8687
8688 2010-01-08  Ian Lance Taylor  <iant@google.com>
8689
8690         PR 11084
8691         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8692         dynamic symbol table, use the normal symbol table.
8693         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8694         symbol table.
8695
8696 2010-01-08  Ian Lance Taylor  <iant@google.com>
8697
8698         PR 11072
8699         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8700         sections.
8701
8702 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8703
8704         * version.cc (print_version): Change to "Copyright 2010".
8705
8706 2010-01-08  Ian Lance Taylor  <iant@google.com>
8707
8708         PR 10287
8709         PR 11063
8710         * i386.cc (class Target_i386): Change return type of plt_section
8711         to be non-const.
8712         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8713         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8714         tls_desc_rel_ field.
8715         (Output_data_plt_i386::rel_tls_desc): New function.
8716         (Target_i386::rel_tls_desc_section): New function.
8717         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8718         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8719         R_386_TLS_DESC reloc in rel_tls_desc_section.
8720         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8721         Define struct Tlsdesc_info.
8722         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8723         (Target_x86_64::do_reloc_symbol_index): New function.
8724         (Target_x86_64::add_tlsdesc_info): New function.
8725         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8726         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8727         tlsdesc_rel_ field.
8728         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8729         all callers.
8730         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8731         (Target_x86_64::rela_tlsdesc_section): New function.
8732         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8733         handling.
8734         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8735         (Target_x86_64::do_reloc_addend): New function.
8736         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8737         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8738         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8739         (Output_reloc::type): New function.
8740         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8741         (Output_reloc::is_target_specific): New function.
8742         (Output_reloc::target_arg): New function.
8743         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8744         absolute relocs and target specific relocs.
8745         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8746         add_target_specific.
8747         (class Output_data_reloc) [SHT_RELA]: Likewise.
8748         * output.cc (Output_reloc::Output_reloc): Add four new versions
8749         for absolute relocs and target specific relocs.
8750         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8751         (Output_reloc::get_symbol_index): Likewise.
8752         (Output_reloc::local_section_offset): Check that local_sym_index_
8753         is not TARGET_CODE or 0.
8754         (Output_reloc::symbol_value): Likewise.
8755         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8756         reloc.
8757         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8758         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8759         functions.
8760         * layout.cc (add_target_dynamic_tags): Use output section for
8761         DT_PLTRELSZ and DT_JMPREL.
8762
8763 2010-01-07  Ian Lance Taylor  <iant@google.com>
8764
8765         PR 11061
8766         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8767         function.
8768         (class Output_data_reloc_generic): Define.
8769         (class Output_data_reloc_base): Change base class to
8770         Output_data_reloc_generic.  Change add() method to call
8771         bump_relative_reloc_count for a relative reloc.  Remove
8772         sort_relocs_ field.
8773         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8774         to sort_relocs().
8775         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8776         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8777         appropriate.
8778         * layout.h (class Layout): Update declaration.
8779
8780 2010-01-07  Ian Lance Taylor  <iant@google.com>
8781
8782         * output.h (class Output_data): Add const version of
8783         output_section and do_output_section.
8784         (class Output_section_data): Add const version of
8785         do_output_section.
8786         (class Output_section): Likewise.
8787         * layout.cc (Layout::add_target_dynamic_tags): New function.
8788         * layout.h (class Layout): Update declarations.
8789         * arm.cc (Target_arm::do_finalize_sections): Use
8790         add_target_dynamic_tags.
8791         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8792         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8793         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8794         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8795
8796 2010-01-07  Ian Lance Taylor  <iant@google.com>
8797
8798         PR 11042
8799         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8800         object as needed.
8801
8802 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8803             Ian Lance Taylor  <iant@google.com>
8804
8805         PR 11019
8806         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8807         Xindex::read_symtab_xindex.
8808
8809 2010-01-07  Doug Kwan  <dougkwan@google.com>
8810
8811         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8812         (Insn_template::thumb16_bcond_insn): New method declaration.
8813         (Insn_template): Fix spelling.
8814         (Stub::thumb16_special): New method declaration.
8815         (Stub::do_write): Define virtual method which was previously pure
8816         virtual.
8817         (Stub::do_thumb16_special): New method declaration.
8818         (Stub::do_fixed_endian_write): New template member.
8819         (Reloc_stub::do_write): Remove.
8820         (Reloc_stub::do_fixed_endian_write): Remove.
8821         (Cortex_a8_stub): New class definition.
8822         (Stub_factory::make_cortex_a8_stub): New method definition.
8823         (Stub_factory::Stub_factory): Add missing static storage class
8824         qualifier for elf32_arm_stub_a8_veneer_blx.
8825
8826 2010-01-07  Ian Lance Taylor  <iant@google.com>
8827
8828         PR 10980
8829         * options.h (class General_options): Add --warn-unresolved-symbols
8830         and --error-unresolved-symbols.
8831         * errors.cc (Errors::undefined_symbol): Implement
8832         --warn-unresolved-symbols.
8833
8834         * options.h (class General_options): Add -z text and -z textoff.
8835         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8836
8837 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8838
8839         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8840         (Garbage_collection::cident_sections): New function.
8841         (Garbage_collection::add_cident_section): New function.
8842         (Garbage_collection::cident_sections_): New member.
8843         (gc_process_relocs): Add references to sections whose names are C
8844         identifiers.
8845         * gold.h (cident_section_start_prefix): New constant.
8846         (cident_section_stop_prefix): New constant.
8847         (is_cident): New function.
8848         * layout.cc (Layout::define_section_symbols): Replace string constants
8849         with the newly defined constants.
8850         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8851         C identifiers.
8852         * testsuite/Makefile.am: Add gc_orphan_section_test.
8853         * testsuite/Makefile.in: Regenerate.
8854         * testsuite/gc_orphan_section_test.cc: New file.
8855         * testsuite/gc_orphan_section_test.sh: New file.
8856
8857 2010-01-06  Ian Lance Taylor  <iant@google.com>
8858
8859         PR 10980
8860         * options.h (class General_options): Add --warn-shared-textrel.
8861         * layout.cc (Layout::finish_dynamic_section): Implement
8862         --warn-shared-textrel.
8863
8864         PR 10980
8865         * options.h (class General_options): Add --warn-multiple-gp.
8866
8867 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8868
8869         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8870         $(THREADSLIB) and $(LIBDL).
8871         * Makefile.in: Rebuild.
8872
8873 2010-01-06  Ian Lance Taylor  <iant@google.com>
8874
8875         PR 10980
8876         * options.cc (General_options::parse_section_start): New function.
8877         (General_options::section_start): New function.
8878         (General_options::General_options): Initialize all members.
8879         * options.h: Include <map>
8880         (class General_options): Add --section-start.  Add section_starts_
8881         member.
8882         * layout.cc (Layout::attach_allocated_section_to_segment): If
8883         --section-start was used, set the address of the segment.  Remove
8884         local sort_sections.
8885         (Layout::relaxation_loop_body): If the address of the load segment
8886         has been set by --section-start, don't use it.
8887         * output.h (Output_segment::update_flags_for_output_section): New
8888         function.
8889         * output.cc (Output_segment::add_output_section): Call
8890         update_flags_for_output_section.
8891
8892 2010-01-05  Ian Lance Taylor  <iant@google.com>
8893
8894         PR 10980
8895         * options.h (class General_options): Add --undefined-version.
8896         * script.cc (struct Version_expression): Add was_matched_by_symbol
8897         field.
8898         (Version_script_info::matched_symbol): New function.
8899         (Version_script_info::get_symbol_version_helper): Call
8900         matched_symbol.
8901         (Version_script_info::check_unmatched_names): New function.
8902         * script.h (class Version_script_info): Update declarations.
8903         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8904
8905         * options.h (class General_options): Use DEFINE_bool_alias for
8906         allow_multiple_definition.
8907         * resolve.cc (Symbol_table::should_override): Don't test
8908         allow_multiple_definition.
8909
8910         PR 10980
8911         * options.h (class General_options): Add --cref.
8912         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8913         until after printing cref table.
8914         * cref.cc: Include "symtab.h".
8915         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8916         (Cref_table_compare::operator()): New function.
8917         (Cref_inputs::gather_cref): New function.
8918         (filecol): New static const.
8919         (Cref_inputs::print_cref): New function.
8920         (Cref::print_cref): New function.
8921         * cref.h: Include <cstdio>.
8922         (class Cref): Update declarations.
8923         * mapfile.h (Mapfile::file): New function.
8924         * object.h (class Object): Define Symbols.  Declare virtual
8925         do_get_global_symbols.
8926         (Object::get_global_symbols): New function.
8927         * object.cc (Input_objects::add_object): Pass object to cref_ if
8928         --cref.
8929         (Input_objects::archive_start): Likewise.
8930         (Input_objects::archive_stop): Likewise.
8931         (Input_objects::print_cref): New function.
8932         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8933         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8934         --cref.
8935         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8936         function.
8937         * plugin.h (class Sized_pluginobj): Update declarations.
8938
8939 2010-01-05  Ian Lance Taylor  <iant@google.com>
8940
8941         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8942         to is_default_version.  Rename insdef to insdefault.
8943         (Symbol_table::add_from_relobj): Rename def to is_default_version
8944         and local to is_forced_local.
8945         (Symbol_table::add_from_pluginobj): Likewise.
8946         (Symbol_table::add_from_dynobj): Likewise.
8947         (Symbol_table::define_special_symbol): Rename insdef to
8948         insdefault.
8949
8950 2010-01-04  Ian Lance Taylor  <iant@google.com>
8951
8952         PR 10980
8953         * options.h (class General_options): Add
8954         --allow-multiple-definition and -z muldefs.
8955         * resolve.cc (Symbol_table::should_override): Don't warn about a
8956         multiple symbol definition if --allow-multiple-definition or -z
8957         muldefs.
8958
8959         PR 10980
8960         * options.h (class General_options): Add --add-needed and
8961         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8962         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8963         error if --copy-dt-needed-entries aka --add-needed is used and
8964         would cause a change in behaviour.
8965
8966         PR 10980
8967         * options.h (class General_options): Add -G as a short version of
8968         --shared.  Add no-op options -assert, -g, and -i.
8969
8970 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8971
8972         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8973         check for .text or .gnu.linkonce.t sections.
8974         * icf.cc (Icf::find_identical_sections): Ditto.
8975         Change the detection for mangled function name within the section
8976         name.
8977         * icf.h (is_section_foldable_candidate): New function.
8978
8979 2009-12-30  Ian Lance Taylor  <iant@google.com>
8980
8981         PR 10980
8982         * options.h (class General_options): Permit two dashes with
8983         --retain-symbols-file.
8984
8985 2009-12-30  Ian Lance Taylor  <iant@google.com>
8986
8987         PR 10979
8988         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8989         don't put the file header and segment headers in the text
8990         segment.
8991
8992         PR 10979
8993         * common.cc (Sort_commons::operator()): Stabilize sort when both
8994         entries are NULL.
8995         (Symbol_table::do_allocate_commons_list): When allocating common
8996         symbols, skip a symbol which is no longer common.
8997         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8998         an object before checking its type.
8999         * testsuite/common_test_2.c: New file.
9000         * testsuite/common_test_3.c: New file.
9001         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9002         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9003         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9004         (common_test_2_pic.o, common_test_2.so): New targets.
9005         (common_test_3_pic.o, common_test_3.so): New targets.
9006         * testsuite/Makefile.in: Rebuild.
9007
9008         PR 10979
9009         * script.cc (read_input_script): If we see a new SECTIONS clause,
9010         and we have added an input section, give an error.
9011         * layout.h (class Layout): Add have_added_input_section function.
9012         Add have_added_input_section_ field.
9013         * layout.cc (Layout::Layout): Initialize
9014         have_added_input_section_.
9015         (Layout::layout): Set have_added_input_section_.
9016         (Layout::layout_eh_frame): Likewise.
9017
9018 2009-12-30  Ian Lance Taylor  <iant@google.com>
9019
9020         PR 10931
9021         * options.h (class General_options): Add --sort-common option.
9022         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9023         * common.cc (Sort_common): Add sort_order parameter to
9024         constructor.  Add sort_order_ field.
9025         (Sort_commons::operator): Check sort_order_.
9026         (Symbol_table::allocate_commons): Determine the sort order.
9027         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9028         Change all callers.
9029         (Symbol_table::do_allocate_commons_list): Likewise.
9030
9031 2009-12-30  Ian Lance Taylor  <iant@google.com>
9032
9033         PR 10916
9034         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9035         symbols from this object, don't change the visibility of an
9036         undefined symbol.
9037         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9038
9039 2009-12-30  Ian Lance Taylor  <iant@google.com>
9040
9041         PR 10861
9042         * script.h (class Version_script_info): Define Language enum.
9043         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9044         new fields globals_, locals_, and is_finalized_.
9045         * script.cc: Various formatting fixes.
9046         (class Parser_closure): Change language_stack_ from a vector of
9047         std::string to one of Version_script_info::Language.  Adjust all
9048         uses accordingly.
9049         (class Lazy_demangler): Remove.
9050         (struct Version_expression): Change language from std::string to
9051         Version_script_info::Language.
9052         (Version_script_info::Version_script_info): New function.
9053         (Version_script_info::~Version_script_info): Don't call clear.
9054         (Version_script_info::finalize): New function.
9055         (Version_script_info::build_lookup_tables): New function.
9056         (Version_script_info::build_expression_list_lookup): New
9057         function.
9058         (Version_script_info::get_symbol_version_helper): Rewrite to use
9059         lookup tables.
9060         (Version_script_info::print_expression_list): Adjust to use
9061         Version_script_info::Language.
9062         (script_push_lex_into_version_mode): Check that the version script
9063         has not been finalized.
9064         (version_script_push_lang): Change language string to
9065         Version_script_info::Language.
9066         * options.cc (Command_line::version_script): New function.
9067         * options.h (class General_options): Add finalize_dynamic_list
9068         function.  Change version_script from declaration to definition.
9069         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9070         * testsuite/version_script.map: Remove duplicate def of foo.
9071         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9072         version_script.map.
9073         * testsuite/Makefile.in: Rebuild.
9074
9075 2009-12-30  Ian Lance Taylor  <iant@google.com>
9076
9077         PR 10843
9078         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9079         if the input symbol index is 0, make the output symbol index 0.
9080
9081 2009-12-30  Ian Lance Taylor  <iant@google.com>
9082
9083         PR 10670
9084         * options.h (class General_options): Add -x/--discard-all.
9085         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9086         --discard-all.  If the local symbol needs a dynamic entry, check
9087         that before handling --discard-locals.
9088
9089 2009-12-30  Ian Lance Taylor  <iant@google.com>
9090
9091         PR 10450
9092         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9093         flags to PF_R.
9094         (Output_segment::add_output_section): Don't change the flags if
9095         the type is PT_TLS.
9096
9097         PR 10450
9098         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9099         GNU hash table if they need a dynamic value.  Otherwise, don't add
9100         them if they are defined in a dynamic object or are forced local.
9101
9102 2009-12-29  Ian Lance Taylor  <iant@google.com>
9103
9104         PR 10450
9105         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9106         .gnu.hash table for a 32-bit target.
9107
9108         PR 10450
9109         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9110         regular and a dynamic object only needs a dynamic symbol table
9111         entry if it is externally visible.
9112
9113         PR 10450
9114         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9115         constructor.  Add global_offset_table_ field.
9116         (Target_i386::got_section): Set global_offset_table_.
9117         (Target_i386::do_finalize_sections): Set global_offset_table_
9118         size.
9119         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9120         in constructor.  Add global_offset_table_ field.
9121         (Target_x86_64::got_section): Set global_offset_table_.
9122         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9123         size.
9124
9125         * layout.cc (Layout::Layout): Initialize increase_relro_.
9126         (Layout::get_output_section): Add is_relro, is_last_relro, and
9127         is_first_non_relro parameters.  Change all callers.
9128         (Layout::choose_output_section): Likewise.
9129         (Layout::add_output_section_data): Likewise.
9130         (Layout::make_output_section): Likewise.
9131         (Layout::set_segment_offsets): Clear increase_relro when using a
9132         linker script.
9133         * layout.h (class Layout): Add increase_relro method.  Add
9134         increase_relro_ field.  Update declarations.
9135         * output.cc (Output_section::Output_section): Initialize
9136         is_last_relro_ and is_first_non_relro_.
9137         (Output_segment::add_output_section): Group relro sections is
9138         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9139         (Output_segment::maximum_alignment): Remove relro handling.
9140         (Output_segment::set_section_addresses): Add increase_relro
9141         parameter.  Change all callers.  Add initial alignment to align
9142         relro sections on separate page.  Remove old relro handling.
9143         (Output_segment::set_section_list_addresses): Remove in_relro
9144         parameter.  Change all callers.
9145         (Output_segment::set_offset): Add increase parameter.  Change all
9146         callers.  Remove old relro handling.
9147         * output.h (class Output_section): Add new methods: is_last_relro,
9148         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9149         Add is_last_relro_ and is_first_non_relro_ fields.
9150         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9151         Create separate .got.plt section.  Call increase_relro.
9152         * x86_64.cc (Target_x86_64::got_section): Likewise.
9153         * testsuite/relro_script_test.t: Add .got.plt.
9154
9155         PR 10450
9156         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9157         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9158         (Layout::finalize): Call set_dynamic_symbol_size.
9159         (Layout::set_dynamic_symbol_size): New function.
9160         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9161         set_dynamic_symbol_size.
9162
9163         PR 10450
9164         * output.h (class Output_section): Add is_entsize_zero_ field.
9165         * output.cc (Output_section::Output_section): Initialize
9166         is_entsize_zero_.
9167         (Output_section::set_entsize): If two different entsizes are
9168         requested, force it to zero.
9169         (Output_section::add_input_section): Set flags for .debug_str
9170         before updating section flags.  Set entsize.
9171         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9172         and SHF_STRING if all input sections have those flags.
9173
9174 2009-12-29   Rafael Espindola  <espindola@google.com>
9175
9176         * main.cc (main): Fix the sys time reporting.
9177         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9178         reporting.
9179
9180 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9181
9182         * options.cc (General_options::parse_version): Allow -v to exit
9183         without an error if there is nothing to link.
9184
9185 2009-12-29  Ian Lance Taylor  <iant@google.com>
9186
9187         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9188         using a version of gcc before 4.1.
9189         * configure: Rebuild.
9190
9191 2009-12-28  Chris Demetriou  <cgd@google.com>
9192
9193         * attributes.cc (Output_attributes_section_data::do_write): Use
9194         std::vector::front rather than std::vector::data.
9195
9196 2009-12-28  Ian Lance Taylor  <iant@google.com>
9197
9198         * symtab.h (class Symbol_table): Add enum Defined.
9199         * resolve.cc (Symbol_table::should_override): Add defined
9200         parameter.  Change all callers.  Test whether object is NULL
9201         before calling a method on it.
9202         (Symbol_table::report_resolve_problem): Add defined parameter.
9203         Change all callers.
9204         (Symbol_table::should_override_with_special): Likewise.
9205         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9206         parameter.  Change all callers.
9207         (Symbol_table::do_define_in_output_data): Likewise.
9208         (Symbol_table::define_in_output_segment): Likewise.
9209         (Symbol_table::do_define_in_output_segment): Likewise.
9210         (Symbol_table::define_as_constant): Likewise.
9211         (Symbol_table::do_define_as_constant): Likewise.
9212         * script.h (class Symbol_assignment): Add is_defsym parameter to
9213         constructor; change all callers.
9214         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9215         parameter.  Change all callers.  Add is_defsym_ field.
9216         (class Parser_closure): Add parsing_defsym parameter to
9217         constructor; change all callers.  Add parsing_defsym accessor
9218         function.  Add parsing_defsym_ field.
9219
9220 2009-12-28  Ian Lance Taylor  <iant@google.com>
9221
9222         * gold.cc (queue_middle_tasks): Fix formatting.
9223         * object.cc (Relobj::is_section_name_included): Likewise.
9224
9225 2009-12-23  Ian Lance Taylor  <iant@google.com>
9226
9227         * i386.cc (Target_i386::do_calls_non_split): Recognize
9228         -fsplit-stack prologue for a function with a static chain.
9229         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9230         -fsplit-stack prologue when using %r11.
9231
9232 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9233
9234         * options.cc (General_options::parse_version): Make -v continue and do
9235         the link like GNU ld does.
9236
9237 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9238
9239         * Makefile.am (CCFILES): Add timer.cc.
9240         (HFILES): Add timer.h.
9241         * configure.ac: Check for sysconf and times.
9242         * main.cc: include timer.h.
9243         (main): Use Timer instead of get_run_time.
9244         * timer.cc: New.
9245         * timer.h: New.
9246         * workqueue.cc: include timer.h.
9247         (Workqueue::find_and_run_task):
9248         Report user, sys and wall time.
9249         * Makefile.in: Regenerate.
9250         * config.in: Regenerate.
9251         * configure: Regenerate.
9252
9253 2009-12-16  Doug Kwan  <dougkwan@google.com>
9254
9255         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9256         sections.
9257         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9258         relaxed input sections.
9259         * output.cc (Output_section::find_relaxed_input_section): Change
9260         return type to Output_relaxed_input_section pointer.  Adjust code
9261         for new type of relaxed_input_section_map_.
9262         * output.h (Output_section::find_relaxed_input_section): Change
9263         return type to Output_relaxed_input_section pointer.
9264         (Output_section::Output_relaxed_input_section_by_input_section_map):
9265         New type.
9266         (Output_section::relaxed_input_section_map_): Change type to
9267         Output_section::Output_relaxed_input_section_by_input_section_map.
9268         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9269         input section.
9270
9271 2009-12-15  Ian Lance Taylor  <iant@google.com>
9272
9273         * layout.cc (Layout::create_shstrtab): Only write out after input
9274         sections if we are compressing debug sections.
9275
9276 2009-12-15  Ian Lance Taylor  <iant@google.com>
9277
9278         * archive.cc (Archive::add_symbols): Only look up a symbol without
9279         a version if there is, in fact, a version.
9280
9281 2009-12-14  Ian Lance Taylor  <iant@google.com>
9282
9283         Revert -Wshadow changes, all changes from:
9284         2009-12-11  Doug Kwan  <dougkwan@google.com>
9285         2009-12-11  Nick Clifton  <nickc@redhat.com>
9286         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9287
9288 2009-12-11  Doug Kwan  <dougkwan@google.com>
9289
9290         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9291         due to -Wshadow.
9292         * attributes.cc (Object_attribute::size): Ditto.
9293         (Attributes_section_data::size): Ditto.
9294         (Attributes_section_data::Attributes_section_data): Ditto.
9295         (Output_attributes_section_data::do_write): Ditto.
9296         * attributes.h (Object_attribute::set_type): Ditto.
9297         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9298
9299 2009-12-11  Nick Clifton  <nickc@redhat.com>
9300
9301         * archive.cc: Fix shadowed variable warnings.
9302         * arm.cc: Likewise.
9303         * compressed_output.cc: Likewise.
9304         * compressed_output.h: Likewise.
9305         * configure: Likewise.
9306         * dwarf_reader.cc: Likewise.
9307         * dynobj.cc: Likewise.
9308         * dynobj.h: Likewise.
9309         * ehframe.cc: Likewise.
9310         * ehframe.h: Likewise.
9311         * errors.cc: Likewise.
9312         * expression.cc: Likewise.
9313         * fileread.cc: Likewise.
9314         * fileread.h: Likewise.
9315         * freebsd.h: Likewise.
9316         * i386.cc: Likewise.
9317         * icf.cc: Likewise.
9318         * incremental.h: Likewise.
9319         * layout.cc: Likewise.
9320         * layout.h: Likewise.
9321         * mapfile.cc: Likewise.
9322         * merge.cc: Likewise.
9323         * merge.h: Likewise.
9324         * object.cc: Likewise.
9325         * object.h: Likewise.
9326         * options.h: Likewise.
9327         * output.cc: Likewise.
9328         * output.h: Likewise.
9329         * parameters.cc: Likewise.
9330         * plugin.cc: Likewise.
9331         * powerpc.cc: Likewise.
9332         * reduced_debug_output.cc: Likewise.
9333         * reduced_debug_output.h: Likewise.
9334         * reloc.cc: Likewise.
9335         * reloc.h: Likewise.
9336         * resolve.cc: Likewise.
9337         * script-sections.cc: Likewise.
9338         * script.cc: Likewise.
9339         * script.h: Likewise.
9340         * sparc.cc: Likewise.
9341         * symtab.cc: Likewise.
9342         * symtab.h: Likewise.
9343         * target-select.cc: Likewise.
9344         * target-select.h: Likewise.
9345         * token.h: Likewise.
9346         * workqueue.cc: Likewise.
9347         * workqueue.h: Likewise.
9348         * x86_64.cc: Likewise.
9349
9350 2009-12-10  Doug Kwan  <dougkwan@google.com>
9351
9352         * arm.cc (attributes.h): New include.
9353         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9354         (Arm_relobj::~Arm_relobj): Delete object pointed by
9355         attributes_section_data_.
9356         (Arm_relobj::attributes_section_data): New method definition.
9357         (Arm_relobj::attributes_section_data_): New data member declaration.
9358         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9359         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9360         attributes_section_data_.
9361         (Arm_dynobj::attributes_section_data): New method definition.
9362         (Arm_dynobj::attributes_section_data_): New data member declaration.
9363         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9364         initialization value of may_use_blx_ to false.
9365         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9366         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9367         object attributes to compute results instead of hard-coding.
9368         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9369         Target_arm::get_secondary_compatible_arch,
9370         Target_arm::set_secondary_compatible_arch
9371         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9372         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9373         New method declarations.
9374         (Target_arm::get_aeabi_object_attribute): New method definition.
9375         (Target_arm::attributes_section_data_): New data member declaration.
9376         (read_arm_attributes_section): New template definition.
9377         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9378         (Arm_dynobj::do_read_symbols): Ditto.
9379         (Target_arm::do_finalize_sections): Merge attributes sections from
9380         input.  Check for BLX use after attributes section merging.
9381         Fix __exidx_start and __exidx_end visibility.  Create an
9382         .ARM.attributes section if necessary.
9383         (Target_arm::get_secondary_compatible_arch,
9384         Target_arm::set_secondary_compatible_arch,
9385         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9386         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9387         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9388         New method definitions.
9389
9390 2009-12-09  Ian Lance Taylor  <iant@google.com>
9391
9392         * plugin.cc (Plugin::load): Don't cast from void* to a function
9393         pointer.
9394
9395 2009-12-09  Ian Lance Taylor  <iant@google.com>
9396
9397         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9398         information fields.
9399
9400 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9401
9402         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9403         Replace two_file_shared_1.so with two_file_shared_2.so.
9404         * testsuite/Makefile.in: Regenerated.
9405
9406 2009-12-08  Doug Kwan  <dougkwan@google.com>
9407
9408         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9409         (HFILES): Add attributes.h and int_encoding.h.
9410         * Makefile.in: Regenerate.
9411         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9412         function definitions to int_encoding.cc
9413         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9414         prototypes to int_encoding.h
9415         * reduced_debug_output.cc (int_encoding.h): New include.
9416         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9417         function definitions to int_encoding.cc
9418         (insert_into_vector, read_from_pointer): Move template definitions to
9419         int_encoding.h
9420         * attributes.cc: New file.
9421         * attributes.h: New file.
9422         * int_encoding.cc: New file.
9423         * int_encoding.h: New file.
9424
9425 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9426
9427         PR gold/11055
9428         * incremental-dump.cc (dump_incremental_inputs): New.
9429         (main): Use dump_incremental_inputs.
9430
9431 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9432
9433         PR gold/10893
9434         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9435         checking elfcpp::STT_FUNC.
9436         (Target_i386::Relocate::relocate): Likewise.
9437         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9438
9439         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9440         symbols from shared libraries into normal FUNC symbols.
9441
9442         * symtab.h (Symbol): Add is_func and use it.
9443
9444 2009-12-05  Doug Kwan  <dougkwan@google.com>
9445
9446         * arm.cc (Target_arm::arm_info): Initialize new fields
9447         attributes_section and attributes_vendor.
9448         * i386.cc (Target_i386::i386_info): Same.
9449         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9450         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9451         fields attributes_section and attributes_vendor.
9452         * sparc.cc (Target_sparc::sparc_info): Same.
9453         * target.h (Target::attributes_section, Target::attributes_vendor,
9454         Target::is_attributes_section, Target::attribute_arg_type,
9455         Target::attributes_order): New method definitions.
9456         (Target::Target_info::attributes_section,
9457         Target::Target_info::attributes_vendor): New fields.
9458         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9459         virtual method definitions.
9460         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9461         attributes_section and attributes_vendor.
9462         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9463
9464 2009-12-05  Doug Kwan  <dougkwan@google.com>
9465
9466         * arm.cc: Update comments about interworking and stub generation.
9467         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9468         considered as non-PIC.
9469         (Arm_relocate_functions::base_abs): Fix formatting.
9470         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9471         of function to use GOT entry address instead of offset.
9472         (Target_arm::Scan::global): Issue an error if a symbol would need a
9473         PLT does not get one because it is untyped.  Remove code to create
9474         dynamic symbols for relative branches.
9475         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9476         takes unsigned integer instead of boolean.
9477
9478 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9479
9480         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9481         (two_file_test_LDADD): Likewise.
9482         (common_test_1_LDADD): Likewise.
9483         (exception_test_LDADD) Likewise.
9484         (weak_test_LDADD): Likewise.
9485         (many_sections_test_LDADD): Likewise.
9486         (initpri1_LDADD): Likewise.
9487         (script_test_1_LDADD): Likewise.
9488         (script_test_2_LDADD): Likewise.
9489         (justsyms_LDADD): Likewise.
9490         (binary_test_LDADD): Likewise.
9491         (large_LDADD): Likewise.
9492         * testsuite/Makefile.in: Regenerated.
9493
9494 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9495
9496         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9497         (Symbol_table::override_with_special): Likewise.
9498         (Symbol_table::add_from_object): Likewise.
9499
9500 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9501
9502         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9503         Don't set the data_offset twice.
9504
9505 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9506
9507         * testsuite/Makefile.in: Regenerate.
9508
9509 2009-12-03  Doug Kwan  <dougkwan@google.com>
9510
9511         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9512         (Target_arm::do_finalize_sections): Add parameter for symbol table
9513         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9514         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9515         parameter for symbol table pointer.
9516         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9517         an additional parameter for a pointer to symbol table.
9518         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9519         parameter for a symbol table pointer.
9520         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9521         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9522         Ditto.
9523         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9524         parameter for a symbol table pointer.
9525
9526 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9527
9528         * incremental.cc (Incremental_inputs_header)
9529         (Incremental_inputs_header_write, Incremental_inputs_entry)
9530         (Incremental_inputs_entry_write): Move ...
9531         * incremental.h (Incremental_inputs_header)
9532         (Incremental_inputs_header_write, Incremental_inputs_entry)
9533         (Incremental_inputs_entry_write): here.
9534
9535 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9536
9537         * incremental.cc (make_sized_incremental_binary): Set the target.
9538         Error if it is incompatible.
9539         * output.h (Output_file): Add filename method.
9540
9541 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9542
9543         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9544         from the get_* methods.
9545
9546 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9547
9548         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9549         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9550         Write 0 for the data_offset of scripts.
9551
9552 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9553
9554         * testsuite/Makefile.am: Add the incremental_test.sh test.
9555         * testsuite/incremental_test.sh: New.
9556         * testsuite/incremental_test_1.c: New.
9557         * testsuite/incremental_test_2.c: New.
9558
9559 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9560
9561         * incremental-dump.cc (main): Fix typos.
9562
9563 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9564
9565         PR gold/11025
9566         * incremental-dump.cc (main): Use llu to print 64 bit values.
9567
9568 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9569             H.J. Lu  <hongjiu.lu@intel.com>
9570
9571         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9572         $(LIBDL).
9573         (incremental_dump_LDADD): Likewise.
9574         * Makefile.in: Regenerated.
9575
9576 2009-11-25  Doug Kwan  <dougkwan@google.com>
9577
9578         Revert:
9579
9580         2009-11-25  Doug Kwan  <dougkwan@google.com>
9581
9582                 * arm.cc (Target_arm::Target_arm): Move method definition
9583                 outside of class definition.  Add code to handle
9584                 --target1-rel, --target1-abs and --target2= options.
9585                 (Target_arm::get_reloc_reloc_type): Change method to be
9586                 non-static and const.
9587                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9588                 New data member declaration.
9589                 (Target_arm::Scan::local, Target_arm::Scan::global,
9590                 Target_arm::Relocate::relocate,
9591                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9592                 Adjust call to Target_arm::get_real_reloc_type.
9593                 (Target_arm::get_real_reloc_type): Use command line options
9594                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9595                 * options.h (--target1-rel, --target1-abs, --target2): New
9596                 ARM-only options.
9597
9598 2009-11-25  Doug Kwan  <dougkwan@google.com>
9599
9600         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9601         class definition.  Add code to handle --target1-rel, --target1-abs
9602         and --target2= options.
9603         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9604         and const.
9605         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9606         member declaration.
9607         (Target_arm::Scan::local, Target_arm::Scan::global,
9608         Target_arm::Relocate::relocate,
9609         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9610         call to Target_arm::get_real_reloc_type.
9611         (Target_arm::get_real_reloc_type): Use command line options to
9612         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9613         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9614         options.
9615
9616 2009-11-25  Doug Kwan  <dougkwan@google.com>
9617
9618         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9619         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9620         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9621         formatting.
9622         (Arm_relocate_functions::thm_call): Replace body with a call to
9623         Arm_relocate_functions::thumb_branch_common.
9624         (Arm_relocate_functions::thm_jump24,
9625         Arm_relocate_functions::thm_xpc22): New method definitions.
9626         (Arm_relocate_functions::thumb_branch_common): New method definition.
9627         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9628         operator.
9629         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9630         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9631
9632 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9633
9634         * Makefile.am: Build incremental-dump
9635         * Makefile.in: Regenerate.
9636         * incremental-dump.cc: New.
9637         * incremental.cc (Incremental_inputs_header_data,
9638         Incremental_inputs_entry_data): Move to incremental.h
9639         * incremental.h: (Incremental_inputs_header_data,
9640         Incremental_inputs_entry_data): Move from incremental.cc
9641
9642 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9643
9644         * incremental.cc (Incremental_inputs_header,
9645         Incremental_inputs_header_write, Incremental_inputs_entry,
9646         Incremental_inputs_entry_write): Add a typedef with the data type.
9647
9648 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9649
9650         * incremental.cc (Incremental_inputs_header,
9651         Incremental_inputs_header_write, Incremental_inputs_entry,
9652         Incremental_inputs_entry_write): Update comment about which
9653         type has the filed descriptions.
9654
9655 2009-11-15  Doug Kwan  <dougkwan@google.com>
9656
9657         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9658         (Arm_relocate_functions::arm_branch_common): Change method defintion
9659         in class definition to a method declaration and update list of formal
9660         parameters.
9661         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9662         Arm_relocation_functions::jump24): Adjust call to
9663         Arm_relocate_functions::arm_branch_common.  Update list of formal
9664         parameters.
9665         (Arm_relocate_functions::xpc25): New method definition.
9666         (Arm_relocate_functions::arm_branch_common): Move method defintion
9667         out from class definition.  Use stubs for mode-switching and extending
9668         branch ranges.
9669         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9670         specially.  Change code to enable use of stubs in ARM branches.
9671
9672 2009-11-10  Doug Kwan  <dougkwan@google.com>
9673
9674         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9675         in method declaration.
9676         (Target_arm::relocate_stub): New method declaration.
9677         (Target_arm::default_target): Change to return a pointer instead of
9678         a const reference.
9679         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9680         Target_arm::default_target.
9681         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9682         method definition.
9683         (Target_arm::relocate_section): Adjust view.
9684         (Target_arm::relocate_stub): New method definition.
9685
9686 2009-11-10  Doug Kwan  <dougkwan@google.com>
9687
9688         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9689         a format warning.
9690         * incremental.cc (open_incremental_binary): Initialized local
9691         variables to avoid warnings.
9692         * object.cc (make_elf_object): Ditto.
9693         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9694         a format warning.
9695
9696 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9697
9698         PR gold/10930
9699         * testsuite/plugin_test.c: Include "config.h".
9700
9701 2009-11-09  Doug Kwan  <dougkwan@google.com>
9702
9703         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9704         (arm_symbol_value): Remove.
9705         (Arm_relocate_functions::arm_branch_common,
9706         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9707         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9708         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9709         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9710         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9711         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9712         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9713         Arm_relocate_functions::thm_mobw_abs_nc,
9714         Arm_relocate_functions::thm_mov_abs,
9715         Arm_relocate_functions::movw_prel_nc,
9716         Arm_relocate_functions::thm_movt_abs,
9717         Arm_relocate_functions::movt_prel,
9718         Arm_relocate_functions::thm_movw_prel_nc,
9719         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9720         (Target_arm::Relocate::relocate): Only decompose address into two
9721         parts if relocation type uses the thumb-bit and pass the actual
9722         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9723         calls to methods in Arm_relocate_functions for this change.
9724
9725 2009-11-08  Ian Lance Taylor  <iant@google.com>
9726
9727         PR 10925
9728         * reloc.cc: Instantiate
9729         Sized_relobj::initialize_input_to_output_maps and
9730         Sized_relobj:free_input_to_output_maps.
9731
9732 2009-11-06  Ian Lance Taylor  <iant@google.com>
9733
9734         PR 10876
9735         * defstd.cc (in_segment): Set only_if_ref true for "end".
9736
9737 2009-11-06  Doug Kwan  <dougkwan@google.com>
9738
9739         * arm.cc (class Reloc_stub): Correct a comment.
9740         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9741         (Target_arm::scan_section_for_stubs): New method declaration.
9742         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9743         Change methods from private to protected.
9744         (Target_arm::do_may_relax): New method definition.
9745         (Target_arm::do_relax, Target_arm::group_sections,
9746         Target_arm::scan_reloc_for_stub,
9747         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9748         (Target_arm::arm_input_section_map_): New data member declaration.
9749         (Target_arm::scan_reloc_for_stub,
9750         Target_arm::scan_reloc_section_for_stubs,
9751         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9752         Target_arm::do_relax): New method definitions.
9753
9754 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9755
9756         * configure.ac: Check for (struct stat)::st_mtim
9757         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9758         * config.in: Regenerate.
9759         * configure: Regenerate.
9760
9761 2009-11-05  Ian Lance Taylor  <iant@google.com>
9762
9763         PR 10910
9764         * output.cc (Output_segment::add_output_section): Add missing
9765         return statement.
9766
9767 2009-11-04  Ian Lance Taylor  <iant@google.com>
9768
9769         PR 10880
9770         * object.h (class Object): Add is_needed and set_is_needed
9771         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9772         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9773         defined in a dynamic object and referenced by a regular object,
9774         set is_needed for the dynamic object.
9775         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9776         if the file is marked with as_needed and it is not needed.
9777
9778 2009-11-04  Ian Lance Taylor  <iant@google.com>
9779
9780         PR 10887
9781         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9782         tags if data is discarded by linker script.
9783         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9784         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9785         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9786         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9787
9788 2009-11-04  Ian Lance Taylor  <iant@google.com>
9789
9790         * layout.cc (Layout::get_output_section): Add is_interp and
9791         is_dynamic_linker_section parameters.  Change all callers.
9792         (Layout::choose_output_section): Likewise.
9793         (Layout::make_output_section): Likewise.
9794         (Layout::add_output_section_data): Add is_dynamic_linker_section
9795         parameter.  Change all callers.
9796         * layout.h (class Layout): Update declarations.
9797         * output.h (class Output_section): Add is_interp, set_is_interp,
9798         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9799         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9800         generate_code_fills_at_write_ to a bitfield.
9801         * output.cc (Output_section::Output_sections): Initialize new
9802         fields.
9803         (Output_segment::add_output_section): Add do_sort parameter.
9804         Change all callers.
9805
9806 2009-11-03  Ian Lance Taylor  <iant@google.com>
9807
9808         PR 10860
9809         * options.h (class General_options): Add --warn-common.
9810         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9811         merging two common symbols.
9812         (Symbol_table::should_override): Handle --warn-common when merging
9813         a common symbol with a defined symbol.  Use report_resolve_problem
9814         for multiple definitions.
9815         (Symbol_table::report_resolve_problem): New function.
9816         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9817
9818 2009-11-03  Doug Kwan  <dougkwan@google.com>
9819
9820         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9821         stub_factory_.
9822         (Target_arm::stub_factory): New method definition.
9823         (Target_arm::new_arm_input_section,
9824         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9825         Target_arm::reloc_uses_thumb_bit): New method declarations.
9826         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9827         New type definitions.
9828         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9829         member declarations.
9830         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9831         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9832         New method definitions.
9833
9834 2009-11-03  Ian Lance Taylor  <iant@google.com>
9835
9836         * options.h (class General_options): Add --warn_constructors.
9837
9838 2009-11-03  Ian Lance Taylor  <iant@google.com>
9839
9840         PR 10893
9841         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9842         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9843
9844 2009-11-03  Ian Lance Taylor  <iant@google.com>
9845
9846         PR 10895
9847         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9848         --msgid-bugs-address.
9849         (install-pdf): New target.
9850         (install-data_yes): Look up one directory to find mkinstalldirs.
9851
9852 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9853
9854         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9855         tree.
9856
9857 2009-10-30  Doug Kwan  <dougkwan@google.com>
9858
9859         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9860
9861 2009-10-30  Doug Kwan  <dougkwan@google.com>
9862
9863         * arm.cc (Stub_addend_reader): New struct template definition
9864         and partial specializations.
9865         (Stub_addend_reader::operator()): New method definition for a
9866         partially specialized template.
9867
9868 2009-10-30  Doug Kwan  <dougkwan@google.com>
9869
9870         * arm.cc (Arm_relobj::processor_specific_flags): New method
9871         definition.
9872         (Arm_relobj::do_read_symbols): New method declaration.
9873         (Arm_relobj::processor_specific_flags_): New data member declaration.
9874         (Arm_dynobj): New class definition.
9875         (Target_arm::do_finalize_sections): Add input_objects parameter.
9876         (Target_arm::do_adjust_elf_header): New method declaration.
9877         (Target_arm::are_eabi_versions_compatible,
9878         (Target_arm::merge_processor_specific_flags): New method declaration.
9879         (Target_arm::do_make_elf_object): New overloaded method definitions
9880         and declaration.
9881         (Arm_relobj::do_read_symbols): New method definition.
9882         (Arm_dynobj::do_read_symbols): Ditto.
9883         (Target_arm::do_finalize_sections): Add input_objects parameters.
9884         Merge processor-specific flags from all input objects.
9885         (Target_arm::are_eabi_versions_compatible,
9886         Target_arm::merge_processor_specific_flags,
9887         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9888         New method definitions.
9889         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9890         Input_objects pointer type parameter.
9891         * layout.cc (Layout::finalize): Pass input objects to target's.
9892         finalize_sections function.
9893         * output.cc (Output_file_header::do_sized_write): Set ELF file
9894         header's processor-specific flags.
9895         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9896         Input_objects pointer type parameter.
9897         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9898         * target.h (Input_objects): New forward class declaration.
9899         (Target::processor_specific_flags,
9900         Target::are_processor_specific_flags_sect): New method definitions.
9901         (Target::finalize_sections): Add input_objects parameter.
9902         (Target::Target): Initialize processor_specific_flags_ and
9903         are_processor_specific_flags_set_.
9904         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9905         parameter.
9906         (Target::set_processor_specific_flags): New method definition.
9907         (Target::processor_specific_flags_,
9908         Target::are_processor_specific_flags_set_): New data member
9909         declarations.
9910         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9911         Input_objects pointer type parameter.
9912
9913 2009-10-30  Doug Kwan  <dougkwan@google.com>
9914
9915         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9916
9917 2009-10-28  Ian Lance Taylor  <iant@google.com>
9918
9919         * object.h (class Relobj): Drop options parameter from
9920         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9921         do_scan_relocs, do_relocate.  Change all callers.
9922         (class Sized_relobj): Drop options parameters from
9923         do_gc_process_relocs, do_scan_relocs, do_relocate,
9924         do_relocate_sections, relocate_sections, emit_relocs_scan,
9925         emit_relocs_scan_reltype.  Change all callers.
9926         (struct Relocate_info): Remove options field and all references to
9927         it.
9928         * reloc.h (class Read_relocs): Remove options constructor
9929         parameter and options_ field.  Change all callers.
9930         (class Gc_process_relocs, class Scan_relocs): Likewise.
9931         (class Relocate_task): Likewise.
9932         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9933         all callers.
9934         (scan_relocatable_relocs): Likewise.
9935         * target.h (class Sized_target): Remove options parameter from
9936         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9937         all callers.
9938         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9939         callers.
9940         * arm.cc: Update functions to remove options parameters.
9941         * i386.cc: Likewise.
9942         * powerpc.cc: Likewise.
9943         * sparc.cc: Likewise.
9944         * x86_64.cc: Likewise.
9945         * testsuite/testfile.cc: Likewise.
9946
9947 2009-10-28  Doug Kwan  <dougkwan@google.com>
9948
9949         * arm.cc (Arm_relobj): New class definition.
9950         (Arm_relobj::scan_sections_for_stubs,
9951         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9952         New method definitions.
9953
9954 2009-10-28  Cary Coutant  <ccoutant@google.com>
9955
9956         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9957         (Plugin::cleanup_done_): New member.
9958         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9959         (Plugin_manager::cleanup_done_): Remove.
9960         (Plugin_manager::add_input_file): Edit error message.
9961         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9962         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9963
9964 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9965
9966         * fileread.cc: (File_read::View::~View): Use the new
9967         data_ownership_ filed.
9968         (File_read::~File_read): Dispose the new whole_file_view_.
9969         (File_read::open): Mmap the whole file if needed.
9970         (File_read::open): Use whole_file_view_ instead of contents_.
9971         (File_read::find_view): Use whole_file_view_ if applicable.
9972         (File_read::do_read): Use whole_file_view_ instead of contents_.
9973         (File_read::make_view): Use whole_file_view_ instead of contents_,
9974         update File_read::View::View call.
9975         (File_read::find_or_make_view): Update File_read::View::View
9976         call.
9977         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9978         remove contents_
9979         (File_read::View::Data_ownership): New enum.
9980         (File_read::View::View): Replace bool mapped_ with Data_ownership
9981         argument.
9982         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9983         (File_read::View::data_ownership_): New field.
9984         (File_read::contents_): Remove (replaced by whole_file_view_).
9985         (File_read::whole_file_view_): New field.
9986         * options.h (class General_options): Add --keep-files-mapped.
9987
9988 2009-10-27  Cary Coutant  <ccoutant@google.com>
9989
9990         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9991         * testsuite/Makefile.am (plugin_test_5): New test case.
9992         * testsuite/Makefile.in: Regenerate.
9993
9994 2009-10-25  Doug Kwan  <dougkwan@google.com>
9995
9996         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9997         from private to protected to allow access by child class.
9998         (Sized_relobj::do_relocate_sections): New method declaration.
9999         (Sized_relobj::relocate_sections): Virtualize.
10000         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10001         Sized_relobj::relocate_sections.  Instantiate template explicitly
10002         for different target sizes and endianity.
10003
10004 2009-10-24  Doug Kwan  <dougkwan@google.com>
10005
10006         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10007         (Arm_input_section::as_arm_input_section): New method.
10008         (Arm_output_section): New class definition.
10009         (Arm_output_section::create_stub_group,
10010         Arm_output_section::group_sections): New method definitions.
10011
10012 2009-10-22  Doug Kwan  <dougkwan@google.com>
10013
10014         * arm.cc (Arm_input_section): New class definition.
10015         (Arm_input_section::init, Arm_input_section:do_write,
10016         Arm_input_section::set_final_data_size,
10017         Arm_input_section::do_reset_address_and_file_offset): New method
10018         definitions.
10019
10020 2009-10-21  Doug Kwan  <dougkwan@google.com>
10021
10022         * arm.cc (Stub_table, Arm_input_section): New forward class
10023         declarations.
10024         (Stub_table): New class defintion.
10025         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10026         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10027         New method definition.
10028
10029 2009-10-21  Doug Kwan  <dougkwan@google.com>
10030
10031         * arm.cc: Update copyright comments.
10032         (Target_arm): New forward class template declaration.
10033         (Arm_address): New type.
10034         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10035         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10036         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10037         constants.
10038         (Insn_template): Same.
10039         (DEF_STUBS): New macro.
10040         (Stub_type): New enum type.
10041         (Stub_template): New class definition.
10042         (Stub): Same.
10043         (Reloc_stub): Same.
10044         (Stub_factory): Same.
10045         (Target_arm::Target_arm): Initialize may_use_blx_ and
10046         should_force_pic_veneer_.
10047         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10048         Target_arm::should_force_pic_veneer,
10049         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10050         Target_arm::using_thumb_only, Target_arm:;default_target): New
10051         method defintions.
10052         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10053         New data member declarations.
10054         (Insn_template::size, Insn_template::alignment): New method defintions.
10055         (Stub_template::Stub_template): New method definition.
10056         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10057         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10058         (Stub_factory::Stub_factory): New method definition.
10059         * gold.h (string_hash): New template.
10060         * output.h (Input_section_specifier::hash_value): Use
10061         gold::string_hash.
10062         (Input_section_specifier::string_hash): Remove.
10063         * stringpool.cc (Stringpool_template::string_hash): Use
10064         gold::string_hash.
10065
10066 2009-10-20  Doug Kwan  <dougkwan@google.com>
10067
10068         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10069         symbols of relaxed input sections.
10070         * output.h (Output_section::find_relaxed_input_section): Make
10071         method public.
10072
10073 2009-10-16  Doug Kwan  <dougkwan@google.com>
10074
10075         * dynobj.cc (Versions::Versions): Initialize version_script_.
10076         Only insert base version symbol definition for a shared object
10077         if version script defines any version versions.
10078         (Versions::define_base_version): New method definition.
10079         (Versions::add_def): Check that base version is not needed.
10080         (Versions::add_need): Define base version lazily.
10081         * dynobj.h (Versions::define_base_version): New method declaration.
10082         (Versions::needs_base_version_): New data member declaration.
10083         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10084         (check_DATA): Add no_version_test.stdout.
10085         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10086         New make rules.
10087         * testsuite/Makefile.in: Regenerate.
10088         * testsuite/no_version_test.c: New file.
10089         * testsuite/no_version_test.sh: Ditto.
10090
10091 2009-10-16  Doug Kwan  <dougkwan@google.com>
10092
10093         * expression.cc (class Segment_start_expression): New class definition.
10094         (Segment_start_expression::value): New method definition.
10095         (script_exp_function_segment_start): Return a new
10096         Segment_start_expression.
10097         * gold/script-c.h (script_saw_segment_start_expression): New function
10098         prototype.
10099         * script-sections.cc (Script_sections::Script_sections): Initialize
10100         SAW_SEGMENT_START_EXPRESSION_ to false.
10101         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10102         and -Tbbs options to specify section addresses if given in
10103         command line and no SEGMENT_START expression is seen in a script.
10104         * script-sections.h (Script_sections::saw_segment_start_expression,
10105         Script_sections::set_saw_segment_start_expression): New method
10106         definition.
10107         (Script_sections::saw_segment_start_expression_): New data member
10108         declaration.
10109         * script.cc (script_saw_segment_start_expression): New function.
10110         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10111         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10112         script_test_7.sh and script_test_8.sh.
10113         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10114         script_test_8.stdout.
10115         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10116         (script_test_6, script_test_6.stdout, script_test_7,
10117         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10118         * Makefile.in: Regenerate.
10119         * testsuite/script_test_6.sh: New file.
10120         * testsuite/script_test_6.t: Same.
10121         * testsuite/script_test_7.sh: Same.
10122         * testsuite/script_test_7.t: Same.
10123         * testsuite/script_test_8.sh: Same.
10124
10125 2009-10-16  Doug Kwan  <dougkwan@google.com>
10126
10127         * output.cc (Output_segment::set_section_list_address): Cast
10128         expressions to unsigned long long type to avoid format warnings.
10129
10130 2009-10-15  Ian Lance Taylor  <iant@google.com>
10131
10132         * script.cc (Script_options::add_symbol_assignment): Always add a
10133         dot assignment to script_sections_.
10134         * script-sections.cc (Script_sections::add_dot_assignment):
10135         Initialize if necessary.
10136
10137         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10138         program headers with no load segment if there is a linker script.
10139
10140         * layout.cc (Layout::set_segment_offsets): Align the file offset
10141         to the segment aligment for -N or -n with no load segment.
10142         * output.cc (Output_segment::add_output_section): Don't crash if
10143         the first section is a TLS section.
10144         (Output_segment::set_section_list_addresses): Print an error
10145         message if the address moves backward in a linker script.
10146         * script-sections.cc
10147         (Output_section_element_input::set_section_addresses): Don't
10148         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10149         (Orphan_output_section::set_section_addresses): Likewise.
10150
10151 2009-10-15  Doug Kwan  <dougkwan@google.com>
10152
10153         * layout.cc (Layout::finish_dynamic_section): Generate tags
10154         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10155         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10156         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10157
10158 2009-10-14  Ian Lance Taylor  <iant@google.com>
10159
10160         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10161         fields.
10162         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10163         data_shdr fields of relinfo.
10164         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10165         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10166         R_386_TLS_LDO_32, adjust based on section flags.
10167         (Target_i386::Relocate::fix_up_ldo): Remove.
10168
10169 2009-10-13  Ian Lance Taylor  <iant@google.com>
10170
10171         Add support for -pie.
10172         * options.h (class General_options): Add -pie and
10173         --pic-executable.
10174         (General_options::output_is_position_independent): Test -pie.
10175         (General_options::output_is_executable): Return true if not shared
10176         and not relocatable.
10177         (General_options::output_is_pie): Remove.
10178         * options.cc (General_options::finalize): Reject incompatible uses
10179         of -pie.
10180         * gold.cc (queue_middle_tasks): A -pie link is not static.
10181         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10182         * symtab.cc (Symbol::final_value_is_known): Return false if
10183         output_is_position_independent.
10184         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10185         output_is_position_independent.
10186         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10187         output_is_position_independent.
10188         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10189         output_is_position_independent.
10190         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10191         two_file_pie_test.
10192         (basic_pie_test.o, basic_pie_test): New targets.
10193         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10194         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10195         (two_file_pie_test): New target.
10196         * testsuite/Makefile.in: Rebuild.
10197         * README: Remove note saying that -pie is not supported.
10198
10199 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10200
10201         * options.h (class General_options): Add -init and -fini.
10202         * layout.cc (Layout::finish_dynamic_section): Emit
10203         given init and fini functions.
10204
10205 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10206
10207         * gc.h (gc_process_relocs): Check if icf is enabled using new
10208         function.
10209         * gold.cc (queue_initial_tasks): Likewise.
10210         (queue_middle_tasks): Likewise.
10211         * object.cc (do_layout): Likewise.
10212         * symtab.cc (is_section_folded): Likewise.
10213         * main.cc (main): Likewise.
10214         * reloc.cc (Read_relocs::run): Likewise.
10215         (Sized_relobj::do_scan_relocs): Likewise.
10216         * icf.cc (is_function_ctor_or_dtor): New function.
10217         (Icf::find_identical_sections): Check if function is ctor or dtor when
10218         safe icf is chosen.
10219         * options.h (General_options::icf): Change option to be an enum.
10220         (Icf_status): New enum.
10221         (icf_enabled): New method.
10222         (icf_safe_folding): New method.
10223         (set_icf_status): New method.
10224         (icf_status_): New variable.
10225         * (options.cc) (General_options::finalize): Set icf_status_.
10226         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10227         icf_test and icf_keep_unique_test to use the --icf enum flag.
10228         * testsuite/icf_safe_test.sh: New file.
10229         * testsuite/icf_safe_test.cc: New file.
10230
10231 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10232
10233         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10234         includes to gc.h and icf.h.
10235         * arm.cc: Include gc.h.
10236         * gold.cc: Likewise.
10237         * i386.cc: Likewise.
10238         * powerpc.cc: Likewise.
10239         * sparc.cc: Likewise.
10240         * x86_64.cc: Likewise.
10241         * gc.h: Include icf.h.
10242
10243 2009-10-11  Ian Lance Taylor  <iant@google.com>
10244
10245         * plugin.cc: Include "gold.h" before other header files.
10246
10247 2009-10-10  Chris Demetriou  <cgd@google.com>
10248
10249         * options.h (Input_file_argument::Input_file_type): New enum.
10250         (Input_file_argument::is_lib_): Replace with...
10251         (Input_file_argument::type_): New member.
10252         (Input_file_argument::Input_file_argument): Take Input_file_type
10253         'type' rather than boolean 'is_lib' as second argument.
10254         (Input_file_argument::is_lib): Use type_.
10255         (Input_file_argument::is_searched_file): New function.
10256         (Input_file_argument::may_need_search): Handle is_searched_file.
10257         * options.cc (General_options::parse_library): Support -l:filename.
10258         (General_options::parse_just_symbols): Update for Input_file_argument
10259         changes.
10260         (Command_line::process): Likewise.
10261         * archive.cc (Archive::get_file_and_offset): Likewise.
10262         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10263         * script.cc (read_script_file, script_add_file): Likewise.
10264         * fileread.cc (Input_file::Input_file): Likewise.
10265         (Input_file::will_search_for): Handle is_searched_file.
10266         (Input_file::open): Likewise.
10267         * readsyms.cc (Read_symbols::get_name): Likewise.
10268         * testsuite/Makefile.am (searched_file_test): New test.
10269         * testsuite/Makefile.in: Regenerate.
10270         * testsuite/searched_file_test.cc: New file.
10271         * testsuite/searched_file_test_lib.cc: New file.
10272
10273 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10274             Ian Lance Taylor  <iant@google.com>
10275
10276         * descriptor.cc: Include <cstdio> and "binary-io.h".
10277         (Descriptors::open): Open the files in binary mode always.
10278         * script.cc (Lex::get_token): Treat \r as whitespace.
10279
10280 2009-10-09  Ian Lance Taylor  <iant@google.com>
10281
10282         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10283
10284 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10285             Ian Lance Taylor  <iant@google.com>
10286
10287         * configure.ac: Check for readv function also.
10288         * fileread.cc (readv): Define if not HAVE_READV.
10289         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10290         does not exist.
10291         * config.in: Regenerate.
10292         * configure: Regenerate.
10293
10294 2009-10-09  Doug Kwan  <dougkwan@google.com>
10295
10296         * layout.cc (Layout::make_output_section): Call target hook to make
10297         ordinary output section.
10298         (Layout::finalize): Adjust parameter list of call the
10299         Target::may_relax().
10300         * layout.h (class Layout::section_list): New method.
10301         * merge.h (Output_merge_base::entsize): Change visibility to public.
10302         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10303         New methods.
10304         (Output_merge_string::do_is_string): New method.
10305         * object.cc (Sized_relobj::do_setup): renamed from
10306         Sized_relobj::set_up.
10307         * object.h (Sized_relobj::adjust_shndx,
10308         Sized_relobj::initializ_input_to_output_maps,
10309         Sized_relobj::free_input_to_output_maps): Change visibilities to
10310         protected.
10311         (Sized_relobj::setup): Virtualize.
10312         (Sized_relobj::do_setup): New method declaration.
10313         (Sized_relobj::invalidate_section_offset,
10314         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10315         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10316         * options.cc (parse_int): New function.
10317         * options.h (parse_int): New declaration.
10318         (DEFINE_int): New macro.
10319         (stub_group_size): New option.
10320         * output.cc (Output_section::Output_section): Initialize memebers
10321         merge_section_map_, merge_section_by_properties_map_,
10322         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10323         (Output_section::add_input_section): Handled deferred code-fill
10324         generation and remove an old comment.
10325         (Output_section::add_relaxed_input_section): New method definition.
10326         (Output_section::add_merge_input_section): Use merge section by
10327         properties map to speed to search.  Update merge section maps
10328         as appropriate.
10329         (Output_section::build_relaxation_map): New method definition.
10330         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10331         Same.
10332         (Output_section::relax_input_section): Renamed to
10333         Output_section::convert_input_sections_to_relaxed_sections and change
10334         interface to take a vector of pointers to relaxed sections.
10335         (Output_section::find_merge_section,
10336         Output_section::find_relaxed_input_section): New method definitions.
10337         (Output_section::is_input_address_mapped,
10338         Output_section::output_offset, Output_section::output_address):
10339         Use output section data maps to speed up searching.
10340         (Output_section::find_starting_output_address): Add comments.
10341         (Output_section::do_write,
10342         Output_section::write_to_postprocessing_buffer): Do code-fill
10343         generation as appropriate.
10344         (Output_section::get_input_sections): Invalidate relaxed input section
10345         map.
10346         (Output_section::restore_states): Adjust type of checkpoint .
10347         Invalidate relaxed input section map.
10348         * output.h (Output_merge_base): New class declaration.
10349         (Input_section_specifier): New class defintion.
10350         (class Output_relaxed_input_section) Change base class to
10351         Output_section_data_build.
10352         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10353         base class initializer.
10354         (Output_section::add_relaxed_input_section): New method declaration.
10355         (Output_section::Input_section): Change visibility to protected.
10356         (Output_section::Input_section::relobj,
10357         Output_section::Input_section::shndx): Handle relaxed input sections.
10358         Output_section::input_sections) Change visibility to protected.  Also
10359         define overload to return a non-const pointer.
10360         (Output_section::Merge_section_properties): New class defintion.
10361         (Output_section::Merge_section_by_properties_map,
10362         Output_section::Output_section_data_by_input_section_map,
10363         Output_section::Relaxation_map): New types.
10364         (Output_section::relax_input_section): Rename method to
10365         Output_section::convert_input_sections_to_relaxed_sections and change
10366         interface to take a vector of relaxed section pointers.
10367         (Output_section::find_merge_section,
10368         Output_section::find_relaxed_input_section,
10369         Output_section::build_relaxation_map,
10370         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10371         New method declarations.
10372         (Output_section::merge_section_map_
10373         Output_section::merge_section_by_properties_map_,
10374         Output_section::relaxed_input_section_map_,
10375         Output_section::is_relaxed_input_section_map_valid_,
10376         Output_section::generate_code_fills_at_write_): New data members.
10377         * script-sections.cc
10378         (Output_section_element_input::set_section_addresses): Call
10379         current_data_size and addralign methods of relaxed input sections.
10380         (Orphan_output_section::set_section_addresses): Call current_data_size
10381         and addralign methods of relaxed input sections.
10382         * symtab.cc (Symbol_table::compute_final_value): Extract template
10383         from the body of Symbol_table::sized_finalize_symbol.
10384         (Symbol_table::sized_finalized_symbol): Call
10385         Symbol_table::compute_final_value.
10386         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10387         (Symbol_table::compute_final_value): New templated method declaration.
10388         * target.cc (Target::do_make_output_section): New method defintion.
10389         * target.h (Target::make_output_section): New method declaration.
10390         (Target::relax): Add more parameters for input objects, symbol table
10391         and layout.  Adjust call to do_relax.
10392         (Target::do_make_output_section): New method declaration.
10393         (Target::do_relax): Add parameters for input objects, symbol table
10394         and layout.
10395
10396 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10397
10398         * pread.c: Include stdio.h.
10399
10400 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10401
10402         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10403         defined.
10404
10405 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10406
10407         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10408         Change read_shndx type to unsigned int.
10409         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10410         int.
10411         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10412         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10413         Change read_shndx type to unsigned int.
10414         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10415         int.
10416         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10417         * layout.cc (Layout::create_symtab_sections): Cast the result of
10418         local_symcount * symsize to off_t in the gold_assert.
10419
10420 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10421
10422         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10423         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10424         R_ARM_BASE_ABS.
10425         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10426         (Arm_relocate_functions::thm_abs5): New function.
10427         (Arm_relocate_functions::abs12): New function.
10428         (Arm_relocate_functions::abs16): New function.
10429         (Arm_relocate_functions::base_abs): New function.
10430         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10431         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10432         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10433         R_ARM_BASE_ABS.
10434         (Scan::global): Likewise.
10435         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10436         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10437         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10438         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10439         R_ARM_BASE_ABS.
10440
10441 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10442
10443         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10444         (Arm_relocate_functions::movt_prel): New function.
10445         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10446         (Arm_relocate_functions::thm_movt_prel): New function.
10447         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10448         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10449         (Scan::global, Relocate::relocate): Likewise.
10450         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10451
10452 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10453
10454         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10455         Incremental_checker.
10456         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10457         unsigned int.
10458         (class Incremental_inputs_header): New class.
10459         (Incremental_inputs_header_writer): Edit comment.
10460         (Incremental_inputs_entry): New class.
10461         (Incremental_inputs_entry_writer): Edit comment.
10462         (Sized_incremental_binary::do_find_incremental_inputs_section):
10463         Add *strtab_shndx parameter, fill it.
10464         (Sized_incremental_binary::do_check_inputs): New method.
10465         (Incremental_checker::can_incrementally_link_output_file): Use
10466         Sized_incremental_binary::check_inputs.
10467         (Incremental_inputs::report_command_line): Save command line in
10468         command_line_.
10469         * incremental.h:
10470         (Incremental_binary::find_incremental_inputs_section): New
10471         method.
10472         (Incremental_binary::do_find_incremental_inputs_section): Add
10473         strtab_shndx parameter.
10474         (Incremental_binary::do_check_inputs): New pure virtual method.
10475         (Sized_incremental_binary::do_check_inputs): Declare.
10476         (Incremental_checker::Incremental_checker): Add incremental_inputs
10477         parameter, use it to initialize incremental_inputs_.
10478         (Incremental_checker::incremental_inputs_): New field.
10479         (Incremental_checker::command_line): New method.
10480         (Incremental_checker::inputs): New method.
10481         (Incremental_checker::command_line_): New field.
10482
10483 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10484
10485         * incremental.cc: Include <cstdarg> and "target-select.h".
10486         (vexplain_no_incremental): New function.
10487         (explain_no_incremental): New function.
10488         (Incremental_binary::error): New method.
10489         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10490         method.
10491         (make_sized_incremental_binary): New function.
10492         (open_incremental_binary): New function.
10493         (can_incrementally_link_file): Add checks if output is ELF and has
10494         inputs section.
10495         * incremental.h: Include "elfcpp_file.h" and "output.h".
10496         (Incremental_binary): New class.
10497         (Sized_incremental_binary): New class.
10498         (open_incremental_binary): Declare.
10499         * object.cc (is_elf_object): Use
10500         elfcpp::Elf_recognizer::is_elf_file.
10501         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10502         * output.h (Output_file::filesize): New method.
10503
10504 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10505
10506         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10507         New function.
10508         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10509         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10510         function.
10511         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10512         function.
10513         (Arm_relocate_functions::movw_abs_nc): New function.
10514         (Arm_relocate_functions::movt_abs): New function.
10515         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10516         (Arm_relocate_functions::thm_movt_abs): New function.
10517         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10518         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10519         (Scan::global): Likewise.
10520         (Relocate::relocate): Likewise.
10521         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10522
10523 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10524
10525         * arm.cc (Arm_relocate_functions::got_prel) New function.
10526         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10527         (Relocate::relocate): Likewise.
10528         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10529
10530 2009-10-06  Ian Lance Taylor  <iant@google.com>
10531
10532         * options.h (class General_options): Define
10533         split_stack_adjust_size parameter.
10534         * object.h (class Object): Add uses_split_stack_ and
10535         has_no_split_stack_ fields.  Add uses_split_stack and
10536         has_no_split_stack accessor functions.  Declare
10537         handle_split_stack_section.
10538         (class Reloc_symbol_changes): Define.
10539         (class Sized_relobj): Define Function_offsets.  Declare
10540         split_stack_adjust, split_stack_adjust_reltype, and
10541         find_functions.
10542         * object.cc (Object::handle_split_stack_section): New function.
10543         (Sized_relobj::do_layout): Call handle_split_stack_section.
10544         * dynobj.cc (Sized_dynobj::do_layout): Call
10545         handle_split_stack_section.
10546         * reloc.cc (Sized_relobj::relocate_sections): Call
10547         split_stack_adjust for executable sections in split_stack
10548         objects.  Pass reloc_map to relocate_section.
10549         (Sized_relobj::split_stack_adjust): New function.
10550         (Sized_relobj::split_stack_adjust_reltype): New function.
10551         (Sized_relobj::find_functions): New function.
10552         * target-reloc.h: Include "object.h".
10553         (relocate_section): Add reloc_symbol_changes parameter.  Change
10554         all callers.
10555         * target.h (class Target): Add calls_non_split method.  Declare
10556         do_calls_non_split virtual method.  Declare match_view and
10557         set_view_to_nop.
10558         * target.cc: Include "elfcpp.h".
10559         (Target::do_calls_non_split): New function.
10560         (Target::match_view): New function.
10561         (Target::set_view_to_nop): New function.
10562         * gold.cc (queue_middle_tasks): Give an error if mixing
10563         split-stack and non-split-stack objects with -r.
10564         * i386.cc (Target_i386::relocate_section): Add
10565         reloc_symbol_changes parameter.
10566         (Target_i386::do_calls_non_split): New function.
10567         * x86_64.cc (Target_x86_64::relocate_section): Add
10568         reloc_symbol_changes parameter.
10569         (Target_x86_64::do_calls_non_split): New function.
10570         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10571         parameter.
10572         * powerpc.cc (Target_powerpc::relocate_section): Add
10573         reloc_symbol_changes parameter.
10574         * sparc.cc (Target_sparc::relocate_section): Add
10575         reloc_symbol_changes parameter.
10576         * configure.ac: Call AM_CONDITIONAL for the default target.
10577         * configure: Rebuild.
10578         * testsuite/Makefile.am (TEST_AS): New variable.
10579         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10580         (check_DATA): Add split_i386 and split_x86_64 files.
10581         (SPLIT_DEFSYMS): Define.
10582         (split_i386_[1234n].o): New targets.
10583         (split_i386_[124]): New targets.
10584         (split_i386_[1234r].stdout): New targets.
10585         (split_x86_64_[1234n].o): New targets.
10586         (split_x86_64_[124]): New targets.
10587         (split_x86_64_[1234r].stdout): New targets.
10588         (MOSTLYCLEANFILES): Add new executables.
10589         * testsuite/split_i386.sh: New file.
10590         * testsuite/split_x86_64.sh: New file.
10591         * testsuite/split_i386_1.s: New file.
10592         * testsuite/split_i386_2.s: New file.
10593         * testsuite/split_i386_3.s: New file.
10594         * testsuite/split_i386_4.s: New file.
10595         * testsuite/split_i386_n.s: New file.
10596         * testsuite/split_x86_64_1.s: New file.
10597         * testsuite/split_x86_64_2.s: New file.
10598         * testsuite/split_x86_64_3.s: New file.
10599         * testsuite/split_x86_64_4.s: New file.
10600         * testsuite/split_x86_64_n.s: New file.
10601         * testsuite/testfile.cc (Target_test): Update relocation_section
10602         function.
10603         * testsuite/Makefile.in: Rebuild.
10604
10605 2009-10-06  Ian Lance Taylor  <iant@google.com>
10606
10607         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10608         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10609         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10610         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10611         the address on ldo_addrs_.
10612         (Target_i386::Relocate::fix_up_ldo): New function.
10613
10614 2009-10-06   Rafael Espindola  <espindola@google.com>
10615
10616         * plugin.cc (add_input_library): New.
10617         (Plugin::load): Add add_input_library to tv.
10618         (Plugin_manager::add_input_file): Add the is_lib argument.
10619         (add_input_file): Update call to Plugin_manager::add_input_file.
10620         (add_input_library): New.
10621         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10622
10623 2009-09-30  Doug Kwan  <dougkwan@google.com>
10624
10625         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10626         symbol and call Symbol::may_need_copy_reloc to determine if
10627         a copy reloc is needed.
10628         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10629         nocopyreloc is given in command line.
10630         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10631         given in command line.
10632         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10633         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10634         of the removed Target_i386::may_need_copy_reloc.
10635         * options.h (copyreloc): New option with default value false.
10636         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10637         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10638         instead of the removed Target_powerpc::may_need_copy_reloc.
10639         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10640         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10641         instead of the removed Target_sparc::may_need_copy_reloc.
10642         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10643         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10644         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10645         instead of the removed Target_x86_64::may_need_copy_reloc.
10646
10647 2009-09-30  Ian Lance Taylor  <iant@google.com>
10648
10649         * object.h (class Object): Remove target_ field, and target,
10650         sized_target, and set_target methods.
10651         (Object::sized_target): Remove.
10652         (class Sized_relobj): Update declarations.  Remove sized_target.
10653         * object.cc (Sized_relobj::setup): Remove target parameter.
10654         Change all callers.
10655         (Input_objects::add_object): Don't do anything with the target.
10656         (make_elf_sized_object): Add punconfigured parameter.  Change all
10657         callers.  Set or test parameter target.
10658         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10659         Change all callers.
10660         * parameters.cc (Parameters::set_target): Change parameter type to
10661         be non-const.
10662         (Parameters::default_target): Remove.
10663         (set_parameters_target): Change parameter type to be non-const.
10664         (parameters_force_valid_target): New function.
10665         (parameters_clear_target): New function.
10666         * parameters.h (class Parameters): Update declarations.  Remove
10667         default_target method.  Add sized_target and clear_target
10668         methods.  Change target_ to be non-const.
10669         (set_parameters_target): Update declaration.
10670         (parameters_force_valid_target): Declare.
10671         (parameters_clear_target): Declare.
10672         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10673         as NULL if we aren't searching.
10674         (Add_symbols::run): Don't check for compatible target.
10675         * fileread.cc (Input_file::open_binary): Call
10676         parameters_force_valid_target.
10677         * gold.cc (queue_middle_tasks): Likewise.
10678         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10679         set_target on object.
10680         * dynobj.h (class Sized_dynobj): Update declarations.
10681         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10682         make_elf_object returns NULL.
10683         (Archive::include_member): Don't check whether object target is
10684         compatible.
10685         * output.cc (Output_section::add_input_section): Get target from
10686         parameters.
10687         (Output_section::relax_input_section): Likewise.
10688         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10689         parameters.
10690         (Sized_relobj::do_scan_relocs): Likewise.
10691         (Sized_relobj::relocate_sections): Likewise.
10692         * resolve.cc (Symbol_table::resolve): Likewise.
10693         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10694         parameter.  Change all callers.
10695         (Symbol_table::add_from_object): Get target from parameters.
10696         (Symbol_table::add_from_relobj): Don't check object target.
10697         (Symbol_table::add_from_dynobj): Likewise.
10698         (Symbol_table::define_special_symbol): Get target from
10699         parameters.
10700         * symtab.h (class Symbol_table): Update declaration.
10701         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10702         parameter.  Change all callers.  Clear parameter target.
10703         (Binary_test): Test target here.
10704         * testsuite/object_unittest.cc (gold_testsuite): Remove
10705         target_test_pointer parameter.  Change all callers.
10706         (Object_test): Test target here.
10707
10708 2009-09-26  Ian Lance Taylor  <iant@google.com>
10709
10710         * testsuite/initpri1.c: Don't try to use constructor priorities if
10711         compiling with gcc before 4.3.
10712
10713 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10714
10715         * testsuite/retain_symbols_file_test.sh (check_present): Change
10716         output file name to retain_symbols_file_test.stdout.
10717         (check_absent): Likewise.
10718
10719 2009-09-18  Craig Silverstein  <csilvers@google.com>
10720
10721         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10722         * options.cc: Include <cerrno> and <fstream>.
10723         (General_options::finalize): Parse -retain-symbols-file tag.
10724         * options.h: New flag.
10725         (General_options): New method should_retain_symbol, new
10726         variable symbols_to_retain.
10727         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10728         should_retain_symbol map.
10729         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10730         * testsuite/Makefile.in: Regenerate.
10731         * testsuite/retain_symbols_file_test.sh: New file.
10732
10733 2009-09-18  Nick Clifton  <nickc@redhat.com>
10734
10735         * po/es.po: Updated Spanish translation.
10736
10737 2009-09-17  Doug Kwan  <dougkwan@google.com>
10738
10739         * debug.h (DEBUG_RELAXATION): New constant.
10740         (DEBUG_ALL): Add DEBUG_RELAXATION.
10741         (debug_string_to_enum): Add relaxation debug option.
10742         * layout.cc
10743         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10744         Layout::Relaxation_debug_check::read_sections,
10745         Layout::Relaxation_debug_check::read_sections): New method definitions.
10746         (Layout::Layout): Initialize data members
10747         record_output_section_data_from_scrips_,
10748         script_output_section_data_list_ and relaxation_debug_check_.
10749         (Layout::save_segments, Layout::restore_segments,
10750         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10751         Layout::relaxation_loop_body): New method definitions.
10752         (Layout::finalize): Support relaxation.  Move section layout code to
10753         Layout::relaxation_loop_body.
10754         (Layout::set_asection_address_from_script): Move code for orphan
10755         section placement out.
10756         (Layout::place_orphan_sections_in_script): New method definition.
10757         * layout.h (Output_segment_headers, Output_file_header):
10758         New forward class declarations.
10759         (Layout::~Layout): Define.
10760         (Layout::new_output_section_data_from_script): New method definition.
10761         (Layout::place_orphan_sections_in_script): New method declaration.
10762         (Layout::Segment_states): New type declaration.
10763         (Layout::save_segments, Layout::restore_segments,
10764         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10765         Layout::relaxation_loop_body): New method declarations.
10766         (Layout::Output_section_data_list): New type declaration.
10767         (Layout::Relaxation_debug_check): New class definition.
10768         (Layout::record_output_section_data_from_script_,
10769         Layout::script_output_section_data_list_, Layout::segment_states_,
10770         Layout::relaxation_debug_check_): New data members.
10771         * output.cc: (Output_section_headers::do_size): New method definition.
10772         (Output_section_headers::Output_section_headers): Move size
10773         computation to Output_section_headers::do_size.
10774         (Output_segment_headers::do_size): New method definition.
10775         (Output_file_header::Output_file_header): Move size computation to
10776         Output_file_header::do_size and call it.
10777         (Output_file_header::do_size): New method definition.
10778         (Output_data_group::Output_data_group): Adjust call to
10779         Output_section_data.
10780         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10781         (Output_symtab_xindex::do_write): Add array bound check.
10782         (Output_section::Input_section::print_to_mapfile): Handle
10783         RELAXED_INPUT_SECTION_CODE.
10784         (Output_section::Output_section): Initialize data member checkpoint_.
10785         (Output_section::~Output_section): Delete checkpoint object pointed
10786         by checkpoint_.
10787         (Output_section::add_input_section): Always add an Input_section if
10788         relaxing.
10789         (Output_section::add_merge_input_section): Add assert.
10790         (Output_section::relax_input_section): New method definition.
10791         (Output_section::set_final_data_size): Set load address to zero for
10792         an unallocated section.
10793         (Output_section::do_address_and_file_offset_have_reset_values):
10794         New method definition.
10795         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10796         Handle relaxed input section.
10797         (Output_section::sort_attached_input_sections): Checkpoint input
10798         section list lazily.
10799         (Output_section::get_input_sections): Change type of input_sections to
10800         list of Simple_input_section pointers.  Checkpoint input section list
10801         lazily.  Also handle relaxed input sections.
10802         (Output_section::add_input_section_for_script): Take a reference to
10803         a Simple_input_section object instead of Relobj pointer and section
10804         index as parameter.  Handle relaxed input sections.
10805         (Output_section::save_states, Output_section::restore_states): New
10806         method definitions.
10807         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10808         (Output_data::is_data_size_fixed): New method definition.
10809         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10810         if it is fixed.
10811         (Output_data::address_and_file_offset_have_reset_values): New method
10812         definition.
10813         (Output_data::do_address_and_file_offset_have_reset_values): New method
10814         definition.
10815         (Output_data::set_data_size): Check that data size is not fixed.
10816         (Output_data::fix_data_size): New method definition.
10817         (Output_data::is_data_size_fixed_): New data member.
10818         (Output_section_headers::set_final_data_size): New method definition.
10819         (Output_section_headers::do_size): New method declaration.
10820         (Output_segment_headers::set_final_data_size): New method definition.
10821         (Output_segment_headers::do_size): New method declaration.
10822         (Output_file_header::set_final_data_size)::New method definition.
10823         (Output_file_header::do_size)::New method declaration.
10824         (Output_section_data::Output_section_data): Add new parameter
10825         is_data_size_fixed and use it to fix data size.
10826         (Output_data_const::Output_data_const): Adjust call to base class
10827         constructor and fix data size.
10828         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10829         base class constructor and fix data size.
10830         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10831         base class constructor and fix data size.
10832         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10833         class constructor and fix data size.
10834         (Output_data_group::set_final_data_size): New method definition.
10835         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10836         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10837         class constructor and fix data size.
10838         (Output_relaxed_input_section): New class definition.
10839         (Output_section::Simple_input_section): New class definition.
10840         (Output_section::get_input_sections): Adjust parameter list.
10841         (Output_section::add_input_section_for_script): Same.
10842         (Output_section::save_states, Output_section::restore_states,
10843         Output_section::do_address_and_file_offset_have_reset_values,
10844         (Output_section::Input_section::Input_section): Handle
10845         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10846         Output_relaxed_input_section.
10847         (Output_section::Input_section::is_input_section,
10848         Output_section::Input_section::set_output_section): Handle relaxed
10849         input section.
10850         (Output_section::Input_section::is_relaxed_input_section,
10851         Output_section::Input_section::output_section_data,
10852         Output_section::Input_section::relaxed_input_section): New method
10853         definitions.
10854         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10855         value.
10856         (Output_section::Input_section::u1_): Update comments.
10857         (Output_section::Input_section::u2_): Add new union member poris.
10858         (Output_section::Checkpoint_output_section): New classs definition.
10859         (Output_section::relax_input_section): New method declaration.
10860         (Output_section::checkpoint_): New data member.
10861         (Output_segment): Update comments.
10862         (Output_segment::Output_segment): Un-privatize copy constructor.
10863         (Output_segment::operator=): Un-privatize.
10864         * script-sections.cc (Output_section_element::Input_section_list):
10865         Change element type to Output_section::Simple_input_section.
10866         (Output_section_element_dot_assignment::set_section_addresses):
10867         Register output section data for relaxation clean up.
10868         (Output_data_exression::Output_data_expression): Adjust call to base
10869         constructor to fix data size.
10870         (Output_section_element_data::set_section_addresses): Register
10871         Output_data_expression object for relaxation clean up.
10872         (struct Input_section_info): Replace Relobj pointer and section index
10873         pair with Output_section::Simple_input_section and Convert struct to a
10874         class.
10875         (Input_section_sorter::operator()): Adjust access to
10876         Input_section_info data member to use accessors.
10877         (Output_section_element_input::set_section_addresses): Use layout
10878         parameter.  Adjust code to use Output_section::Simple_input_section
10879         and Input_secction_info classes.  Register filler for relaxation
10880         clean up.
10881         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10882         and section index pair with Output_section::Simple_input_section
10883         class.  Adjust code accordingly.
10884         (Phdrs_element::release_segment): New method definition.
10885         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10886         segment list.
10887         (Script_sections::release_segments): New method definition.
10888         * gold/script-sections.h (Script_sections::release_segments): New
10889         method declaration.
10890         * gold/target.h (Target::may_relax, Target::relax,
10891         Target::do_may_relax, Target::do_relax): New method definitions.
10892
10893 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10894
10895         * arm.cc (has_signed_unsigned_overflow): New function.
10896         (Arm_relocate_functions::abs8): New function.
10897         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10898         (Target_arm::Scan::global): Likewise.
10899         (Target_arm::relocate::relocate): Likewise.
10900         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10901         Likewise.
10902
10903 2009-09-16  Cary Coutant  <ccoutant@google.com>
10904
10905         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10906         * testsuite/Makefile.in: Regenerate.
10907
10908 2009-09-11  Nick Clifton  <nickc@redhat.com>
10909
10910         * po/gold.pot: Updated by the Translation project.
10911
10912 2009-09-08  Cary Coutant  <ccoutant@google.com>
10913
10914         * output.cc (Output_file::open): Add execute permission to empty file.
10915         * testsuite/Makefile.am (permission_test): New test.
10916         * testsuite/Makefile.in: Regenerate.
10917
10918 2009-09-02  Ian Lance Taylor  <iant@google.com>
10919
10920         * output.cc (Output_file::resize): Call map_no_anonymous rather
10921         than map.
10922
10923 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10924
10925         * gold.cc: Include "incremental.h".
10926         (queue_initial_tasks): Call Incremental_checker methods.
10927         * incremental.cc: Include "output.h".
10928         (Incremental_checker::can_incrementally_link_output_file): New
10929         method.
10930         * incremental.h (Incremental_checker): New class.
10931
10932         * output.cc (Output_file::open_for_modification): New method.
10933         (Output_file::map_anonymous): Changed return type to bool.  Record
10934         map in base_ field.
10935         (Output_file::map_no_anonymous): New method, broken out of map.
10936         (Output_file::map): Use map_no_anonymous and map_anonymous.
10937         * output.h (class Output_file): Update declarations.
10938
10939 2009-08-24  Cary Coutant  <ccoutant@google.com>
10940
10941         * options.h (Command_line::Pre_options): New class.
10942         (Command_line::pre_options): New member.
10943         * options.cc (gold::options::ready_to_register): New variable.
10944         (One_option::register_option): Do nothing if not registering options.
10945         Assert if same short option registered twice.
10946         (General_options::General_options): Turn off option registration when
10947         done constructing.
10948         (Command_line::Pre_options::Pre_options): New constructor.
10949
10950 2009-08-24  Cary Coutant  <ccoutant@google.com>
10951
10952         * options.h (General_options::no_keep_memory): Remove incorrect
10953         short option.
10954
10955 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10956
10957         * Makefile.am (am__skiplex, am__skipyacc): New.
10958         * Makefile.in: Regenerate.
10959
10960 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10961
10962         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10963         (INCLUDES): ... this.
10964         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10965         (AM_CPPFLAGS): Renamed from ...
10966         (INCLUDE): ... this.
10967         * Makefile.in, testsuite/Makefile.in: Regenerate.
10968
10969         * Makefile.in: Regenerate.
10970         * aclocal.m4: Likewise.
10971         * config.in: Likewise.
10972         * configure: Likewise.
10973         * testsuite/Makefile.in: Likewise.
10974
10975         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10976         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10977         * Makefile.in: Regenerate.
10978         * testsuite/Makefile.in: Regenerate.
10979
10980 2009-08-19  Cary Coutant  <ccoutant@google.com>
10981
10982         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10983         symbols in shared libraries overridden by hidden or internal symbols
10984         in the main program.
10985
10986 2009-08-19  Chris Demetriou  <cgd@google.com>
10987
10988         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10989         checking source file names in error messages.
10990
10991 2009-08-18  Doug Kwan  <dougkwan@google.com>
10992
10993         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10994         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10995         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10996         an elfcpp::Ehdr as parameter.
10997         * object.cc (Object::set_target): Remove the version that looks up
10998         a target and sets it.
10999         (Sized_relobj::setup): Take a Target object instead of
11000         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11001         (make_elf_sized_object): Find target and ask target to
11002         make an ELF object.
11003         * object.h: (Object::set_target): Remove the version that looks up
11004         a target and sets it.
11005         (Sized_relobj::setup): Take a Target object instead of
11006         an elfcpp:Ehdr as parameter.
11007         * target.cc: Include dynobj.h.
11008         (Target::do_make_elf_object_implementation): New.
11009         (Target::do_make_elf_object): New.
11010         * target.h (Target::make_elf_object): New template declaration.
11011         (Target::do_make_elf_object): New method declarations.
11012         (Target::do_make_elf_object_implementation): New template declaration.
11013
11014 2009-08-14  Ian Lance Taylor  <iant@google.com>
11015
11016         * gold.h (FUNCTION_NAME): Define.
11017         (gold_unreachable): Use FUNCTION_NAME.
11018
11019 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11020
11021         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11022         symbol in the --keep-unique list is not found.
11023
11024 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11025
11026         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11027         been maked as --keep-unique.
11028         (Icf::unfold_section): New function.
11029         * icf.h (Icf::unfold_section): New function.
11030         * options.h (General_options::keep_unique): New option.
11031         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11032         * testsuite/Makefile.in: Regenerate.
11033         * testsuite/icf_keep_unique_test.sh: New file.
11034         * testsuite/icf_keep_unique_test.cc: New file.
11035
11036 2009-08-12  Cary Coutant  <ccoutant@google.com>
11037
11038         PR 10471
11039         * resolve.cc (Symbol_table::resolve): Check for references from
11040         dynamic objects to hidden and internal symbols.
11041         * testsuite/Makefile.am (hidden_test.sh): New test.
11042         * testsuite/Makefile.in: Regenerate.
11043         * testsuite/hidden_test.sh: New script.
11044         * testsuite/hidden_test_1.c: New test source.
11045         * testsuite/hidden_test_main.c: New test source.
11046
11047 2009-08-11  Doug Kwan  <dougkwan@google.com>
11048
11049         * arm.cc: Update comments.
11050         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11051         segment to locate the .ARM.exidx section if present.
11052
11053 2009-08-09  Doug Kwan  <dougkwan@google.com>
11054
11055         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11056         patch.
11057
11058 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11059         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11060         compiler warnings.
11061
11062 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11063
11064         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11065         valid tls_segment only for non-debug-section relocations.
11066         * testsuite/Makefile.am: Add gc_tls_test.
11067         * testsuite/Makefile.in: Regenerate.
11068         * testsuite/gc_tls_test.cc: New file.
11069         * testsuite/gc_tls_test.sh: New file.
11070
11071 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11072
11073         * icf.cc: New file.
11074         * icf.h: New file.
11075         * Makefile.am (CCFILES): Add icf.cc.
11076         (HFILES): Add icf.h
11077         * Makefile.in: Regenerate.
11078         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11079         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11080         section, symbol and addend information for the relocs.
11081         * gold.cc (queue_middle_tasks): Call identical code folding.
11082         * gold.h: Add defines for multimap.
11083         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11084         to the call of finalize_local_symbols.
11085         * main.cc (main): Create object of class Icf.
11086         * object.cc (Sized_relobj::do_layout): Allow this function to be
11087         called twice during icf.
11088         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11089         to sections marked as identical by icf.
11090         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11091         when available.
11092         (Sized_relobj::do_section_entsize): New function.
11093         * object.h (Object::section_entsize): New function.
11094         (Object::do_section_entsize): New pure virtual function.
11095         (Relobj::finalize_local_symbols): Add new parameter.
11096         (Relobj::do_section_entsize): New function.
11097         * options.h (General_options::icf): New option.
11098         (General_options::icf_iterations): New option.
11099         (General_options::print_icf_sections): New option.
11100         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11101         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11102         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11103         icf.
11104         * symtab.cc (Symbol_table::is_section_folded): New function.
11105         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11106         to sections marked as identical by icf.
11107         * symtab.h (Symbol_table::set_icf): New function.
11108         (Symbol_table::icf): New function.
11109         (Symbol_table::is_section_folded): New function.
11110         (Symbol_table::icf_): New data member.
11111         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11112         * testsuite/Makefile.am: Add commands to build icf_test.
11113         * testsuite/Makefile.in: Regenerate.
11114         * testsuite/icf_test.sh: New file.
11115         * testsuite/icf_test.cc: New file.
11116
11117 2009-07-24  Chris Demetriou  <cgd@google.com>
11118
11119         * layout.cc (is_compressible_debug_section): Fix incorrect
11120         comment about compressed section names.
11121
11122 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11123
11124         PR 10419
11125         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11126
11127 2009-07-16  Ian Lance Taylor  <iant@google.com>
11128
11129         PR 10400
11130         * layout.h: #include <map>.
11131         (class Kept_section): Change from struct to class.  Add accessors
11132         and setters.  Add section size to Comdat_group mapping.  Change
11133         Comdat_group to std::map.  Add is_comdat_ field.  Add
11134         linkonce_size field in union.
11135         (class Layout): Update declaration of find_or_add_kept_section.
11136         Don't declare find_kept_object.
11137         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11138         parameter.  Add object, shndx, is_comdat, and is_group_name
11139         parameters.  Change all callers.  Adjust for new Kept_section.
11140         (Layout::find_kept_object): Remove.
11141         * object.cc (Sized_relobj::include_section_group): Update use of
11142         Kept_section.  Rename secnum to shndx.  Only record
11143         Kept_comdat_section if sections are the same size.
11144         (Sized_relobj::include_linkonce_section): Update use of
11145         Kept_section.  Only record Kept_comdat_section if sections are the
11146         same size.  Set size of linkonce section.
11147         (Sized_relobj::map_to_kept_section): Update call to
11148         get_kept_comdat_section.
11149         * object.h (class Sized_relobj): Rename fields in
11150         Kept_comdat_section to drop trailing underscores; change object
11151         field to Relobj*.  Change Kept_comdat_section_table to store
11152         struct rather than pointer.
11153         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11154         Add kept_object and kept_shndx parameters.  Change all callers.
11155         (Sized_relobj::get_kept_comdat_section): Change return type to
11156         bool.  Add kept_object and kept_shndx parameters.  Change all
11157         callers.
11158         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11159         Layout::find_or_add_kept_section.
11160
11161 2009-07-09  Ian Lance Taylor  <iant@google.com>
11162
11163         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11164         Reserve space in the hash table.
11165
11166 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11167
11168         * fileread.cc (File_read::get_mtime): New method.
11169         * fileread.h (Timespec): New structure.
11170         (File_read::get_mtime): New method.
11171         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11172         Renamed from timestamp_nsec.
11173         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11174         Elf_Xword.
11175         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11176         timestamp_nsec.
11177         (Incremental_inputs::report_archive): Save mtime; style fix.
11178         (Incremental_inputs::report_obejct): Save mtime; style fix.
11179         (Incremental_inputs::report_script): Save mtime; style fix.
11180         (Incremental_inputs::finalize_inputs): Style fix.
11181         (Incremental_inputs::finalize): Style fix.
11182         (Incremental_inputs::create_input_section_data): Store inputs
11183         mtime.
11184         * incremental.h (Incremental_inputs::report_script): Add mtime
11185         argument.
11186         (Incremental_inputs::Input_info::Input_info): Intialize only one
11187         union member.
11188         (Incremental_inputs::Input_info::archive): Move to nameless
11189         union.
11190         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11191         (Incremental_inputs::Input_info::script): Move to nameless union.
11192         (Incremental_inputs::mtime): New field.
11193         * script.cc (read_input_script): Pass file mtime to
11194         Incremental_input.
11195         * script.h (Script_info::inputs): Style fix.
11196
11197 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11198
11199         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11200         instead of 32.
11201
11202 2009-06-24  Ian Lance Taylor  <iant@google.com>
11203
11204         PR 10156
11205         * layout.cc (Layout::choose_output_section): If we find an
11206         existing section, update the flags.
11207         (Layout::create_notes): New function, broken out of
11208         Layout::finalize.
11209         (Layout::finalize): Don't create note sections.
11210         (Layout::create_note): Don't crash if linker script discards
11211         section.
11212         (Layout::create_gold_note): Likewise.
11213         (Layout::create_build_id): Likewise.  Don't set
11214         after_input_sections on the section.
11215         (Layout::create_executable_stack_info): Remove target parameter.
11216         Change caller.
11217         * layout.h (class Layout): Declare create_notes.  Update
11218         declaration of create_executable_stack_info.
11219         * gold.cc (queue_middle_tasks): Call create_notes.
11220         * output.cc (Output_section::update_flags_for_input_section): Move
11221         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11222         invalid.
11223         * output.h (Output_data::mark_address_invalid): New function.
11224         (class Output_section): Only declare, not define,
11225         update_flags_for_input_section.  Remove set_flags.
11226
11227 2009-06-24  Ian Lance Taylor  <iant@google.com>
11228
11229         * script-sections.cc (Output_section_definition::
11230         set_section_addresses): Rename shadowing local load_address to
11231         laddr.
11232
11233 2009-06-24  Ian Lance Taylor  <iant@google.com>
11234
11235         PR 10244
11236         * reloc.cc (relocate_sections): Skip empty relocation sections.
11237
11238 2009-06-23  Ian Lance Taylor  <iant@google.com>
11239
11240         PR 10156
11241         * layout.cc (Layout::create_note): Use choose_output_section
11242         rather than make_output_section.
11243
11244 2009-06-23  Ian Lance Taylor  <iant@google.com>
11245
11246         PR 10237
11247         * options.cc (General_options::parse_V): Set printed_version_.
11248         (General_options::General_options): Initialize printed_version_.
11249         * options.h (class General_options): Add printed_version_ field.
11250         * gold.cc (queue_initial_tasks): If there are no input files,
11251         don't give a fatal error if we printed the version information.
11252         (queue_middle_tasks): If using -r with a shared object, give a
11253         fatal error rather than an ordinary error.
11254
11255 2009-06-23  Ian Lance Taylor  <iant@google.com>
11256
11257         PR 10219
11258         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11259         (Layout::make_output_section): Set have_stabstr_section_ if we see
11260         a .stab*str section.
11261         (Layout::finalize): Call link_stabs_sections.
11262         (Layout::link_stabs_sections): New file.
11263         * layout.h (class Layout): Add have_stabstr_section_ field.
11264         Declare link_stabs_sections.
11265
11266 2009-06-23  Doug Kwan  <dougkwan@google.com>
11267
11268         * Makefile.am (libgold_a_LIBADD): New.
11269         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11270         * Makefile.in: Regenerate.
11271         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11272         * configure: Regenerate.
11273         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11274         * fileread.cc: Include sys/state.h
11275         * gold.h: Declare memmem and strndup if found missing.
11276         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11277
11278 2009-06-23  Ian Lance Taylor  <iant@google.com>
11279
11280         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11281         * configure: Rebuild.
11282
11283 2009-06-23  Ian Lance Taylor  <iant@google.com>
11284
11285         PR 10147
11286         * object.cc (Object::section_contents): Don't try to get a view if
11287         the section has length zero.
11288         (Object::handle_gnu_warning_section): If the section is empty, use
11289         the name of the section as the warning.
11290
11291 2009-06-23  Ian Lance Taylor  <iant@google.com>
11292
11293         PR 10133
11294         * stringpool.h (class Stringpool_template): Add optimize_ field.
11295         (Stringpool_template::set_optimize): New function.
11296         * stringpool.cc (Stringpool_template::Stringpool_template):
11297         Initialize optimize_ field.
11298         (Stringpool_template::set_string_offsets): Test local optimize
11299         fild rather than parameter.
11300         * layout.cc (Layout::Layout): Call set_optimize on the section
11301         name stringpool.
11302
11303 2009-06-22  Ian Lance Taylor  <iant@google.com>
11304
11305         PR 10030
11306         * yyscript.y: Parse TARGET.
11307         * script.cc (script_set_target): New function.
11308         * script-c.h (script_set_target): Declare.
11309         * options.cc (General_options::string_to_object_format): Rename
11310         from string_to_object_format in anonymous namespace.  Change
11311         callers.
11312         * options.h (class General_options): Declare
11313         string_to_object_format.
11314
11315 2009-06-22  Ian Lance Taylor  <iant@google.com>
11316
11317         * script-sections.cc (Script_sections::create_segments): Don't put
11318         program headers in a PT_LOAD segment if -n or -N.
11319
11320 2009-06-22  Ian Lance Taylor  <iant@google.com>
11321
11322         PR 10141
11323         * options.h (class General_options): Add -z lazy and -z now.  Sort
11324         -z options into alphabetical order.
11325         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11326
11327 2009-06-21  Ian Lance Taylor  <iant@google.com>
11328
11329         * layout.cc (Layout::make_output_section): Call
11330         Target::new_output_section.
11331         (Layout::attach_allocated_section_to_segment): Put large section
11332         sections in a separate load segment with the large segment flag
11333         set.
11334         (Layout::segment_precedes): Sort large data segments after other
11335         load segments.
11336         (align_file_offset): New static function.
11337         (Layout::set_segment_offsets): Use align_file_offset.
11338         * output.h (class Output_section): Add is_small_section_ and
11339         is_large_section_ fields.
11340         (Output_section::is_small_section): New function.
11341         (Output_section::set_is_small_section):  New function.
11342         (Output_section::is_large_section): New function.
11343         (Output_section::set_is_large_section): New function.
11344         (Output_section::is_large_data_section): New function.
11345         (class Output_segment): Add is_large_data_segment_ field.
11346         (Output_segment::is_large_data_segment): New function.
11347         (Output_segment::set_is_large_data_segment): New function.
11348         * output.cc (Output_section::Output_section): Initialize new
11349         fields.
11350         (Output_segment::Output_segment): Likewise.
11351         (Output_segment::add_output_section): Add assertion that large
11352         data sections always go in large data segments.  Force small data
11353         sections to the end of the list of data sections.  Force small BSS
11354         sections to the start of the list of BSS sections.  For large BSS
11355         sections to the end of the list of BSS sections.
11356         * symtab.h (class Symbol): Declare is_common_shndx.
11357         (Symbol::is_defined): Check Symbol::is_common_shndx.
11358         (Symbol::is_common): Likewise.
11359         (class Symbol_table): Define enum Commons_section_type.  Update
11360         declarations.  Add small_commons_ and large_commons_ fields.
11361         * symtab.cc (Symbol::is_common_shndx): New function.
11362         (Symbol_table::Symbol_table): Initialize new fields.
11363         (Symbol_table::add_from_object): Put small and large common
11364         symbols in the right list.
11365         (Symbol_table::sized_finalized_symbol): Check
11366         Symbol::is_common_shndx.
11367         (Symbol_table::sized_write_globals): Likewise.
11368         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11369         common symbol lists.  Don't call do_allocate_commons_list if the
11370         list is empty.
11371         (Symbol_table::do_allocate_commons_list): Remove is_tls
11372         parameter.  Add comons_section_type parameter.  Change all
11373         callers.  Handle small and large common symbols.
11374         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11375         Symbol::is_common_shndx.
11376         * resolve.cc (symbol_to_bits): Likewise.
11377         * target.h (Target::small_common_shndx): New function.
11378         (Target::small_common_section_flags): New function.
11379         (Target::large_common_shndx): New function.
11380         (Target::large_common_section_flags): New function.
11381         (Target::new_output_section): New function.
11382         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11383         small_common_section_flags, and large_common_section_flags
11384         fields.
11385         (Target::do_new_output_section): New virtual function.
11386         * arm.cc (Target_arm::arm_info): Initialize new fields.
11387         * i386.cc (Target_i386::i386_info): Likewise.
11388         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11389         Likewise.
11390         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11391         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11392         (Target_x86_64::do_new_output_section): New function.
11393         * configure.ac: Define conditional MCMODEL_MEDIUM.
11394         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11395         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11396         (large_LDFLAGS): Define.
11397         * testsuite/large.c: New file.
11398         * testsuite/testfile.cc (Target_test::test_target_info):
11399         Initialize new fields.
11400         * configure, testsuite/Makefile.in: Rebuild.
11401
11402 2009-06-05  Doug Kwan  <dougkwan@google.com>
11403
11404         * Makefile.am (CCFILES): Add target.cc.
11405         * Makefile.in: Regenerate.
11406         * i386.cc (class Target_i386): Define new virtual method to
11407         override do_is_local_label_name in parent.
11408         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11409         local symbols if --discard-locals or -X is given.
11410         * options.h (class General_options): Declare new options
11411         '--discard-locals' and '-X' for discarding locals.
11412         * target.h (class Target): Define new methods is_local_label_name.
11413         Declare new virtual method do_is_local_label_name.
11414         * target.cc: New file.
11415         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11416         (check_SCRIPTS): Add discard_locals_test.sh.
11417         (check_DATA): Add discard_local_tests.syms.
11418         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11419         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11420         * testsuite/Makefile.in: Regenerate.
11421         * testsuite/discard_locals_test.c: New file.
11422         * testsuite/discard_locals_test.sh: Same.
11423
11424 2009-06-05  Doug Kwan  <dougkwan@google.com>
11425
11426         * object.cc (Sized_relobj::Sized_relobj): Initialize
11427         discarded_eh_frame_shndx_ to -1U.
11428         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11429         section.
11430         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11431         a discarded .eh_frame section.
11432         (Sized_relobj::do_finalize_local_symbols): Ditto.
11433         * object.h (class Sized_relobj): Declare new member
11434         discarded_eh_frame_shndx_.
11435         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11436         (local_labels_test.o, local_labels_test): New rules.
11437         * testsuite/Makefile.in: Regenerate.
11438
11439 2009-06-04  Doug Kwan  <dougkwan@google.com>
11440
11441         * layout.cc (Layout::section_name_mapping): Add mapping for
11442         special ARM sections.
11443
11444 2009-06-03  Doug Kwan  <dougkwan@google.com>
11445
11446         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11447         (utils::has_overflow): Same.
11448
11449 2009-06-03  Ian Lance Taylor  <iant@google.com>
11450
11451         * layout.cc (Layout::section_name_mapping): New array, replacing
11452         Layout::linkonce_mapping.
11453         (Layout::section_name_mapping_count): New variable, replacing
11454         Layout::linkonce_mapping_count.
11455         (Layout::linkonce_output_name): Remove.
11456         (Layout::output_section_name): Rewrite.
11457         * layout.h (class Layout): Rename Linkonce_mapping to
11458         Section_name_mapping, linkonce_mapping to section_name_mapping,
11459         linkonce_mapping_count to section_name_mapping_count.  Don't
11460         declare linkonce_output_name.
11461
11462 2009-06-03  Doug Kwan  <dougkwan@google.com>
11463
11464         * gold/arm.cc (namespace utils): New.
11465         (Target_arm::reloc_is_non_pic): Define new method.
11466         (class Arm_relocate_functions): New.
11467         (Target_arm::Relocate::relocate): Handle relocation types used by
11468         Android.
11469
11470 2009-06-03  Ian Lance Taylor  <iant@google.com>
11471
11472         * arm.cc (Target_arm::scan::global): Use || instead of |.
11473
11474 2009-06-02  Doug Kwan  <dougkwan@google.com>
11475
11476         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11477         issued_non_pic_error_.
11478         (class Target_arm::Scan): Declare new method check_non_pic.
11479         Define new method symbol_needs_plt_entry.
11480         Declare new data member issued_non_pic_error_.
11481         (class Target_arm::Relocate): Declare new method
11482         should_apply_static_reloc.
11483         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11484         (Target_arm::Scan::check_non_pic): Define new method.
11485         (Target_arm::Scan::local): Handle a small subset of reloc types used
11486         by Android.
11487         (Target_arm::Scan::local): Same.
11488         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11489
11490 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11491
11492         * incremental.cc (Incremental_inputs::report_command_line): Filter
11493         out --incremental-* options.
11494
11495 2009-05-29  Doug Kwan  <dougkwan@google.com>
11496
11497         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11498         template class.
11499         (class Target_arm): Update comment.
11500         (Target_arm::Target_arm): Initialize new data members GOT_,
11501         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11502         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11503         and Target_arm::rel_dyn_section.
11504         Declare new_enum Target_arm::Got_type.
11505         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11506         and DYNBSS_.
11507         Update commments for member do_dynsym_value.
11508         (Target_arm::got_size, Target_arm::plt_section,
11509         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11510         new methods inside class defintion.
11511         (Target_arm::got_section): Define new method.
11512         (Target_arm::rel_dyn_section): Same.
11513         (Output_data_plt_arm): New template class.
11514         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11515         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11516         (Output_data_plt_arm::add_entry): Same.
11517         (Output_data_plt_arm::first_plt_entry): Define new
11518         static data member for PLT instruction template.
11519         (Output_data_plt_arm::plt_entry): Same.
11520         (Output_data_plt_arm::do_write): Define new method.
11521         (Target_arm::make_plt_entry): Same.
11522         (Target_arm::do_finalize_sections): Same.
11523         (Target_arm::do_dynsym_value): Same.
11524
11525 2009-05-28  Doug Kwan  <dougkwan@google.com>
11526
11527         * Makefile.am (TARGETSOURCES): Add arm.cc.
11528         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11529         * Makefile.in: Regenerate.
11530         * arm.cc: New file.
11531         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11532
11533 2009-05-26  Doug Kwan  <dougkwan@google.com>
11534
11535         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11536         (General_options::check_excluded_libs): Strip off directories in
11537         archive name before matching like GNU ld does.
11538         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11539         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11540         (exclude_libs_test_LDFLAGS): Add linker option
11541         -Wl,--exclude-libs,libexclude_libs_test_3
11542         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11543         an explicit archive without using -l.
11544         (alt/libexclude_libs_test_3.a): New make rule.
11545         * testsuite/Makefile.in: Regenerate.
11546         * testsuite/exclude_libs_test.c : Declare lib3_default().
11547         (main): Call it.
11548         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11549         * exclude_libs_test_3.c: New file.
11550
11551 2009-05-26  Nick Clifton  <nickc@redhat.com>
11552
11553         * po/id.po: New Indonesian translation.
11554         * po/gold.pot: Updated template file.
11555
11556 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11557
11558         * testsuite/Makefile.am: Add -ffunction-sections to compile
11559         gc_comdat_test files.  Add -Wl,--gc-sections to build
11560         gc_comdat_test.
11561         * testsuite/Makefile.in: Regenerate.
11562         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11563
11564 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11565
11566         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11567         kept comdat section was garbage collected.
11568         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11569         * testsuite/Makefile.in: Regenerate.
11570         * testsuite/gc_comdat_test.sh: New file.
11571         * testsuite/gc_comdat_test_1.cc: New file.
11572         * testsuite/gc_comdat_test_2.cc: New file.
11573
11574 2009-05-19  Doug Kwan  <dougkwan@google.com>
11575
11576         * archive.cc (Archive::Archive): Move constructor from archive.h
11577         to here.  Initialize no_export_.
11578         (Archive::get_elf_object_for_member): Set no_export flag of object.
11579         * archive.h (Archive::Archive): Move constructor body to
11580         archive.cc.
11581         (Archive::no_export): New method.
11582         (Archive::no_export_): New field.
11583         * object.h (Object::Object): Initialize no_export_ to false.
11584         (Object::no_export, Object::set_no_export): New methods.
11585         (Object::no_export_): New field.
11586         * options.cc (General_options::parse_exclude_libs): New method.
11587         (General_options::check_excluded_libs) Same.
11588         * options.h (exclude_libs): New option.
11589         (General_options::check_excluded_libs): New method declaration.
11590         (General_options::excluded_libs_): New field.
11591         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11592         default or protected visibility if an object has no-export flag set.
11593         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11594         (check_SCRIPTS): Add exclude_libs_test.sh.
11595         (check_DATA): Add exclude_libs_test.syms.
11596         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11597         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11598         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11599         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11600         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11601         libexclude_libs_test_2.a): New rules.
11602         * testsuite/Makefile.in: Regenerate.
11603         * testsuite/exclude_libs_test.c: New file.
11604         * testsuite/exclude_libs_test.sh: Ditto.
11605         * testsuite/exclude_libs_test_1.c: Ditto.
11606         * testsuite/exclude_libs_test_2.c: Ditto.
11607
11608 2009-05-15  Ian Lance Taylor  <iant@google.com>
11609
11610         * configure.ac: Check for declarations for cases where libiberty.h
11611         checks HAVE_DECL_xxx.
11612         * configure, config.in: Rebuild.
11613
11614 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11615
11616         * gold.h (Incremental_argument_list): Remove (invalid) forward
11617         declaration.
11618         * incremental.cc (Incremental_inputs::report_achive): New method.
11619         (Incremental_inputs::report_object): New method.
11620         (Incremental_inputs::report_script): New method.
11621         (Incremental_inputs::finalize_inputs): New method.
11622         (Incremental_inputs::finalize): Call finalize_inputs().
11623         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11624         Create inputs entries.
11625         * incremental.h (Incremental_input_type): New enum.
11626         (Incremental_inputs::Incremental_input): Initialize new fields.
11627         (Incremental_inputs::report_inputs): New method.
11628         (Incremental_inputs::report_achive): New method.
11629         (Incremental_inputs::report_object): New method.
11630         (Incremental_inputs::report_script): New method.
11631         (Incremental_inputs::finalize_inputs): New method.
11632         (Incremental_inputs::Input_info): New struct.
11633         (Incremental_inputs::Input_info_map): New typedef.
11634         (Incremental_inputs::lock_): New field.
11635         (Incremental_inputs::Inputs_): New field.
11636         (Incremental_inputs::Inputs_map): New field.
11637         * main.cc (main): Call Incremental_input::report_inputs.
11638         * options.h (Input_argument_list): Typedef moved from
11639         Input_arguments.
11640         (Input_file_group::Files): Remove, use ::Input_argument_list.
11641         (Input_file_group::Input_argument_list): Remove, use
11642         ::Input_argument_list.
11643         * plugin.cc (Plugin_manager::add_input_file): Add error in
11644         incremental build.
11645         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11646         functions.
11647         * script.cc (read_input_script): Call
11648         Incremental_input::report_script.
11649         * script.h (Script_info): New class.
11650
11651 2009-04-27  Ian Lance Taylor  <iant@google.com>
11652
11653         * x86_64.cc (do_adjust_output_section): Set entsize to
11654         plt_entry_size.
11655
11656 2009-04-23  Elliott Hughes  <enh@google.com>
11657
11658         * output.cc (Output_file::close): After short writes, continue
11659         writing from the correct offset in the buffer being written.
11660
11661 2009-04-23  Chris Demetriou  <cgd@google.com>
11662
11663         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11664         * configure: Regenerate.
11665         * config.in: Regenerate.
11666         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11667         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11668
11669 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11670
11671         * incremental.cc (Incremental_inputs_header_data): Renamed from
11672         Incremental_input_header_data.
11673         (Incremental_inputs_header_data::data_size): New field.
11674         (Incremental_inputs_header_data::put_input_file_count): Renamed
11675         from input_file_count.
11676         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11677         from command_line_offset.
11678         (Incremental_inputs_header_data::put_reserved): Renamed from
11679         put_reserved.
11680         (Incremental_inputs_entry_data): Renamed from
11681         Incremental_input_entry_data.
11682         (Incremental_inputs_entry_data::data_size): New field.
11683         (Incremental_inputs::report_command_line): New method.
11684         (Incremental_inputs::finalize): New method.
11685         (Incremental_inputs::create_incremental_inputs_data): New method.
11686         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11687         * incremental.h: New file.
11688         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11689         (Layout::finalize): Create incremental inputs section in
11690         incremental builds.
11691         (Layout::create_incremental_info_sections): New method.
11692         * layout.h (Layout::incremental_inputs): New method.
11693         (Layout::create_incremental_info_sections): New method.
11694         (Layout::incremental_inputs_): New field.
11695         * main.cc (main): Notify Incremental_input of the command line.
11696
11697 2009-04-01  Ian Lance Taylor  <iant@google.com>
11698             Mikolaj Zalewski  <mikolajz@google.com>
11699
11700         * gold.h (reserve_unordered_map): Define, three versions, one for
11701         each version of Unordered_map.
11702         * layout.cc (Layout::Layout): Remove options parameter.  Add
11703         number_of_input_files parameter.  Don't initialize options_.
11704         Initialize number_of_input_files_ and resized_signatures_.  Move
11705         sections_are_attached_.
11706         (Layout::layout_group): Reserve space for group_signatures_.
11707         (Layout::find_or_add_kept_section): Change name parameter to be a
11708         reference.  Resize signatures_ map when it gets large enough.
11709         (Layout::layout_eh_frame): Use parameters->options() instead of
11710         this->options_.
11711         (Layout::make_output_section): Likewise.
11712         (Layout::attach_allocated_section_to_segment): Likewise.
11713         (Layout::finalize, Layout::create_executable_stack): Likewise.
11714         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11715         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11716         * layout.h (class Layout): Update declarations.  Remove options_
11717         field.  Add number_of_input_files_ and resized_signatures_
11718         fields.  Move sections_are_attached_ field.
11719         * main.cc (main): Pass number of input files to Layout
11720         constructor.  Don't pass options.
11721
11722 2009-03-30  Ian Lance Taylor  <iant@google.com>
11723
11724         * ffsll.c (ffsll): Correct implementation.
11725
11726 2009-03-27  Ian Lance Taylor  <iant@google.com>
11727
11728         * ffsll.c: New file.
11729         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11730         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11731         * ftruncate.c (ftruncate): Declare before definition.
11732         * mremap.c (mremap): Likewise.
11733         * pread.c (pread): Likewise.
11734         * configure, Makefile.in, config.in: Rebuild.
11735
11736         * mremap.c: New file.
11737         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11738         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11739         (mremap): Declare if HAVE_MREMAP is not defined.
11740         * configure, Makefile.in, config.in: Rebuild.
11741
11742 2009-03-27  Cary Coutant  <ccoutant@google.com>
11743
11744         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11745         position independent.
11746         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11747         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11748
11749 2009-03-24  Cary Coutant  <ccoutant@google.com>
11750
11751         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11752         an executable.
11753         (needs_dynamic_reloc): Likewise.
11754
11755 2009-03-24  Ian Lance Taylor  <iant@google.com>
11756
11757         * yyscript.y (file_cmd): Recognize EXTERN.
11758         (extern_name_list, extern_name_list_body): New nonterminals.
11759         * script.cc (script_add_extern): Define.
11760         * script-c.h (script_add_extern): Declare.
11761
11762 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11763
11764         * object.cc (is_elf_object): Define.
11765         * object.h (is_elf_object): Declare.
11766         * archive.cc (Archive::get_elf_object_for_member): Call
11767         is_elf_object.
11768         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11769
11770 2009-03-24  Elliott Hughes  <enh@google.com>
11771
11772         * output.cc (Output_file::map_anonymous): Define.
11773         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11774         try an anonymous one.  Report the size if the mmap fails.
11775         * output.h (class Output_file): Declare map_anonymous.
11776
11777 2009-03-24  Ian Lance Taylor  <iant@google.com>
11778
11779         * target-select.cc (instantiate_target): Don't acquire the lock if
11780         the instantiated_target_ field has already been set.
11781
11782 2009-03-23  Ian Lance Taylor  <iant@google.com>
11783
11784         * gold-threads.h (class Initialize_lock): Define.
11785         * gold-threads.cc (class Initialize_lock_once): Define.
11786         (initialize_lock_control): New static variable.
11787         (initialize_lock_pointer): New static variable.
11788         (initialize_lock_once): New static function.
11789         (Initialize_lock::Initialize_lock): Define.
11790         (Initialize_lock::initialize): Define.
11791         * target-select.h: Include "gold-threads.h".
11792         (class Target_selector): Add lock_ and initialize_lock_ fields.
11793         Don't define instantiate_target, just declare it.
11794         * target-select.cc (Target_selector::Target_selector): Initialize
11795         new fields.
11796         (Target_selector::instantiate_target): Define.
11797         * descriptors.h: Include "gold-threads.h".
11798         (class Descriptors): Add initialize_lock_ field.
11799         * descriptors.cc (Descriptors::Descriptors): Initialize new
11800         field.
11801         (Descriptors::open): Use initialize_lock_ field
11802         * errors.h (class Errors): Add initialize_lock_ field.
11803         * errors.cc (Errors::Errors): Initialize new field.
11804         (Errors::initialize_lock): Use initialize_lock_ field.
11805         * powerpc.cc (class Target_selector_powerpc): Remove
11806         instantiated_target_ field.  In do_recognize call
11807         instantiate_target rather than do_instantiate_target.  In
11808         do_instantiate_target just allocate a new target.
11809         * sparc.cc (class Target_selector_sparc): Likewise.
11810
11811         * freebsd.h: New file.
11812         * i386.cc: Include "freebsd.h".
11813         (Target_i386): Derive from Target_freebsd rather than
11814         Sized_target.
11815         (Target_selector_i386): Derive from Target_selector_freebsd rather
11816         than Target_selector.
11817         * x86_64.cc: Include "freebsd.h".
11818         (Target_x86_64): Derive from Target_freebsd rather than
11819         Sized_target.
11820         (Target_selector_x86_64): Derive from Target_selector_freebsd
11821         rather than Target_selector.
11822         * target.h (class Target): Add adjust_elf_header and
11823         do_adjust_elf_header.
11824         * output.cc (Output_file_header:: do_sized_write): Call target
11825         adjust_elf_header routine.
11826         * configure.tgt: Set targ_osabi.
11827         * configure.ac: Define GOLD_DEFAULT_OSABI.
11828         * parameters.cc (Parameters::default_target): Pass
11829         GOLD_DEFAULT_OSABI to select_target.
11830         * target-select.h (class Target_selector): Make instantiate_target
11831         protected rather than private.
11832         * Makefile.am (HFILES): Add freebsd.h.
11833         * configure, Makefile.in, config.in: Rebuild.
11834
11835         * merge.cc (do_add_input_section): Correct pend value.  Change
11836         message about last entry not being null terminated from error to
11837         warning.
11838
11839 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11840
11841         * incremental.cc: New file.
11842         * Makefile.am (CCFILES): Add incremental.cc.
11843         * Makefile.in: Rebuild.
11844
11845 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11846
11847         * layout.cc (Layout::output_section_name): Preserve names
11848         of '.note.' sections.
11849
11850 2009-03-19  Ian Lance Taylor  <iant@google.com>
11851
11852         * descriptors.cc (Descriptors::open): Check that the options are
11853         valid before using them.
11854
11855 2009-03-18  Ian Lance Taylor  <iant@google.com>
11856
11857         * script-sections.h: Include <list>.
11858         (class Script_sections): Change Sections_elements from std::vector
11859         to std::list.  Typedef public Elements_iterator.  Add
11860         orphan_section_placement_, data_segment_align_start_, and
11861         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11862         field.
11863         * script-sections.cc (class Orphan_section_placement): New class.
11864         (class Sections_element): Add virtual functions is_relro and
11865         orphan_section_init.  Remove virtual function place_orphan_here.
11866         (class Output_section_definition): Add is_relro and
11867         orphan_section_init.  Remove place_orphan_here.
11868         (class Orphan_output_section): Likewise.
11869         (Script_sections::Script_sections): Update for field changes.
11870         (Script_sections::data_segment_align): Set saw_data_segment_align_
11871         and data_segment_align_start_, not data_segment_align_index.
11872         (Script_sections::data_segment_relro_end): Check
11873         saw_data_segment_align_.  Use data_segment_align_start_ rather
11874         than data_segment_align_index_.
11875         (Script_sections::place_orphan): Rewrite to use
11876         Orphan_section_placement.
11877
11878 2009-03-17  Ian Lance Taylor  <iant@google.com>
11879
11880         * archive.cc (Archive::add_symbols): Check for a version attached
11881         to the symbol name in the archive map.
11882         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11883         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11884         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11885         (ver_test_11.a): New target.
11886         * testsuite/Makefile.in: Rebuild.
11887
11888         * configure.ac: Check for chsize and posix_fallocate.  Replace
11889         ftruncate.
11890         * ftruncate.c: New file, from gnulib.
11891         * output.cc (posix_fallocate): Define dummy version if not
11892         HAVE_POSIX_FALLOCATE.
11893         (Output_file::map): Call posix_fallocate rather than lseek and
11894         write.
11895         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11896         * configure, Makefile.in, config.in: Rebuild.
11897
11898 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11899
11900         * layout.h (Layout::create_note): Add section_name parameter.
11901         * layout.cc (Layout::create_note): Likewise.
11902         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11903
11904 2009-03-17  Ian Lance Taylor  <iant@google.com>
11905
11906         * descriptors.cc: Include "options.h".
11907         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11908         (Descriptors::open): Always use O_CLOEXEC when opening a new
11909         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11910         then set FD_CLOEXEC.
11911
11912         * sparc.cc (class Target_sparc): Add has_got_section.
11913         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11914         make sure we have a GOT section.
11915
11916         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11917         (Target_sparc::Scan::local): Likewise.
11918         (Target_sparc::Scan::global): Likewise.
11919         (Target_sparc::Relocate::relocate): Likewise.
11920         (Target_sparc::Relocate::relocate_tls): Likewise.
11921
11922         * symtab.cc (Symbol_table::define_default_version): New function,
11923         broken out of add_from_object.
11924         (Symbol_table::add_from_object): Call define_default_version.
11925         (Symbol_table::define_special_symbol): Add resolve_oldsym
11926         parameter.  Change all callers.  If the version for a symbol comes
11927         from a version script, resolve it with the symbol with the same
11928         name with no version.  Also add the symbol without a version if
11929         appropriate.
11930         (do_define_in_output_data): If resolving with oldsym, don't delete
11931         sym.
11932         (do_define_in_output_segment): Likewise.
11933         (do_define_as_constant): Likewise.
11934         * symtab.h (class Symbol_table): Update declarations.
11935
11936 2009-03-13  Ian Lance Taylor  <iant@google.com>
11937
11938         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11939         (Read_symbols::requeue): New function.
11940         (Read_symbols::do_read_symbols): If make_elf_object fails because
11941         the target type is not configured, and the file was searched for,
11942         issue a warning and retry with the next directory.
11943         (Add_symbols::run): If the file has an incompatible format, and
11944         it was searched for, requeue the Read_symbols task.  On error,
11945         release the object.
11946         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11947         dirindex parameter to constructor.  Change all callers.  Declare
11948         incompatible_warning and requeue.
11949         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11950         input_argument_ and input_group_ fields.  Add them to
11951         constructor.  Change all callers.
11952         (class Read_script): Add dirindex_ field.  Add it to constructor.
11953         Change all callers.
11954         * archive.cc (Archive::setup): Remove input_objects parameter.
11955         Change all callers.
11956         (Archive::get_file_and_offset): Likewise.
11957         (Archive::read_all_symbols): Likewise.
11958         (Archive::read_symbols): Likewise.
11959         (Archive::get_elf_object_for_member): Remove input_objects
11960         parameter.  Add punconfigured parameter.  Change all callers.
11961         (Archive::add_symbols): Change return type to bool.  Check return
11962         value of include_member.
11963         (Archive::include_all_members): Likewise.
11964         (Archive::include_member): Change return type to bool.  Return
11965         false if first included object has incompatible target.  Set
11966         included_member_ field.
11967         (Add_archive_symbols::run): If add_symbols returns false, requeue
11968         Read_symbols task.
11969         * archive.h (class Archive): Add included_member_ field.
11970         Initialize it in constructor.  Add input_file and searched_for
11971         methods.  Update declarations.
11972         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11973         input_argument_ fields.  Add them to constructor.  Change all
11974         callers.
11975         * script.cc: Include "target-select.h".
11976         (class Parser_closure): Add skip_on_incompatible_target_ and
11977         found_incompatible_target_ fields.  Add
11978         skip_on_incompatible_target parameter to constructor.  Change all
11979         callers.  Add methods skip_on_incompatible_target,
11980         clear_skip_on_incompatible_target, found_incompatible_target, and
11981         set_found_incompatible_target.
11982         (read_input_script): Add dirindex parameter.  Change all callers.
11983         If parser finds an incompatible target, requeue Read_symbols
11984         task.
11985         (script_set_symbol): Clear skip_on_incompatible_target in
11986         closure.
11987         (script_add_assertion, script_parse_option): Likewise.
11988         (script_start_sections, script_add_phdr): Likewise.
11989         (script_check_output_format): New function.
11990         * script.h (read_input_script): Update declaration.
11991         * script-c.h (script_check_output_format): Declare.
11992         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11993         (ignore_cmd): Remove OUTPUT_FORMAT.
11994         * fileread.cc (Input_file::Input_file): Add explicit this.
11995         (Input_file::will_search_for): New function.
11996         (Input_file::open): Add pindex parameter.  Change all callers.
11997         * fileread.h (class Input_file): Add input_file_argument method.
11998         Declare will_search_for.  Update declarations.
11999         * object.cc (make_elf_object): Add punconfigured parameter.
12000         Change all callers.
12001         * object.h (class Object): Make input_file public.  Add
12002         searched_for method.
12003         (make_elf_object): Update declaration.
12004         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12005         restart search.
12006         * dirsearch.h (class Dirsearch): Update declaration.
12007         * options.h (class General_options): Add --warn-search-mismatch.
12008         * parameters.cc (Parameters::is_compatible_target): New function.
12009         * parameters.h (class Parameters): Declare is_compatible_target.
12010         * workqueue.cc (Workqueue::add_blocker): New function.
12011         * workqueue.h (class Workqueue): Declare add_blocker.
12012
12013         * fileread.cc (Input_file::open): Remove options parameter.
12014         Change all callers.
12015         (Input_file::open_binary): Likewise.
12016         * script.cc (read_input_script): Likewise.
12017         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12018         options parameter from constructor.  Change all callers.
12019         (class Read_script): Likewise.
12020         * fileread.h (class Input_file): Update declarations.
12021         * script.h (read_input_script): Update declaration.
12022
12023 2009-03-10  Nick Clifton  <nickc@redhat.com>
12024
12025         * po/es.po: New Spanish translation.
12026
12027 2009-03-06  Cary Coutant  <ccoutant@google.com>
12028
12029         * options.cc (parse_short_option): Keep dash_z from registering itself.
12030
12031 2009-03-03  Ian Lance Taylor  <iant@google.com>
12032
12033         PR 9918
12034         * target-reloc.h (relocate_section): Pass output_section to
12035         relocate.
12036         * i386.cc (Target_i386::should_apply_static_reloc): Add
12037         output_section parameter.  Change all callers.
12038         (Target_i386::Relocate::relocate): Add output_section parameter.
12039         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12040         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12041         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12042         * testsuite/two_file_shared.sh: New script.
12043         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12044         (check_DATA): Add two_file_shared.dbg.
12045         (two_file_shared.dbg): New target.
12046         * testsuite/Makefile.in: Rebuild.
12047
12048 2009-03-01  Ian Lance Taylor  <iant@google.com>
12049
12050         * configure.ac: Check for byteswap.h.
12051         * configure: Rebuild.
12052         * config.in: Rebuild.
12053
12054 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12055
12056         * layout.cc (Layout::find_or_add_kept_section): New function.
12057         (Layout::add_comdat): Removed.
12058         * layout.h (struct Kept_section): Move out of class Layout.
12059         Remove trailing underscores from field names.  Add group_sections
12060         field.  Rename group_ field to is_group.  Change all uses.
12061         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12062         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12063         comdat_groups_ field.
12064         (Sized_relobj::include_section_group): Use
12065         find_or_add_kept_section and Kept_section::group_sections.
12066         (Sized_relobj::include_linkonce_section): Likewise.
12067         * object.cc (class Sized_relobj): Don't define Comdat_group or
12068         Comdat_group_table.  Remove find_comdat_group and
12069         add_comdat_group.  Remove comdat_groups_ field.
12070         * plugin.cc (include_comdat_group): Use
12071         Layout::find_or_add_kept_section.
12072
12073 2009-02-28  Ian Lance Taylor  <iant@google.com>
12074
12075         * README: --gc-sections and map files are now supported.  Document
12076         some build requirements.
12077
12078         PR 6992
12079         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12080         relocatable link set the value of the section symbol to zero.
12081         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12082         relocatable link don't include the section address in the local
12083         symbol value.
12084
12085 2009-02-27  Ian Lance Taylor  <iant@google.com>
12086
12087         PR 6811
12088         * options.h (class Search_directory): Add is_system_directory.
12089         (class General_options): Declare is_in_system_directory.
12090         * options.cc (get_relative_sysroot): Make static.
12091         (get_default_sysroot): Make static.
12092         (General_optoins::is_in_system_directory): New function.
12093         * fileread.cc (Input_file::is_in_system_directory): New function.
12094         * fileread.h (class Input_file): Declare is_in_system_directory.
12095         * object.h (class Object): Add is_in_system_directory.
12096         (class Input_objects): Remove system_library_directory_ field.
12097         * object.cc (Input_objects::add_object): Don't set
12098         system_library_directory_.
12099         (input_objects::found_in_system_library_directory): Remove.
12100         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12101         parameter.  Change all callers.
12102         (Symbol_table::sized_write_globals): Likewise.
12103         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12104         Call Object::is_in_system_directory.
12105         * symtab.h (class Symbol_table): Update declarations.
12106
12107         PR 5990
12108         * descriptors.h (Open_descriptor): Add is_on_stack field.
12109         * descriptors.cc (Descriptors::open): If the descriptor is on the
12110         top of the stack, remove it.  Initialize is_on_stack field.
12111         (Descriptors::release): Only add pod to stack if it is not on the
12112         stack already.
12113         (Descriptors::close_some_descriptor): Clear stack_next and
12114         is_on_stack fields.
12115
12116         PR 7091
12117         * output.cc (Output_section::find_starting_output_address): Rename
12118         from starting_output_address; add PADDR parameter; change return
12119         type.
12120         * output.h (class Output_section): Declare
12121         find_starting_output_address instead of starting_output_address.
12122         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12123         section symbol for which we can't find a merge section.
12124
12125         PR 9836
12126         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12127         hidden or internal, force the symbol to be local.
12128         * resolve.cc (Symbol::override_visibility): Define.
12129         (Symbol::override_base): Use override_visibility.
12130         (Symbol_table::resolve): Likewise.
12131         (Symbol::override_base_with_special): Likewise.
12132         (Symbol_table::override_with_special): If the visibility is hidden
12133         or internal, force the symbol to be local.
12134         * symtab.h (class Symbol): Add set_visibility and
12135         override_visibility.
12136         * testsuite/ver_test_1.sh: New file.
12137         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12138         (check_DATA): Add ver_test_1.syms.
12139         (ver_test_1.syms): New target.
12140         * testsuite/Makefile.in: Rebuild.
12141
12142 2009-02-25  Cary Coutant  <ccoutant@google.com>
12143
12144         * layout.cc (Layout::choose_output_section): Don't rename sections
12145         when using a linker script that has a SECTIONS clause.
12146         * Makefile.in: Regenerate.
12147
12148         * testsuite/Makefile.am (script_test_5.sh): New test case.
12149         * testsuite/Makefile.in: Regenerate.
12150         * testsuite/script_test_5.cc: New file.
12151         * testsuite/script_test_5.sh: New file.
12152         * testsuite/script_test_5.t: New file.
12153
12154 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12155
12156         * archive.cc (Archive::include_member): Update calls to add_symbols.
12157         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12158         the Layout argument.
12159         * dynobj.h (do_add_symbols): Add the Layout argument.
12160         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12161         Layout argument.
12162         * object.h (Object::add_symbols): Add the Layout argument.
12163         (Object::do_add_symbols): Add the Layout argument.
12164         (Sized_relobj::do_add_symbols): Add the Layout argument.
12165         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12166         Unify the two versions.
12167         (Add_plugin_symbols): Remove.
12168         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12169         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12170         (Add_plugin_symbols): Remove.
12171         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12172         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12173         (Add_symbols::run): Make it work with Pulginobj.
12174
12175 2009-02-06  Ian Lance Taylor  <iant@google.com>
12176
12177         * object.cc (Sized_relobj::do_layout): Make info message start
12178         with lower case letter.
12179
12180 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12181
12182         * binary.cc: Fix file comment.
12183
12184         * options.h (enum Incremental_disposition): Define.
12185         (class General_options): Add new options: --incremental,
12186         --incremental_changed, --incremental_unchanged,
12187         --incremental_unknown.  Add incremental_disposition_ and
12188         implicit_incremental_ fields.
12189         (General_options::incremental_disposition): New function.
12190         (class Position_dependent_options): Add incremental_disposition
12191         option.
12192         (Position_dependent_options::copy_from_options): Set incremental
12193         dispositions.
12194         * options.cc (General_options::parse_incremental_changed): New
12195         function.
12196         (General_options::parse_incremental_unchanged): New function.
12197         (General_options::parse_incremental_unknown): New function.
12198         (General_options::General_options): Initialize new fields
12199         incremental_disposition_ and implicit_incremental_.
12200         (General_options::finalize): Check for uasge of --incremental-*
12201         without --incremental.
12202
12203 2009-02-06  Chris Demetriou  <cgd@google.com>
12204
12205         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12206         pointer and to report location as the file name associated with
12207         the symbol.
12208         (gold_undefined_symbol_at_location): New function to replace the
12209         old gold_undefined_symbol functionality.
12210         * target-reloc.h (relocate_section): Update to use
12211         gold_undefined_symbol_at_location.
12212         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12213         Call gold_undefined_symbol function rather than gold_error.
12214         * errors.h (Errors::undefined_symbol): Take location as a
12215         string, rather than calculating it from a relocation.
12216         * errors.cc (Errors::fatal): Print "fatal error:" before the
12217         formatted message.
12218         (Errors::error, Errors::error_at_location): Print "error: "
12219         before the formatted message.
12220         (Errors::undefined_symbol): Take location as a string, rather
12221         than calculating it from a relocation.
12222         (gold_undefined_symbol_at_location): New function akin to
12223         old gold_undefined_symbol, calculates location from relocation.
12224         (gold_undefined_symbol): Change to take only a Symbol pointer
12225         and to report location as the file name associated with the symbol.
12226         * testsuite/debug_msg.sh: Update for changed error messages.
12227         * testsuite/undef_symbol.sh: Likewise.
12228
12229 2009-02-04  Duncan Sands  <baldrick@free.fr>
12230
12231         PR 9812
12232         * reduced_debug_output.h
12233         (Output_reduced_debug_abbrev_section::failed): Use format for
12234         gold_warning.
12235         (Output_reduced_debug_info_section::faild): Likewise.
12236
12237 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12238
12239         * script.cc (Lazy_demangler): New class.
12240         (Version_script_info::get_symbol_version_helper): Demangle a
12241         symbol only once.
12242
12243 2009-01-29  Cary Coutant  <ccoutant@google.com>
12244
12245         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12246         to __tls_get_addr.
12247         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12248
12249 2009-01-28  Ian Lance Taylor  <iant@google.com>
12250
12251         * version.cc (version_string): Bump to 1.9.
12252
12253         * gold.h: Include <cstring> and <stdint.h>.
12254         * version.cc: Include <cstdio>.
12255         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12256         warning.
12257         * reduced_debug_output.cc (insert_into_vector): Rename from
12258         Insert_into_vector; change all callers.  Use Swap_unaligned to
12259         avoid aliasing issue; remove union since it is unnecessary.
12260
12261 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12262
12263         * Makefile.am (CCFILES): Add gc.cc.
12264         (HFILES): Add gc.h.
12265         * Makefile.in: Regenerate.
12266         * gold.cc (Gc_runner): New class.
12267         (queue_initial_tasks): Call garbage collection related tasks
12268         when corresponding options are invoked.
12269         (queue_middle_gc_tasks): New function.
12270         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12271         processed early before laying out sections during garbage collection.
12272         * gold.h (queue_middle_gc_tasks): New function.
12273         (is_prefix_of): Move from "layout.cc".
12274         * i386.cc (Target_i386::gc_process_relocs): New function.
12275         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12276         * main.cc (main): Create object of class "Garbage_collection".
12277         * object.cc (Relobj::copy_symbols_data): New function.
12278         (Relobj::is_section_name_included): New function.
12279         (Sized_relobj::do_layout): Allow this function to be called twice
12280         during garbage collection and defer layout of section during the
12281         first call.
12282         * object.h (Relobj::get_symbols_data): New function.
12283         (Relobj::is_section_name_included): New function.
12284         (Relobj::copy_symbols_data): New function.
12285         (Relobj::set_symbols_data): New function.
12286         (Relobj::get_relocs_data): New function.
12287         (Relobj::set_relocs_data): New function.
12288         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12289         (Relobj::gc_process_relocs): New function.
12290         (Relobj::do_gc_process_relocs): New pure virtual function.
12291         (Relobj::sd_): New data member.
12292         (Sized_relobj::is_output_section_offset_invalid): New function.
12293         (Sized_relobj::do_gc_process_relocs): New function.
12294         * options.h (General_options::gc_sections): Modify to not be a no-op.
12295         (General_options::print_gc_sections): New option.
12296         * plugin.cc (Plugin_finish::run): Remove function call to
12297         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12298         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12299         * reloc.cc (Read_relocs::run): Add task to process relocs and
12300         determine unreferenced sections when doing garbage collection.
12301         (Gc_process_relocs): New class.
12302         (Sized_relobj::do_gc_process_relocs): New function.
12303         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12304         sections that are garbage collected.
12305         * reloc.h (Gc_process_relocs): New class.
12306         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12307         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12308         symbols whose corresponding sections are garbage collected.
12309         (Symbol_table::Symbol_table): Add new parameter for the garbage
12310         collection object.
12311         (Symbol_table::gc_mark_undef_symbols): New function.
12312         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12313         (Symbol_table::gc_mark_dyn_syms): New function.
12314         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12315         as garbage.
12316         (Symbol_table::add_from_object): Likewise.
12317         (Symbol_table::add_from_relobj): When building shared objects, do not
12318         treat externally visible symbols as garbage.
12319         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12320         table information for static and relocatable links.
12321         * symtab.h (Symbol_table::set_gc): New function.
12322         (Symbol_table::gc): New function.
12323         (Symbol_table::gc_mark_undef_symbols): New function.
12324         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12325         (Symbol_table::gc_mark_dyn_syms): New function.
12326         (Symbol_table::gc_): New data member.
12327         * target.h (Sized_target::gc_process_relocs): New pure virtual
12328         function.
12329         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12330         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12331
12332 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12333
12334         * options.h (General_options::gc_sections): Define as a no-op for now.
12335         (General_options::no_keep_memory): Ditto.
12336         (General_options::Bshareable): Define.
12337         * options.cc (General_options::finalize): Honor -Bshareable.
12338
12339 2009-01-20  Andreas Schwab  <schwab@suse.de>
12340
12341         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12342         read the value in the contents, since we don't use it.  Use the
12343         template endianness when writing.
12344         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12345
12346 2009-01-19  Andreas Schwab  <schwab@suse.de>
12347
12348         * configure.tgt (powerpc64-*): Fix targ_obj.
12349
12350 2009-01-15  Ian Lance Taylor  <iant@google.com>
12351
12352         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12353         local symbols when stripping all symbols.
12354
12355 2009-01-14  Cary Coutant  <ccoutant@google.com>
12356
12357         * output.cc (Output_reloc): Add explicit instantiations.
12358
12359 2009-01-14  Cary Coutant  <ccoutant@google.com>
12360
12361         * archive.cc (Archive::get_elf_object_for_member): Remove call
12362         to File_read::claim_for_plugin.
12363         * descriptors.cc (Descriptors::open): Remove reference to
12364         is_claimed.
12365         (Descriptors::claim_for_plugin): Remove.
12366         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12367         (Descriptors::is_claimed): Remove.
12368         (claim_descriptor_for_plugin): Remove.
12369         * fileread.cc (File_read::claim_for_plugin): Remove.
12370         * fileread.h (File_read::claim_for_plugin): Remove.
12371         (File_read::descriptor): Reopen descriptor if necessary.
12372         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12373         (Plugin_manager::all_symbols_read): Add task parameter. Change
12374         all callers.
12375         (Plugin_manager::get_input_file): New function.
12376         (Plugin_manager::release_input_file): New function.
12377         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12378         corresponding data member.
12379         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12380         and pass to base constructor. Change all callers.
12381         (get_input_file, release_input_file): New functions.
12382         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12383         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12384         (Plugin_manager::all_symbols_read): Add task parameter.
12385         (Plugin_manager::get_input_file): New function.
12386         (Plugin_manager::release_input_file): New function.
12387         (Plugin_manager::task_): New data member.
12388         (Pluginobj::Pluginobj): Add filesize parameter.
12389         (Pluginobj::filename): New function.
12390         (Pluginobj::descriptor): New function.
12391         (Pluginobj::filesize): New function.
12392         (Pluginobj::filesize_): New data member.
12393         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12394         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12395         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12396
12397         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12398         with archive libraries.
12399         * testsuite/Makefile.in: Regenerate.
12400         * testsuite/plugin_test.c (struct sym_info): New type.
12401         (get_input_file, release_input_file): New static variables.
12402         (onload): Capture new transfer vector entries.
12403         (claim_file_hook): Stop reading at end of file according to filesize.
12404         Factor out parsing of readelf output into separate function.
12405         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12406         APIs and get the source file name from the symbol table.  Convert
12407         source file name to corresponding object file name.  Print info
12408         message when adding new input files.
12409         (parse_readelf_line): New function.
12410         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12411         * testsuite/plugin_test_2.sh: Likewise.
12412         * testsuite/plugin_test_3.sh: Likewise.
12413         * testsuite/plugin_test_4.sh: New test case.
12414
12415 2009-01-07  Ian Lance Taylor  <iant@google.com>
12416
12417         * version.cc (version_string): Bump to 1.8.
12418
12419 2008-12-23  Cary Coutant  <ccoutant@google.com>
12420
12421         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12422         * plugin.cc (Plugin_manager::finish): Rename as
12423         layout_deferred_objects.  Move cleanup to separate function.
12424         (Plugin_manager::cleanup): New function.
12425         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12426         separately.
12427         * plugin.h (Plugin_manager::finish): Rename as
12428         layout_deferred_objects.
12429         (Plugin_manager::cleanup): New function.
12430         (Plugin_manager::cleanup_done): New field.
12431
12432 2008-12-23  Cary Coutant  <ccoutant@google.com>
12433
12434         * plugin.cc (is_visible_from_outside): New function.
12435         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12436         so we don't return "IR only" status for exported symbols or -r links.
12437
12438         * testsuite/Makefile.am (plugin_test_3): New test case.
12439         * testsuite/Makefile.in: Regenerate.
12440         * testsuite/plugin_test_3.sh: New file.
12441
12442 2008-12-22  Cary Coutant  <ccoutant@google.com>
12443
12444         * object.cc (Sized_relobj::layout_section): New function.
12445         (Sized_relobj::do_layout): Defer layout of input sections until after
12446         plugin has provided replacement files.
12447         (Sized_relobj::do_layout_deferred_sections): New function.
12448         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12449         (Relobj::layout_deferred_sections): New function.
12450         (Relobj::do_layout_deferred_sections): New function.
12451         (Sized_relobj::do_layout_deferred_sections): New function.
12452         (Sized_relobj::layout_section): New function.
12453         (Sized_relobj::Deferred_layout): New structure.
12454         (Sized_relobj::deferred_layout_): New field.
12455         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12456         Change all callers.  Layout deferred sections.
12457         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12458         references.
12459         (Plugin_hook::run): Move code from do_plugin_hook inline.
12460         (Plugin_hook::do_plugin_hook): Remove.
12461         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12462         (Plugin_manager::finish): Renamed, was cleanup.
12463         (Plugin_manager::should_defer_layout): New function.
12464         (Plugin_manager::add_deferred_layout_object): New function.
12465         (Plugin_manager::Deferred_layout_list): New type.
12466         (Plugin_manager::deferred_layout_objects_): New field.
12467         (Plugin_hook::do_plugin_hook): Remove.
12468
12469 2008-12-17  Ian Lance Taylor  <iant@google.com>
12470
12471         * options.h (class General_options): Add --no case for
12472         --export-dynamic.
12473
12474 2008-12-16  Cary Coutant  <ccoutant@google.com>
12475
12476         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12477         vector.
12478         (Plugin_manager::claim_file): Create plugin object even if
12479         plugin did not call the add_symbols callback.
12480         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12481         asking for more symbols than were added.
12482         * testsuite/Makefile.am (plugin_test_1): Add test case with
12483         no global symbols.
12484         (empty.syms): New target.
12485         * testsuite/Makefile.in: Regenerate.
12486         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12487         message. Don't call add_symbols if no globals.
12488         (all_symbols_read_hook): Don't provide replacement for empty
12489         claimed file.
12490
12491 2008-12-12  Ian Lance Taylor  <iant@google.com>
12492
12493         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12494         r_type == 0 for a local symbol with r_sym == 0.
12495         (scan_relocatable_relocs): Pass r_sym to
12496         local_non_section_strategy.
12497         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12498         r_sym parameter.
12499
12500         * configure.ac: Update test for TLS descriptors: they are
12501         supported as of glibc 2.9.
12502         * configure: Rebuild.
12503
12504 2008-12-11  Ian Lance Taylor  <iant@google.com>
12505
12506         PR 7091
12507         * target-reloc.h (Default_scan_relocatable_relocs): For each
12508         function, map r_type == 0 to RELOC_DISCARD.
12509
12510 2008-12-10  Cary Coutant  <ccoutant@google.com>
12511
12512         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12513         object to override a kept COMDAT group from a plugin object.
12514
12515 2008-12-09  Ian Lance Taylor  <iant@google.com>
12516
12517         PR 7088
12518         * yyscript.y (file_cmd): Handle INPUT.
12519
12520         * testsuite/initpri1.c: Change all declarations to be full
12521         prototypes by adding void, to avoid compiler warnings.
12522
12523 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12524
12525         * options.cc (General_options::parse_plugin_opt): New.
12526         (General_options::add_plugin): The argument now is just the filename.
12527         (General_options::add_plugin_option): New.
12528         * options.h (plugin_opt): New.
12529         (add_plugin): Change argument name.
12530         (add_plugin_option): New.
12531         * plugin.cc (Plugin::load): Don't parse the plugin option.
12532         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12533         (Plugin::add_option): New.
12534         (Plugin::args_): Change type.
12535         (Plugin::filename_): New.
12536         (Plugin_manager::add_plugin_option): New.
12537         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12538         * testsuite/Makefile.in: Regenerate.
12539
12540 2008-12-05  Cary Coutant  <ccoutant@google.com>
12541
12542         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12543         Handle --strip-lto-sections option.
12544         * options.h (strip_lto_sections): New option.
12545
12546 2008-12-01  Cary Coutant  <ccoutant@google.com>
12547
12548         * plugin.cc (ld_plugin_message): Change format parameter to const.
12549         Fix mismatch between new[] and delete.
12550
12551 2008-11-14  Cary Coutant  <ccoutant@google.com>
12552
12553         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12554         instead of -1U.
12555
12556 2008-11-05  Craig Silverstein  <csilvers@google.com>
12557
12558         * options.cc (General_options::parse_dynamic_list): New function.
12559         * options.h (General_options): New flags dynamic_list,
12560         dynamic_list_data, dynamic_list_cpp_new, and
12561         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12562         (General_options::in_dynamic_list): New function.
12563         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12564         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12565         (Lex::can_continue_name): Likewise.
12566         (yylex): Likewise.
12567         (read_script_file): New parameter script_options.
12568         (read_dynamic_list): New function.
12569         (Script_options::define_dynamic_list): New function.
12570         (dynamic_list_keyword_parsecodes): New variable.
12571         (dynamic_list_keywords): New variable.
12572         * script.h (Script_options::define_dynamic_list): New function
12573         prototype.
12574         (read_dynamic_list): New function prototype.
12575         * symtab.cc (strprefix): New macro.
12576         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12577         dynamic_list_data, dynamic_list_cpp_new, and
12578         dynamic_list_cpp_typeinfo.
12579         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12580         (dynamic_list_expr): New rule.
12581         (dynamic_list_nodes): Likewise.
12582         (dynamic_list_node): Likewise.
12583         * testsuite/Makefile.am (dynamic_list): New test.
12584         * testsuite/Makefile.in: Regenerated.
12585         * testsuite/dynamic_list.t: New file.
12586         * testsuite/dynamic_list.sh: New file.
12587
12588 2008-11-05  Craig Silverstein  <csilvers@google.com>
12589
12590         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12591         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12592         (t11_last): Likewise.
12593         * testsuite/ver_test_6.c (main): Likewise.
12594
12595 2008-10-07  Cary Coutant  <ccoutant@google.com>
12596
12597         * options.c (General_options::finalize): Add check for -static and
12598         -shared.
12599         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12600         is not empty.
12601
12602 2008-10-02  Cary Coutant  <ccoutant@google.com>
12603
12604         * plugin.cc (make_sized_plugin_object): Fix conditional
12605         compilation to work when not all targets are enabled.
12606
12607 2008-09-29  Cary Coutant  <ccoutant@google.com>
12608
12609         * archive.cc (Archive::get_file_and_offset): Use filename instead
12610         of name to get library path.
12611         (Archive::include_member): Unlock external member of a thin archive.
12612
12613         * testsuite/Makefile.am (TEST_AR): New variable.
12614         (thin_archive_test_1): New test.
12615         (thin_archive_test_2): New test.
12616         * testsuite/Makefile.in: Regenerate.
12617         * testsuite/thin_archive_main.cc: New file.
12618         * testsuite/thin_archive_test_1.cc: New file.
12619         * testsuite/thin_archive_test_2.cc: New file.
12620         * testsuite/thin_archive_test_3.cc: New file.
12621         * testsuite/thin_archive_test_4.cc: New file.
12622
12623 2008-09-29  Cary Coutant  <ccoutant@google.com>
12624
12625         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12626         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12627         instead of -1U.
12628         (Sized_relobj::do_finalize_local_symbols): Likewise.
12629         (Sized_relobj::map_to_kept_section): Likewise.
12630         * object.h (Sized_relobj::invalid_address): New constant.
12631         (Sized_relobj::do_output_section_offset): Check for invalid_address
12632         and return -1ULL.
12633         * output.cc (Output_reloc::local_section_offset): Use constant
12634         invalid_address instead of -1U.
12635         (Output_reloc::get_address): Likewise.
12636         (Output_section::output_address): Change -1U to -1ULL.
12637         * output.h (Output_reloc::invalid_address): New constant.
12638         * reloc.cc (Sized_relobj::write_sections): Use constant
12639         invalid_address instead of -1U.
12640         (Sized_relobj::relocate_sections): Likewise.
12641         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12642         values for merge sections.
12643         * target-reloc.h (relocate_for_relocatable): Use constant
12644         invalid_address instead of -1U.
12645
12646 2008-09-19  Cary Coutant  <ccoutant@google.com>
12647
12648         Add plugin functionality for link-time optimization (LTO).
12649         * configure.ac (plugins): Add --enable-plugins option.
12650         * configure: Regenerate.
12651         * config.in: Regenerate.
12652         * Makefile.am (LIBDL): New variable.
12653         (CCFILES): Add plugin.cc.
12654         (HFILES): Add plugin.h.
12655         (ldadd_var): Add LIBDL.
12656         * Makefile.in: Regenerate.
12657
12658         * archive.cc: Include "plugin.h".
12659         (Archive::setup): Don't preread archive symbols when using a plugin.
12660         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12661         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12662         files.
12663         (Archive::include_member): Add symbols from plugin objects.
12664         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12665         * descriptors.cc (Descriptors::open): Check for file descriptors
12666         abandoned by plugins.
12667         (Descriptors::claim_for_plugin): New function.
12668         * descriptors.h (Descriptors::claim_for_plugin): New function.
12669         (Open_descriptor::is_claimed): New field.
12670         (claim_descriptor_for_plugin): New function.
12671         * fileread.cc (File_read::claim_for_plugin): New function.
12672         * fileread.h (File_read::claim_for_plugin): New function.
12673         (File_read::descriptor): New function.
12674         * gold.cc: Include "plugin.h".
12675         (queue_initial_tasks): Add task to call plugin hooks for generating
12676         new object files.
12677         * main.cc: Include "plugin.h".
12678         (main): Load plugin libraries.
12679         * object.h (Pluginobj): Declare.
12680         (Object::pluginobj): New function.
12681         (Object::do_pluginobj): New function.
12682         (Object::set_target): New function.
12683         * options.cc: Include "plugin.h".
12684         (General_options::parse_plugin): New function.
12685         (General_options::General_options): Initialize plugins_ field.
12686         (General_options::add_plugin): New function.
12687         * options.h (Plugin_manager): Declare.
12688         (General_options): Add --plugin option.
12689         (General_options::has_plugins): New function.
12690         (General_options::plugins): New function.
12691         (General_options::add_plugin): New function.
12692         (General_options::plugins_): New field.
12693         * plugin.cc: New file.
12694         * plugin.h: New file.
12695         * readsyms.cc: Include "plugin.h".
12696         (Read_symbols::do_read_symbols): Check for archive before checking
12697         for ELF file.  Call plugin hooks to claim files.
12698         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12699         from a real object file; force override when processing replacement
12700         files.
12701         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12702         (Symbol::init_base_object): Likewise.
12703         (Symbol::init_base_output_data): Likewise.
12704         (Symbol::init_base_output_segment): Likewise.
12705         (Symbol::init_base_constant): Likewise.
12706         (Symbol::init_base_undefined): Likewise.
12707         (Symbol::output_section): Assert that object is not a plugin.
12708         (Symbol_table::add_from_pluginobj): New function.
12709         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12710         undefined.
12711         (Symbol_table::sized_write_globals): Likewise.
12712         (Symbol_table::add_from_pluginobj): Instantiate template.
12713         * symtab.h (Sized_pluginobj): Declare.
12714         (Symbol::in_real_elf): New function.
12715         (Symbol::set_in_real_elf): New function.
12716         (Symbol::in_real_elf_): New field.
12717         (Symbol_table::add_from_pluginobj): New function.
12718
12719         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12720         (LIBDL): New variable.
12721         (LDADD): Add LIBDL.
12722         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12723         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12724         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12725         (MOSTLYCLEANFILES): Likewise.
12726         * testsuite/Makefile.in: Regenerate.
12727         * testsuite/plugin_test.c: New file.
12728         * testsuite/plugin_test_1.sh: New file.
12729         * testsuite/plugin_test_2.sh: New file.
12730
12731 2008-09-16  Ian Lance Taylor  <iant@google.com>
12732
12733         * target-reloc.h (relocate_section): Check whether a symbol is
12734         defined by the ABI before reporting an undefined symbol error.
12735         * target.h (Target::is_defined_by_abi): Make parameter const.
12736         (Target::do_is_defined_by_abi): Likewise.
12737         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12738         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12739         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12740         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12741         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12742         * testsuite/Makefile.in: Rebuild.
12743
12744         * fileread.cc (make_view): Add casts to avoid warning.
12745
12746 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12747
12748         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12749         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12750
12751 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12752
12753         * options.h (General_options::output_is_executable): New.
12754         (General_options::output_is_pie): New.
12755         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12756         for shared libraries.
12757         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12758
12759 2008-09-11  Chris Demetriou  <cgd@google.com>
12760
12761         * options.h (origin): New -z option.
12762         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12763         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12764         in DT_FLAGS_1.
12765
12766 2008-09-05  Cary Coutant  <ccoutant@google.com>
12767
12768         * fileread.cc (File_read::make_view): Add check for attempt to map
12769         beyond end of file.
12770
12771 2008-09-05  Cary Coutant  <ccoutant@google.com>
12772
12773         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12774         explicit instantiations.
12775
12776 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12777
12778         PR gold/6858
12779         * options.cc (General_options::finalize): Allow undefined symbols
12780         in shlibs if linking -shared.
12781
12782         PR gold/6859
12783         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12784         symbols as not needing a dynsym entry.
12785
12786 2008-08-20  Craig Silverstein  <csilvers@google.com>
12787
12788         * fileread.cc (File_read::open): Do not lock the file unless it
12789         was successfully opened.
12790
12791 2008-08-14  Cary Coutant  <ccoutant@google.com>
12792
12793         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12794         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12795         * testsuite/tls_test.cc (struct int128): 128-bit struct
12796         for testing TLS relocs with non-zero addend.
12797         (v12): New TLS variable.
12798         (t12): New test.
12799         (t_last): Add check for v12.
12800         * testsuite/tls_test.h (t12): New function.
12801         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12802
12803 2008-08-13  Ian Lance Taylor  <iant@google.com>
12804
12805         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12806         set tls_segment_ or relro_segment_.
12807         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12808         when appropriate.
12809         * output.h (Output_section::clear_is_relro): New function.
12810         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12811         sections specially even when output_data_ is empty.
12812         (Output_segment::maximum_alignment): When first section is relro,
12813         only force alignment for PT_LOAD segments.
12814         * script.cc (script_data_segment_align): New function.
12815         (script_data_segment_relro_end): New function.
12816         * script-c.h (script_data_segment_align): Declare.
12817         (script_data_segment_relro_end): Declare.
12818         * script-sections.h (class Script_sections): Declare
12819         data_segment_align and data_segment_relro_end.  Add fields
12820         segment_align_index_ and saw_relro_end_.
12821         * script-sections.cc (class Sections_element): Add set_is_relro
12822         virtual function.  Add new bool* parameter to place_orphan_here.
12823         Add get_output_section virtual function.
12824         (class Output_section_definition): Add set_is_relro.  Add new
12825         bool* parameter to place_orphan_here.  Add get_output_section.
12826         Add is_relro_ field.
12827         (Output_section_definition::Output_section_definition): Initialize
12828         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12829         and is_relro_ fields.
12830         (Output_section_definition::place_orphan_here): Add is_relro
12831         parameter.
12832         (Output_section_definition::set_section_addresses): Set relro for
12833         output section.
12834         (Output_section_definition::alternate_constraint): Likewise.
12835         (class Orphan_output_section): Add new bool* parameter to
12836         place_orphan_here.  Add get_output_section.
12837         (Orphan_output_section::place_orphan_here): Add is_relro
12838         parameter.
12839         (Script_sections::Script_sections): Initialize
12840         data_segment_align_index_ and saw_relro_end_.
12841         (Script_sections::data_segment_align): New function.
12842         (Script_sections::data_segment_relro_end): New function.
12843         (Script_sections::place_orphan): Set or clear is_relro.
12844         (Script_sections::set_section_addresses): Force alignment of first
12845         TLS section.
12846         * yyscript.y (exp): Call script_data_segment_align and
12847         script_data_segment_relro_end.
12848         * testsuite/relro_script_test.t: New file.
12849         * testsuite/relro_test.cc (using_script): Declare.
12850         (t1, t2): Test using_script.
12851         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12852         (relro_script_test_SOURCES): Define.
12853         (relro_script_test_DEPENDENCIES): Define.
12854         (relro_script_test_LDFLAGS): Define.
12855         (relro_script_test_LDADD): Define.
12856         (relro_script_test.so): New target.
12857         * testsuite/Makefile.in: Rebuild.
12858
12859 2008-08-06  Cary Coutant <ccoutant@google.com>
12860
12861         * archive.cc (Archive::total_archives, Archive::total_members)
12862         (Archive::total_members_loaded): New variables.
12863         (Archive::setup): Add parameter.  Add option to preread
12864         archive symbols.
12865         (Archive::read_armap): Add counter.
12866         (Archive::get_file_and_offset): New function.
12867         (Archive::get_elf_object_for_member): New function.
12868         (Archive::read_all_symbols): New function.
12869         (Archive::read_symbols): New function.
12870         (Archive::add_symbols): Add counters.
12871         (Archive::include_all_members): Use armap to find members if it's
12872         already built.
12873         (Archive::include_member): Skip reading symbols if already read.
12874         Factored code into Archive::get_file_and_offset and
12875         Archive::get_elf_object_for_member.  Changed call to
12876         Mapfile::report_include_archive_member.
12877         (Archive::print_stats): New function.
12878         * archive.h: Declare Object and Read_symbols_data classes.
12879         (Archive::Archive): Add initializers for new members.
12880         (Archive::setup): Add parameter.
12881         (Archive::print_stats): New function.
12882         (Archive::total_archives, Archive::total_members)
12883         (Archive::total_members_loaded): New variables.
12884         (Archive::get_file_and_offset): New function.
12885         (Archive::get_elf_object_for_member): New function.
12886         (Archive::read_all_symbols): New function.
12887         (Archive::read_symbols): New function.
12888         (Archive::Archive_member): New class.
12889         (Archive::members_): New member.
12890         (Archive::num_members_): New member.
12891         * main.cc: Include archive.h.
12892         (main): Call Archive::print_stats.
12893         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12894         archive parameter; member_name is now the fully-decorated name.
12895         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12896         * options.h: (General_options): Add --preread-archive-symbols option.
12897         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12898         Archive::setup.
12899
12900 2008-08-04  Ian Lance Taylor  <iant@google.com>
12901
12902         * symtab.h (Symbol::use_plt_offset): New function.
12903         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12904         * powerpc.cc (Relocate::relocate): Likewise.
12905         * sparc.cc (Relocate::relocate): Likewise.
12906         * x86_64.cc (Relocate::relocate): Likewise.
12907         * testsuite/weak_plt.sh: New test.
12908         * testsuite/weak_plt_main.cc: New test.
12909         * testsuite/weak_plt_shared.cc: New test.
12910         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12911         (check_PROGRAMS): Add weak_plt.
12912         (check_DATA): Add weak_plt_shared.so.
12913         (weak_plt_main_pic.o, weak_plt): New targets.
12914         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12915         * testsuite/Makefile.in: Rebuild.
12916
12917         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12918         gcctestdir/ld.
12919         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12920         * testsuite/Makefile.in: Rebuild.
12921
12922 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12923
12924         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12925         * Makefile.in: Regenerate.
12926         * po/POTFILES.in: Regenerate.
12927
12928 2008-07-29  Ian Lance Taylor  <iant@google.com>
12929
12930         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12931         symbols before other symbols.
12932         * testsuite/script_test_2.cc (test_addr): Declare.
12933         (test_addr_alias): Declare.
12934         (main): Check that test_addr and test_addr_alias have the right
12935         values.
12936         * testsuite/script_test_2.t: Define test_addr_alias and
12937         test_addr.
12938
12939 2008-07-24  Ian Lance Taylor  <iant@google.com>
12940
12941         PR 5990
12942         * descriptors.cc: New file.
12943         * descriptors.h: New file.
12944         * gold-threads.h (class Hold_optional_lock): New class.
12945         * fileread.cc: Include "descriptors.h".
12946         (File_read::~File_read): Release descriptor rather than closing
12947         it.
12948         (File_read::open) [file]: Call open_descriptor rather than open.
12949         Set is_descriptor_opened_.
12950         (File_read::open) [memory]: Assert that descriptor is not open.
12951         (File_read::reopen_descriptor): New function.
12952         (File_read::release): Release descriptor.
12953         (File_read::do_read): Make non-const.  Reopen descriptor.
12954         (File_read::read): Make non-const.
12955         (File_read::make_view): Reopen descriptor.
12956         (File_read::do_readv): Likewise.
12957         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12958         Update declarations.
12959         * layout.cc: Include "descriptors.h".
12960         (Layout::create_build_id): Use open_descriptor rather than open.
12961         * output.cc: Include "descriptors.h".
12962         (Output_file::open): Use open_descriptor rather than open.
12963         * archive.cc (Archive::const_iterator): Change Archive to be
12964         non-const.
12965         (Archive::begin, Archive::end): Make non-const.
12966         (Archive::count_members): Likewise.
12967         * archive.h (class Archive): Update declarations.
12968         * object.h (Object::read): Make non-const.
12969         * Makefile.am (CCFILES): Add descriptors.cc.
12970         (HFILES): Add descriptors.h.
12971         * Makefile.in: Rebuild.
12972
12973         PR 6716
12974         * gold.h: Always include <clocale>.  Add Solaris workarounds
12975         following code in binutils/sysdep.h.
12976
12977         PR 6048
12978         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12979         this->eh_frame_hdr_ is NULL before using it.
12980
12981         * dynobj.cc (Versions::Versions): Update comment.
12982
12983         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12984         the base version name.
12985
12986         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12987         array size plus one.
12988         (Stringpool_template::set_string_offsets): Subtract one from key
12989         before using it as an array index.
12990         (Stringpool_template::get_offset_with_length): Likewise.
12991         (Stringpool_template::write_to_buffer): Likewise.
12992         * stringpool.h (Stringpool_template::get_offset_from_key):
12993         Likewise.
12994
12995 2008-07-23  Ian Lance Taylor  <iant@google.com>
12996
12997         PR 6658
12998         * object.h (Merged_symbol_value::value): Do our best to handle a
12999         negative addend.
13000
13001         PR 6647
13002         * script.cc (Version_script_info::get_versions): Don't add empty
13003         version tag to return value.
13004         (Version_script_info::get_symbol_version_helper): Change return
13005         type to bool.  Add pversion parameter.  Change all callers.
13006         (script_register_vers_node): Don't require a non-NULL tag.
13007         * script.h (class Version_script_info): Update declarations.
13008         (Version_script_info::get_symbol_version): Change return type to
13009         bool.  Add version parameter.  Change all callers.
13010         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13011         handling.  Handle an empty version from a version script.
13012         (Symbol_table::define_special_symbol): Likewise.
13013         * testsuite/ver_test_10.script: New file.
13014         * testsuite/ver_test_10.sh: New file.
13015         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13016         (check_DATA): Add ver_test_10.syms.
13017         (ver_test_10.syms, ver_test_10.so): New target.
13018         * testsuite/Makefile.in: Rebuild.
13019
13020 2008-07-23  Simon Baldwin  <simonb@google.com>
13021
13022         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13023         to zero for undefined symbols from dynamic libraries.
13024
13025 2008-07-23  Ian Lance Taylor  <iant@google.com>
13026
13027         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13028         Change all callers.
13029         * symtab.h (class Symbol_table): Update declaration.
13030         * testsuite/ver_test_9.cc: New file.
13031         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13032         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13033         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13034         (ver_test_9.so, ver_test_9.o): New targets.
13035         * testsuite/Makefile.in: Rebuild.
13036
13037 2008-07-22  Ian Lance Taylor  <iant@google.com>
13038
13039         * options.h (class General_options): Define --check-sections.
13040         * layout.cc (Layout::set_segment_offsets): Handle
13041         --check-sections.
13042
13043         * options.h (class General_options): Define -n/--nmagic and
13044         -N/--omagic.
13045         * options.cc (General_options::finalize): For -n/--nmagic or
13046         -N/--omagic, set -static.
13047         * layout.cc (Layout::attach_allocated_section_to_segment): If
13048         -N/--omagic, don't put read-only and read-write sections in
13049         different segments.
13050         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13051         finding a read-only segment.
13052         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13053         don't set the minimum segment alignment to the common page size,
13054         and don't set the file offset to the address modulo the page size.
13055         * script-sections.cc (Script_sections::create_segments): If
13056         -n/--omagic, don't put read-only and read-write sections in
13057         different segments.
13058
13059         * cref.cc: New file.
13060         * cref.h: New file.
13061         * options.h (class General_options): Add --print-symbol-counts.
13062         * main.cc (main): Issue defined symbol report if requested.
13063         * archive.cc (Archive::interpret_header): Make into a const member
13064         function.
13065         (Archive::add_symbols): Call Input_objects::archive_start and
13066         archive_stop.
13067         (Archive::const_iterator): Define new class.
13068         (Archive::begin, Archive::end): New functions.
13069         (Archive::include_all_members): Rewrite to use iterator.
13070         (Archive::count_members): New function.
13071         * archive.h (class Archive): Update declarations.
13072         (Archive::filename): New function.
13073         * object.cc: Include "cref.h".
13074         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13075         (Sized_relobj::do_get_global_symbol_counts): New function.
13076         (Input_objects::add_object): Add object to cross-referencer.
13077         (Input_objects::archive_start): New function.
13078         (Input_objects::archive_stop): New function.
13079         (Input_objects::print_symbol_counts): New function.
13080         * object.h: Declare Cref and Archive.
13081         (Object::get_global_symbol_counts): New function.
13082         (Object::do_get_global_symbol_counts): New pure virtual function.
13083         (class Sized_relobj): Add defined_count_ field.  Update
13084         declarations.
13085         (class Input_objects): Add cref_ field.  Update constructor.
13086         Update declarations.
13087         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13088         defined_count_.
13089         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13090         symbol counts.
13091         (Sized_dynobj::do_get_global_symbol_counts): New function.
13092         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13093         defined_count_.  Update declarations.  Define Symbols typedef.
13094         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13095         parameter.  Change all callers.
13096         (Symbol_table::add_from_dynobj): Add sympointers and defined
13097         parameters.  Change all callers.
13098         * symtab.h (class Symbol_table): Update declarations.
13099         * Makefile.am (CCFILES): Add cref.cc.
13100         (HFILES): Add cref.h.
13101         * Makefile.in: Rebuild.
13102
13103 2008-07-22  Simon Baldwin  <simonb@google.com>
13104
13105         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13106         to zero when writing undefined symbols.
13107
13108 2008-07-22  Ian Lance Taylor  <iant@google.com>
13109
13110         * output.cc (Output_section::add_input_section): Don't try to
13111         merge empty merge sections.
13112
13113 2008-07-21  Craig Silverstein  <csilvers@google.com>
13114
13115         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13116         Include symbol version in error message.
13117
13118 2008-07-20  Chris Demetriou  <cgd@google.com>
13119
13120         * configure.ac (gold_cv_c_random_seed): New configured variable.
13121         (RANDOM_SEED_CFLAGS): New substituted variable.
13122         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13123         * configure: Rebuild.
13124         * Makefile.in: Likewise.
13125         * testsuite/Makefile.in: Likewise.
13126
13127 2008-07-18  Ian Lance Taylor  <iant@google.com>
13128
13129         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13130         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13131         * testsuite/ver_test_main.cc (main): Call t4.
13132         (t4, t4_2a): Define.
13133         * testsuite/ver_test_2.cc (t4_2): Define.
13134         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13135         * testsuite/ver_test_4.cc (t4_2a): Define.
13136         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13137         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13138
13139 2008-07-17  Ian Lance Taylor  <iant@google.com>
13140
13141         * dynobj.cc (Versions::add_def): If we give an error about a
13142         missing version, go ahead and create the version anyhow.
13143
13144 2008-07-10  Ian Lance Taylor  <iant@google.com>
13145
13146         Handle output sections with more than 0x7fffffff bytes.
13147         * object.h (class Relobj): Change map_to_output_ to
13148         output_sections_, and just keep a section pointer.  Change all
13149         uses.  Move comdat group support to Sized_relobj.
13150         (Relobj::is_section_specially_mapped): Remove.
13151         (Relobj::output_section): Remove poff parameter.  Change all
13152         callers.
13153         (Relobj::output_section_offset): New function.
13154         (Relobj::set_section_offset): Rewrite.
13155         (Relobj::map_to_output): Remove.
13156         (Relobj::output_sections): New function.
13157         (Relobj::do_output_section_offset): New pure virtual function.
13158         (Relobj::do_set_section_offset): Likewise.
13159         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13160         group support from Relobj.  Update declarations.
13161         (Sized_relobj::get_output_section_offset): New function.
13162         (Sized_relobj::do_output_section_offset): New function.
13163         (Sized_relobj::do_set_section_offset): New function.
13164         * object.cc (Relobj::output_section_address): Remove.
13165         (Sized_relobj::Sized_relobj): Initialize new fields.
13166         (Sized_relobj::include_section_group): Cast find_kept_object to
13167         Sized_relobj.
13168         (Sized_relobj::include_linkonce_section): Likewise.
13169         (Sized_relobj::do_layout): Use separate arrays for output section
13170         and output offset.
13171         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13172         output_sections.
13173         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13174         output_sections and section_offsets.
13175         (Sized_relobj::write_local_symbols): Likewise.
13176         (map_to_kept_section): Compute output address directly.
13177         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13178         output_sections and section_offsets.
13179         (Sized_relobj::write_sections): Likewise.
13180         (Sized_relobj::relocate_sections): Likewise.
13181         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13182         * output.h (class Output_reloc): Update declarations.  Change
13183         u2_.relobj to Sized_relobj*.
13184         (class Output_data_reloc): Change add functions to use
13185         Sized_relobj*.
13186         * output.cc (Output_reloc::Output_reloc): Change relobj to
13187         Sized_relobj*.
13188         (Output_reloc::local_section_offset): Change return type to
13189         Elf_Addr.  Use get_output_section_offset.
13190         (Output_reloc::get_address): Likewise.
13191         (Output_section::is_input_address_mapped): Don't call
13192         is_section_specially_mapped.
13193         (Output_section::output_offset): Likewise.
13194         (Output_section::output_address): Likewise.
13195         (Output_section::starting_output_address): Likewise.
13196         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13197         parameter to Sized_relobj*.
13198         (Copy_relocs::need_copy_reloc): Likewise.
13199         (Copy_relocs::save): Likewise.
13200         * copy-relocs.h (class Copy_relocs): Update declarations.
13201         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13202         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13203         * target-reloc.h (relocate_for_relocatable): Change
13204         offset_in_output_section type to Elf_Addr.  Change code that uses
13205         it as well.
13206         * layout.cc (Layout::layout): Always set *off.
13207         * mapfile.cc (Mapfile::print_input_section): Use
13208         output_section_offset.
13209         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13210         Sized_relobj*.
13211         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13212         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13213         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13214
13215 2008-07-03  Ian Lance Taylor  <iant@google.com>
13216
13217         * layout.cc (Layout::include_section): Do not discard unrecognized
13218         SHT_STRTAB sections.
13219
13220 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13221
13222         * script.cc (Lex::can_continue_name): Make '?' allowable in
13223         version-script names.
13224         * testsuite/version_script.map: Change glob pattern to use '?'
13225
13226 2008-06-30  Manish Singh  <yosh@gimp.org>
13227
13228         PR 6585
13229         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13230         Correct typo.
13231
13232 2008-06-30  Ian Lance Taylor  <iant@google.com>
13233
13234         PR 6660
13235         PR 6682
13236         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13237         versions]: Don't try to read the value in the contents, since we
13238         don't use it.  Use the template endianness when writing.
13239
13240 2008-06-25  Cary Coutant  <ccoutant@google.com>
13241
13242         * fileread.cc (File_read::make_view): Assert on zero-length view.
13243         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13244         symbol table when there are no symbols to read.
13245
13246 2008-06-23  Craig Silverstein  <csilvers@google.com>
13247
13248         * version.cc (version_string): Bump to 1.7
13249
13250 2008-06-18  Craig Silverstein  <csilvers@google.com>
13251
13252         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13253         constant 0xFFFF to type Valtype.
13254         (Powerpc_relocate_functions::rel16_ha): Likewise.
13255
13256 2008-06-17  Ian Lance Taylor  <iant@google.com>
13257
13258         * output.h (Output_section::Input_section): Initialize p2align_ to
13259         zero for Output_section_data constructors.
13260         (Output_section::Input_section::addralign): If not an input
13261         section, return the alignment of the Output_section_data.
13262         * testsuite/copy_test.cc: New file.
13263         * testsuite/copy_test_1.cc: New file.
13264         * testsuite/copy_test_2.cc: New file.
13265         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13266         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13267         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13268         (copy_test_1_pic.o, copy_test_1.so): New targets.
13269         (copy_test_2_pic.o, copy_test_2.so): New targets.
13270         * testsuite/Makefile.in: Rebuild.
13271
13272         * script-sections.cc (Script_sections::place_orphan): Initialize
13273         local variable exact.
13274
13275 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13276
13277         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13278
13279 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13280             David S. Miller  <davem@davemloft.net>
13281
13282         * powerpc.cc: New file.
13283         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13284         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13285         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13286         * Makefile.in: Rebuild.
13287
13288 2008-06-09  Ian Lance Taylor  <iant@google.com>
13289
13290         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13291         <exception>.
13292         (throwing, orig_terminate): New static variables.
13293         (terminate_handler): New static function.
13294         (t2): Set terminate handler.
13295
13296 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13297
13298         PR 6584
13299         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13300         alignment.
13301
13302 2008-05-30  Cary Coutant  <ccoutant@google.com>
13303
13304         * archive.cc (Archive::include_all_members) Correct to step
13305         over symbol table and extended name table in thin archives.
13306
13307 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13308
13309         PR 6407
13310         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13311         calculation.
13312
13313 2008-05-28  Caleb Howe  <cshowe@google.com>
13314
13315         * reduced_debug_output.cc: New file.
13316         * reduced_debug_output.h: New file.
13317         * options.h (class General_options): Add --strip-debug-non-line.
13318         * options.cc (General_options::finalize): Add strip_debug_non_line
13319         to the strip heirarchy.
13320         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13321         fields.
13322         * layout.cc: Include "reduced_debug_output.h".
13323         (Layout::Layout): Initialize new fields.
13324         (line_only_debug_sections): New static array.
13325         (is_lines_only_debug_sections): New static inline function.
13326         (Layout::include_section): Handle --strip-debug-non-line.
13327         (Layout::make_output_section): If --strip-debug-non-line, build
13328         new output sections for .debug_abbrev and .debug_info.
13329         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13330         gold.  Warn about possible overflow.
13331         (read_signed_LEB_128): Likewise.
13332         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13333         (read_signed_LEB_128): Declare.
13334         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13335         (HFILES): Add reduced_debug_output.h.
13336         * Makefile.in: Rebuild.
13337
13338 2008-05-21  Ian Lance Taylor  <iant@google.com>
13339
13340         * mapfile.cc: New file.
13341         * mapfile.h: New file.
13342         * options.h (class General_options): Add -M/--print-map and -Map.
13343         * options.cc (General_options::finalize): Make -M equivalent to
13344         -Map -.
13345         * main.cc: Include <cstdio> and "mapfile.h".
13346         (main): Open mapfile if requested.
13347         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13348         constructor.  Change caller.
13349         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13350         (queue_middle_tasks): Likewise.
13351         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13352         declarations.
13353         * archive.cc: Include "mapfile.h".
13354         (Archive::add_symbols): Add mapfile parameter.  Change all
13355         callers.  Pass mapfile, symbol, and reason to include_member.
13356         (Archive::include_all_members): Add mapfile parameter.  Change all
13357         callers.
13358         (Archive::include_member): Add mapfile, sym, and why parameters.
13359         Change all callers.  Report inclusion to map file.
13360         * archive.h: Include "fileread.h".
13361         (class Archive): Update declarations.
13362         (Archive::file): New const method.
13363         (class Add_archive_symbols): Add mapfile_ field.  Update
13364         constructor.  Change all callers.
13365         * readsyms.h (class Read_symbols): Likewise.
13366         (class Finish_group): Likewise.
13367         (class Read_script): Likewise.
13368         * common.cc: Include "mapfile.h".
13369         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13370         all callers.
13371         (Symbol_table::do_allocate_commons): Likewise.
13372         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13373         symbol allocation to mapfile.
13374         * common.h (class Allocate_commons_task): Add mapfile_ field.
13375         Update constructor.  Change all callers.
13376         * symtab.h (class Symbol_table): Update declarations.
13377         * layout.cc: Include "mapfile.h".
13378         (Layout_task_runner::run): Print information to mapfile.
13379         (Layout::create_gold_note): Change Output_data_fixed_space to
13380         Output_data_zero_fill.
13381         (Layout::create_build_id): Likewise.
13382         (Layout::print_to_mapfile): New function.
13383         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13384         constructor.  Change caller.
13385         (class Layout): Declare print_to_mapfile.
13386         * output.cc (Output_section::Input_section::print_to_mapfile): New
13387         function.
13388         (Output_section::add_input_section): If producing a map, always
13389         add to input_sections_ list.
13390         (Output_section::do_print_to_mapfile): New function.
13391         (Output_segment::print_sections_to_mapfile): New function.
13392         (Output_segment::print_section_list_to_mapfile): New function.
13393         * output.h: Include "mapfile.h".
13394         (Output_data::print_to_mapfile): New function.
13395         (Output_data::do_print_to_mapfile): New virtual function.
13396         (Output_segment_headers::do_print_to_mapfile): New function.
13397         (Output_file_header::do_print_to_mapfile): New function.
13398         (Output_data_const::do_print_to_mapfile): New function.
13399         (class Output_data_const_buffer): Add map_name_ field.  Update
13400         constructor.  Change all callers.  Add do_print_to_mapfile
13401         function.
13402         (class Output_data_fixed_space): Likewise.
13403         (class Output_data_space): Likewise.
13404         (class Output_data_zero_fill): New class.
13405         (Output_data_strtab::do_print_to_mapfile): New function.
13406         (Output_data_reloc_base::do_print_to_mapfile): New function.
13407         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13408         (Output_data_group::do_print_to_mapfile): New function.
13409         (Output_data_got::do_print_to_mapfile): New function.
13410         (Output_data_dynamic::do_print_to_mapfile): New function.
13411         (Output_symtab_xindex::do_print_to_mapfile): New function.
13412         (class Output_section): Declare do_print_to_mapflie.  Declare
13413         print_to_mapfile in Input_section.
13414         (class Output_segment): Declare new functions.
13415         * object.h (Sized_relobj::symbol_count): New function.
13416         * script-sections.cc
13417         (Output_section_element_dot_assignment::set_section_addresses):
13418         Change Output_data_fixed_space to Output_data_zero_fill.
13419         (Output_data_expression::do_print_to_mapfile): New function.
13420         * script.cc (read_input_script): Add mapfile parameter.  Change
13421         all callers.
13422         * script.h (read_input_script): Update declaration.
13423         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13424         (Eh_frame::do_print_to_mapfile): New function.
13425         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13426         (Output_merge_string::do_print_to_mapfile): New function.
13427         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13428         function.
13429         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13430         function.
13431         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13432         function.
13433         * Makefile.am (CCFILES): Add mapfile.cc.
13434         (HFILES): Add mapfile.h.
13435         * Makefile.in: Rebuild.
13436
13437 2008-05-19  Ian Lance Taylor  <iant@google.com>
13438
13439         * options.h (class General_options): Add -z relro.
13440         * layout.cc (Layout::Layout): Initialize relro_segment_.
13441         (Layout::add_output_section_data): Return the output section.
13442         (Layout::make_output_section): Rcognize relro sections and mark
13443         them appropriately.
13444         (Layout::attach_allocated_section_to_segment): Put relro sections
13445         in a PT_GNU_RELRO segment.
13446         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13447         section as relro.
13448         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13449         PT_TLS segments.
13450         (Layout::linkonce_mapping): Map d.rel.ro.local to
13451         .data.rel.ro.local.
13452         (Layout::output_section_name): Us .data.rel.ro.local for any
13453         section which begins with that.
13454         * layout.h (class Layout): Update add_output_section_data
13455         declaration.  Add relro_segment_ field.
13456         * output.cc (Output_section::Output_section): Initialize is_relro_
13457         and is_relro_local_ fields.
13458         (Output_segment::add_output_section): Group relro sections.
13459         (Output_segment::is_first_section_relro): New function.
13460         (Output_segment::maximum_alignment): If there is a relro section,
13461         align the segment to the common page size.
13462         (Output_segment::set_section_addresses): Track whether we are
13463         looking at relro sections.  If the last section is a relro
13464         section, align to the common page size.
13465         (Output_segment::set_section_list_addresses): Add in_relro
13466         parameter.  Change all callers.  Align to the page size when
13467         moving from relro to non-relro section.
13468         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13469         segment.
13470         * output.h (class Output_section): Add is_relro_ and
13471         is_relro_local_ fields.
13472         (Output_section::is_relro): New function.
13473         (Output_section::set_is_relro): New function.
13474         (Output_section::is_relro_local): New function.
13475         (Output_section::set_is_relro_local): New function.
13476         (class Output_segment): Update declarations.
13477         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13478         * sparc.cc (Target_sparc::got_section): Likewise.
13479         * x86_64.cc (Target_x86_64::got_section): Likewise.
13480         * testsuite/relro_test_main.cc: New file.
13481         * testsuite/relro_test.cc: New file.
13482         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13483         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13484         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13485         (relro_test.so, relro_test_pic.o): New targets.
13486         * testsuite/Makefile.in: Rebuild.
13487
13488 2008-05-16  Ian Lance Taylor  <iant@google.com>
13489
13490         * output.cc (Output_segment::add_output_section): Remove front
13491         parameter.
13492         * output.h (class Output_segment): Remove
13493         add_initial_output_section and overloaded add_output_section.
13494         Update declaration of remaining add_output_section.
13495         * layout.cc (Layout::create_interp): Call add_output_section
13496         rather than add_initial_output_section.
13497         (Layout::finish_dynamic_section): Likewise.
13498
13499         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13500         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13501         know the dynamic type.
13502         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13503         field.  Initialize it in constructor.
13504         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13505         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13506         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13507         reloc.
13508
13509         * output.cc (Output_reloc::get_address): Change return type to
13510         Elf_Addr.
13511         * output.h (class Output_reloc): Update get_address declaration.
13512         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13513         for section addresses.
13514
13515 2008-05-09  Ian Lance Taylor  <iant@google.com>
13516
13517         PR 6493
13518         * gold.cc (gold_nomem): Use return value of write.
13519
13520 2008-05-08  Ian Lance Taylor  <iant@google.com>
13521
13522         * symtab.c (Symbol::init_base_output_data): Add version
13523         parameter.  Change all callers.
13524         (Symbol::init_base_output_segment): Likewise.
13525         (Symbol::init_base_constant): Likewise.
13526         (Symbol::init_base_undefined): Likewise.
13527         (Sized_symbol::init_output_data): Likewise.
13528         (Sized_symbol::init_output_segment): Likewise.
13529         (Sized_symbol::init_constant): Likewise.
13530         (Sized_symbol::init_undefined): Likewise.
13531         (Symbol_table::do_define_in_output_data): If the new symbol has a
13532         version, mark it as the default.
13533         (Symbol_table::do_define_in_output_segment): Likewise.
13534         (Symbol_table::do_define_as_constant): Likewise.
13535         * symtab.h (class Symbol): Update declarations.
13536         (class Sized_symbol): Likewise.
13537         * resolve.cc (Symbol::override_version): New function.
13538         (Symbol::override_base): Call override_version.
13539         (Symbol::override_base_with_special): Likewise.
13540         * testsuite/ver_script_8.script: New file.
13541         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13542         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13543         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13544         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13545
13546 2008-05-06  Ian Lance Taylor  <iant@google.com>
13547
13548         PR 6049
13549         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13550         functions.
13551         (class General_options): Remove existing --undefined, and add
13552         --no-undefined instead.  Add new --undefined as synonym for -u.
13553         * archive.cc (Archive::add_symbols): Check whether symbol was
13554         named with -u.
13555         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13556         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13557         all uses.  Add IS_UNDEFINED.  Update declarations to split
13558         different versions of init_base.  Declare init_base_undefined.
13559         (Symbol::is_defined): Handle IS_UNDEFINED.
13560         (Symbol::is_undefined): Likewise.
13561         (Symbol::is_weak_undefined): Call is_undefined.
13562         (Symbol::is_absolute): Handle IS_CONSTANT.
13563         (class Sized_symbol): Update declarations to split different
13564         versions of init.  Declare init_undefined.
13565         (class Symbol_table): Declare new functions.
13566         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13567         Change all callers.
13568         (Symbol::init_base_output_data): Likewise.
13569         (Symbol::init_base_output_segment): Likewise.
13570         (Symbol::init_base_constant): Likewise.
13571         (Symbol::init_base_undefined): New function.
13572         (Sized_symbol::init_object): Rename from init.  Change all
13573         callers.
13574         (Sized_symbol::init_output_data): Likewise.
13575         (Sized_symbol::init_output_segment): Likewise.
13576         (Sized_symbol::init_constant): Likewise.
13577         (Sized_symbol::init_undefined): New function.
13578         (Symbol_table::add_undefined_symbols_from_command_line): New
13579         function.
13580         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13581         function.
13582         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13583         (Symbol::output_section): Likewise.
13584         (Symbol::set_output_section): Likewise.
13585         (Symbol_table::sized_finalize_symbol): Likewise.
13586         (Symbol_table::sized_write_globals): Likewise.
13587         * resolve.cc (Symbol_table::should_override): Likewise.
13588         (Symbol::override_base_with_special): Likewise.
13589
13590         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13591         symbol, change it to have default visibility.
13592         * testsuite/protected_1.cc: New file.
13593         * testsuite/protected_2.cc: New file.
13594         * testsuite/protected_3.cc: New file.
13595         * testsuite/protected_main_1.cc: New file.
13596         * testsuite/protected_main_2.cc: New file.
13597         * testsuite/protected_main_3.cc: New file.
13598         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13599         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13600         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13601         (protected_1.so): New target.
13602         (protected_1_pic.o, protected_2_pic.o): New targets.
13603         (protected_3_pic.o): New target.
13604         (check_PROGRAMS): Add protected_2.
13605         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13606         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13607         * testsuite/Makefile.in: Rebuild.
13608
13609         * options.h (DEFINE_var): Add set_user_set_##varname__.
13610         (DEFINE_bool_alias): New macro.
13611         (class General_options): Define -Bstatic using DEFINE_bool_alias
13612         rather than DEFINE_special.  Add --undefined as an alias for -z
13613         defs.
13614         * options.cc (General_options::parse_Bstatic): Remove.
13615
13616         * options.h (class General_options): Add --fatal-warnings.
13617         * main.cc (main): Implement --fatal-warnings.
13618         * errors.h (Errors::warning_count): New function.
13619
13620         * options.h (class General_options): Add -Bsymbolic-functions.
13621         * symtab.h (Symbol::is_preemptible): Check for
13622         -Bsymbolic-functions.
13623
13624 2008-05-05  Ian Lance Taylor  <iant@google.com>
13625
13626         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13627         as noVARNAME rather than no-VARNAME.
13628         (class General_options): Add option -z combreloc.
13629         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13630         get_address.
13631         (Output_reloc::sort_before) [SHT_REL]: New function.
13632         (Output_reloc::sort_before) [SHT_RELA]: New function.
13633         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13634         Sort_relocs_comparison.
13635         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13636         parameter.  Change all callers.
13637         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13638         sort_relocs parameter.  Change all callers.
13639         * output.cc (Output_reloc::get_address): New function, broken out
13640         of write_rel.
13641         (Output_reloc::write_rel): Call it.
13642         (Output_reloc::compare): New function.
13643         (Output_data_reloc_base::do_write): Optionally sort relocs.
13644
13645         * configure.ac: If targ_extra_obj is set, link it in.
13646         * configure.tgt: Initialize all variables.
13647         (x86_64*): Set targ_extra_obj and targ_extra_size.
13648         * configure: Rebuild.
13649
13650         * object.cc (Sized_relobj::include_section_group): Adjust section
13651         indexes read from group data.  Build vector to pass to
13652         layout_group.
13653         * layout.cc (Layout::layout_group): Add flags and shndxes
13654         parameters.  Remove contents parameter.  Change caller.  Update
13655         explicit instantiations.
13656         * layout.h (class Layout): Update layout_group declaration.
13657         * output.cc (Output_data_group::Output_data_group): Add flags and
13658         input_shndxes parameters.  Remove contents parameter.  Change
13659         caller.
13660         (Output_data_group::do_write): Change input_sections_ to
13661         input_shndxes_.
13662         * output.h (class Output_data_group): Update constructor
13663         declaration.  Rename input_sections_ to input_shndxes_.
13664         * testsuite/many_sections_test.cc: Add template.
13665
13666 2008-04-30  Cary Coutant  <ccoutant@google.com>
13667
13668         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13669
13670         * layout.cc (Layout::include_section): Refactored check for debug
13671         info section.
13672         (Layout::add_comdat): Add new parameters.  Change type
13673         of signature parameter.  Add object and shndx to signatures table.
13674         (Layout::find_kept_object): New function.
13675         * layout.h: Include <cstring>.
13676         (Layout::is_debug_info_section): New function.
13677         (Layout::add_comdat): Add new parameters.
13678         (Layout::find_kept_object): New function.
13679         (Layout::Kept_section): New struct.
13680         (Layout::Signatures): Change type of map range.
13681         * object.cc (Relobj::output_section_address): New function.
13682         (Sized_relobj::include_section_group): Add new parameters.  Change
13683         calls to Layout::add_comdat.  Change to build table of kept comdat
13684         groups and table mapping discarded sections to kept sections.
13685         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13686         (Sized_relobj::do_layout): Change calls to include_section_group and
13687         include_linkonce_section.
13688         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13689         value to zero when section is discarded.
13690         (Sized_relobj::map_to_kept_section): New function.
13691         * object.h (Relobj::output_section_address): New function.
13692         (Relobj::Comdat_group): New type.
13693         (Relobj::find_comdat_group): New function.
13694         (Relobj::Comdat_group_table): New type.
13695         (Relobj::Kept_comdat_section): New type.
13696         (Relobj::Kept_comdat_section_table): New type.
13697         (Relobj::add_comdat_group): New function.
13698         (Relobj::set_kept_comdat_section): New function.
13699         (Relobj::get_kept_comdat_section): New function.
13700         (Relobj::comdat_groups_): New field.
13701         (Relobj::kept_comdat_sections_): New field.
13702         (Symbol_value::input_value): Update comment.
13703         (Sized_relobj::map_to_kept_section) New function.
13704         (Sized_relobj::include_linkonce_section): Add new parameter.
13705         * target-reloc.h (Comdat_behavior): New type.
13706         (get_comdat_behavior): New function.
13707         (relocate_section): Add code to map a discarded section to the
13708         corresponding kept section when applying a relocation.
13709
13710 2008-04-30  Craig Silverstein  <csilvers@google.com>
13711
13712         * dwarf_reader.cc (next_generation_count): New static var.
13713         (Addr2line_cache_entry): New struct.
13714         (addr2line_cache): New static var.
13715         (Dwarf_line_info::one_addr2line): Added caching.
13716         (Dwarf_line_info::clear_addr2line_cache): New function.
13717         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13718         cache-size parameter.
13719         (Dwarf_line_info::one_addr2line_cache): New function.
13720         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13721         new cache-size argument to one_addr2line(), and clear cache.
13722
13723 2008-04-28  Cary Coutant  <ccoutant@google.com>
13724
13725         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13726         R_386_PC8 relocations.
13727
13728 2008-04-23  Ian Lance Taylor  <iant@google.com>
13729
13730         * object.cc (Sized_relobj::include_section_group): Check for
13731         invalid section group.
13732
13733         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13734         header size.
13735
13736         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13737         than read for file header.
13738         * archive.cc (Archive::include_member): Likewise.
13739
13740 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13741
13742         * aclocal.m4: Regenerate.
13743         * configure: Regenerate.
13744
13745 2008-04-19  Ian Lance Taylor  <iant@google.com>
13746
13747         * version.cc (version_string): Bump to 1.6.
13748
13749         * testsuite/Makefile.am (many_sections_r_test): New target.
13750         (many_sections_r_test_SOURCES): Remove.
13751         (many_sections_r_test_DEPENDENCIES): Remove.
13752         (many_sections_r_test_LDFLAGS): Remove.
13753         (many_sections_r_test_LDADD): Remove.
13754
13755         * object.cc (Sized_relobj::do_add_symbols): Always pass
13756         local_symbol_count_ to add_from_relobj.
13757
13758         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13759         every thousand variables.
13760         * testsuite/Makefile.in: Rebuild.
13761
13762         * object.cc (Xindex::initialize_symtab_xindex): New function.
13763         (Xindex::read_symtab_xindex): New function.
13764         (Xindex::sym_xindex_to_shndx): New function.
13765         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13766         available.
13767         (Sized_relobj::do_initialize_xindex): New function.
13768         (Sized_relobj::do_read_symbols): Adjust section links.
13769         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13770         parameter.  Change all callers.
13771         (Sized_relobj::include_section_group): Adjust section links and
13772         symbol section indexes.
13773         (Sized_relobj::do_layout): Adjust section links.
13774         (Sized_relobj::do_count_local_symbols): Adjust section links and
13775         symbol section indexes.
13776         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13777         ordinary and special symbols.
13778         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13779         dynsym_xindex parameters.  Change all callers.  Adjust section
13780         links.  Use SHN_XINDEX when needed.
13781         (Sized_relobj::get_symbol_location_info): Adjust section links.
13782         Don't get fooled by special symbols.
13783         * object.h (class Xindex): Define.
13784         (class Object): Add xindex_ parameter.  Declare virtual functoin
13785         do_initialize_xindex.
13786         (Object::adjust_sym_shndx): New function.
13787         (Object::set_xindex): New protected function.
13788         (class Symbol_value): Add is_ordinary_shndx_ field.
13789         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13790         (Symbol_value::value): Assert ordinary section.
13791         (Symbol_value::initialize_input_to_output_map): Likewise.
13792         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13793         Change all callers.
13794         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13795         all callers.
13796         (class Sized_relobj): Update declarations.
13797         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13798         parameter.  Change all callers.
13799         (Sized_relobj::adjust_shndx): New function.
13800         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13801         field.
13802         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13803         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13804         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13805         (Sized_dynobj::read_dynsym_section): Adjust section links.
13806         (Sized_dynobj::read_dynamic): Likewise.
13807         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13808         section links.
13809         (Sized_dynobj::do_initialize_xindex): New function.
13810         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13811         do_initialize_xindex.
13812         (Sized_dynobj::adjust_shndx): New function.
13813         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13814         dynsym_xindex_ fields.
13815         (Layout::finalize): Add a call to set_section_indexes before
13816         creating the symtab sections.
13817         (Layout::set_section_indexes): Don't do anything if the section
13818         already has a section index.
13819         (Layout::create_symtab_sections): Add shnum parameter.  Change
13820         caller.  Create .symtab_shndx section if needed.
13821         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13822         caller.
13823         (Layout::allocated_output_section_count): New function.
13824         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13825         needed.
13826         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13827         fields.  Update declarations.
13828         (Layout::symtab_xindex): New function.
13829         (Layout::dynsym_xindex): New function.
13830         (class Write_symbols_task): Add layout_ field.
13831         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13832         Change caller.
13833         * output.cc (Output_section_headers::Output_section_headers): Add
13834         shstrtab_section parameter.  Change all callers.
13835         (Output_section_headers::do_sized_write): Store overflow values
13836         for section count and section string table section index in
13837         section header zero.
13838         (Output_file_header::do_sized_write): Check for overflow of
13839         section count and section string table section index.
13840         (Output_symtab_xindex::do_write): New function.
13841         (Output_symtab_xindex::endian_do_write): New function.
13842         * output.h (class Output_section_headers): Add shstrtab_section_.
13843         Update declarations.
13844         (class Output_symtab_xindex): Define.
13845         (Output_section::has_out_shndx): New function.
13846         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13847         field.
13848         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13849         Change all callers.
13850         (Sized_symbol::init): Likewise.
13851         (Symbol::output_section): Check for ordinary symbol.
13852         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13853         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13854         callers.
13855         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13856         Change all callers.  Simplify handling of symbols from sections
13857         not included in the link.
13858         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13859         distinction.
13860         (Weak_alias_sorter::operator()): Assert that symbols are
13861         ordinary.
13862         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13863         distinction.
13864         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13865         parameters.  Change all callers.
13866         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13867         symbol distinction.  Use SHN_XINDEX when needed.
13868         (Symbol_table::write_section_symbol): Add symtab_xindex
13869         parameter.  Change all callers.
13870         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13871         SHN_XINDEX when needed.
13872         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13873         declarations.
13874         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13875         (Symbol::is_defined): Check is_ordinary.
13876         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13877         (Symbol::is_absolute, Symbol::is_common): Likewise.
13878         (class Sized_symbol): Update declarations.
13879         (class Symbol_table): Update declarations.
13880         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13881         parameters.  Change all callers.
13882         (Sized_symbol::override): Likewise.
13883         (Symbol_table::override): Likewise.
13884         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13885         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13886         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13887         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13888         to be in an ordinary section.
13889         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13890         object and is_ordinary parameters.  Change all callers.
13891         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13892         Change all callers.  Don't add undefined or non-ordinary symbols
13893         to reloc_map_.
13894         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13895         Change all callers.
13896         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13897         declarations.
13898         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13899         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13900         (Sized_relobj::relocate_sections): Likewise.
13901         * target-reloc.h (scan_relocs): Adjust section symbol index.
13902         (scan_relocatable_relocs): Likewise.
13903         * i386.cc (Scan::local): Check for ordinary symbols.
13904         * sparc.cc (Scan::local): Likewise.
13905         * x86_64.cc (Scan::local): Likewise.
13906         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13907         to symbol_section_and_value.
13908         * testsuite/many_sections_test.cc: New file.
13909         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13910         (check_PROGRAMS): Add many_sections_test.
13911         (many_sections_test_SOURCES): Define.
13912         (many_sections_test_DEPENDENCIES): Define.
13913         (many_sections_test_LDFLAGS): Define.
13914         (BUILT_SOURCES): Add many_sections_define.h.
13915         (many_sections_define.h): New target.
13916         (BUILT_SOURCES): Add many_sections_check.h.
13917         (many_sections_check.h): New target.
13918         (check_PROGRAMS): Add many_sections_r_test.
13919         (many_sections_r_test_SOURCES): Define.
13920         (many_sections_r_test_DEPENDENCIES): Define.
13921         (many_sections_r_test_LDFLAGS): Define.
13922         (many_sections_r_test_LDADD): Define.
13923         (many_sections_r_test.o): New target.
13924         * testsuite/Makefile.in: Rebuild.
13925
13926 2008-04-17  Cary Coutant  <ccoutant@google.com>
13927
13928         * errors.cc (Errors::info): New function.
13929         (gold_info): New function.
13930         * errors.h (Errors::info): New function.
13931         * gold.h (gold_info): New function.
13932         * object.cc (Input_objects::add_object): Print trace output.
13933         * options.cc (options::parse_set): New function.
13934         (General_options::parse_wrap): Deleted.
13935         (General_options::General_options): Deleted initializer.
13936         * options.h (options::String_set): New typedef.
13937         (options::parse_set): New function.
13938         (DEFINE_set): New macro.
13939         (General_options::wrap): Changed to use DEFINE_set. Changed
13940         callers of any_wrap_symbols and is_wrap_symbol.
13941         (General_options::trace, General_options::trace_symbol):
13942         New options.
13943         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13944         (General_options::wrap_symbols_): Deleted.
13945         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13946
13947 2008-04-17  David S. Miller  <davem@davemloft.net>
13948
13949         * options.cc (General_options::parse_V): New function.
13950         * options.h: Add entries for -V and -Qy.
13951
13952 2008-04-17  Ian Lance Taylor  <iant@google.com>
13953
13954         * common.cc (Symbol_table::allocate_commons): Remove options
13955         parameter.  Change caller.
13956         (Symbol_table::do_allocate_commons): Remove options parameter.
13957         Change caller.  Just call do_allocate_commons_list twice.
13958         (Symbol_table::do_allocate_commons_list): New function, broken out
13959         of do_allocate_commons.
13960         * common.h (class Allocate_commons_task): Remove options_ field.
13961         Update constructor.
13962         * symtab.cc (Symbol_table::Symbol_table): Initialize
13963         tls_commons_.
13964         (Symbol_table::add_from_object): Put TLS common symbols on
13965         tls_commons_ list.
13966         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13967         which are IN_OUTPUT_DATA.
13968         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13969         allocate_commons and do_allocate_commons declarations.  Declare
13970         do_allocate_commons_list.
13971         * gold.cc (queue_middle_tasks): Update creation of
13972         Allocate_commons_task to not pass options.
13973         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13974         (TLS_TEST_C_FLAGS): New variable.
13975         (tls_test_c_pic.o): New target.
13976         (tls_test_shared.so): Link in tls_test_c_pic.o.
13977         (tls_test_c_pic_ie.o): New target.
13978         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13979         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13980         (tls_test_c.o): New target.
13981         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13982         (tls_pic_test_LDADD): Likewise.
13983         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13984         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13985         (tls_test_c_gnu2.o): New target.
13986         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13987         tls_test_c_gnu2.o.
13988         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13989         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13990         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13991         * testsuite/tls_test.cc: Include "config.h".
13992         (t_last): Call t11_last.
13993         * testsuite/tls_test.h (t11, t11_last): Declare.
13994         * testsuite/tls_test_c.c: New file.
13995         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13996         * configure.ac: Check for OpenMP support.
13997         * configure, config.in, Makefile.in: Rebuild.
13998         * testsuite/Makefile.in: Rebuild.
13999
14000 2008-04-16  Cary Coutant  <ccoutant@google.com>
14001
14002         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14003         (Target_i386::tls_base_symbol_defined_): New field.
14004         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14005         (Target_i386::Scan::global): Likewise.
14006         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14007         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14008         (Target_x86_64::tls_base_symbol_defined_): New field.
14009         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14010         (Target_x86_64::Scan::global): Likewise.
14011
14012 2008-04-16  Cary Coutant  <ccoutant@google.com>
14013
14014         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14015         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14016         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14017         building shared libraries.
14018         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14019         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14020         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14021         * testsuite/Makefile.in: Rebuild.
14022         * testsuite/weak_undef.h: New file.
14023         * testsuite/weak_undef_file1.cc: Add extra test cases.
14024         * testsuite/weak_undef_file2.cc: Likewise.
14025         * testsuite/weak_undef_test.cc: Likewise.
14026
14027 2008-04-16  David S. Miller  <davem@davemloft.net>
14028
14029         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14030         Add issued_non_pic_error_ field.  Declare check_non_pic.
14031         (Target_sparc::Scan::check_non_pic): New function.
14032         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14033         (Target_sparc::Scan::global): Likewise.
14034
14035         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14036         * configure: Rebuild.
14037
14038         * options.h (DEFINE_enable): New macro.
14039         (new_dtags): New enable option.
14040         (initfirst, interpose, loadfltr, nodefaultlib,
14041         nodelete, nodlopen, nodump): New -z options.
14042         * layout.cc (Layout:finish_dynamic_section): If new
14043         dtags enabled, emit DT_RUNPATH.  Also, emit a
14044         DT_FLAGS_1 containing any specified -z flags.
14045
14046 2008-04-16  Ian Lance Taylor  <iant@google.com>
14047
14048         * copy-relocs.cc: New file.
14049         * copy-relocs.h: New file.
14050         * reloc.cc: Remove Copy_relocs code.
14051         * reloc.h: Likewise.
14052         * reloc-types.h (struct Reloc_types) [both versions]: Add
14053         get_reloc_addend_noerror.
14054         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14055         variants of add_global which take an addend which must be zero.
14056         * i386.cc: Include "copy-relocs.h".
14057         (class Target_i386): Change type of copy_relocs_ to variable,
14058         update initializer.
14059         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14060         Change all callers.
14061         (Target_i386::do_finalize_sections): Change handling of
14062         copy_relocs_.
14063         * sparc.cc: Include "copy-relocs.h".
14064         (class Target_sparc): Change type of copy_relocs_ to variable,
14065         update initializer.
14066         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14067         Change all callers.
14068         (Target_sparc::do_finalize_sections): Change handling of
14069         copy_relocs_.
14070         * x86_64.cc: Include "copy-relocs.h".
14071         (class Target_x86_64): Change type of copy_relocs_ to variable,
14072         update initializer.
14073         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14074         class.  Change all callers.
14075         (Target_x86_64::do_finalize_sections): Change handling of
14076         copy_relocs_.
14077         * Makefile.am (CCFILES): Add copy-relocs.cc.
14078         (HFILES): Add copy-relocs.h.
14079
14080         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14081
14082         * testsuite/script_test_4.sh: Permit leading zeroes.
14083
14084 2008-04-15  Ian Lance Taylor  <iant@google.com>
14085
14086         * script-sections.cc (Script_sections::create_segments): Use
14087         header_size_adjustment even when there is enough room for the
14088         headers.
14089         * testsuite/script_test_4.sh: New file.
14090         * testsuite/script_test_4.t: New file.
14091         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14092         (check_DATA): Add script_test_4.stdout.
14093         (MOSTLYCLEANFILES): Likewise.
14094         (script_test_4): New target.
14095         (script_test_4.stdout): New target.
14096         * testsuite/Makefile.in: Rebuild.
14097
14098         * sparc.cc: Add definitions for Output_data_plt_sparc class
14099         constants.
14100
14101 2008-04-14  David S. Miller  <davem@davemloft.net>
14102
14103         * sparc.cc: New file.
14104         * Makefile.am (TARGETSOURCES): Add sparc.cc
14105         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14106         * configure.tgt: Document targ_extra_size and
14107         targ_extra_big_endian.  Add entries for sparc-* and
14108         sparc64-*.
14109         * configure.ac: Handle targ_extra_size and
14110         targ_extra_big_endian.
14111         * Makefile.in: Rebuild.
14112         * configure: Likewise.
14113         * po/POTFILES.in: Likewise.
14114         * po/gold.pot: Likewise.
14115
14116 2008-04-14  Ian Lance Taylor  <iant@google.com>
14117
14118         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14119         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14120         in the name/type/flags to section mapping.  Don't call
14121         allocate_output_section.
14122         (Layout::choose_output_section): Change parameter from adjust_name
14123         to is_input_section.  Don't permit input sections after sections
14124         are attached to segments.  Don't call allocate_output_section.
14125         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14126         not write_enable_output_section.
14127         (Layout::make_output_section): Don't push to
14128         unattached_section_list_ nor call attach_to_segment.  Call
14129         attach_section_to_segment if sections are attached.
14130         (Layout::attach_sections_to_segments): New function.
14131         (Layout::attach_section_to_segment): New function.
14132         (Layout::attach_allocated_section_to_segment): Rename from
14133         attach_to_segment.  Remove flags parameter.
14134         (Layout::allocate_output_section): Remove function.
14135         (Layout::write_enable_output_section): Remove function.
14136         * layout.h (class Layout): Update for above changes.  Add new
14137         field sections_are_attached_.
14138         * output.h (Output_section::update_flags_for_input_section): New
14139         function.
14140         * output.cc (Output_section::add_input_section): Call
14141         update_flags_for_input_section.
14142         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14143
14144 2008-04-11  Cary Coutant  <ccoutant@google.com>
14145
14146         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14147         thought unnecessary.
14148         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14149
14150 2008-04-11  Ian Lance Taylor  <iant@google.com>
14151
14152         * output.h (class Output_section_data): Remove inline definition
14153         of set_addralign.
14154         * output.cc (Output_section_data::set_addralign): New function.
14155
14156 2008-04-11  Cary Coutant  <ccoutant@google.com>
14157
14158         Add support for TLS descriptors for i386 and x86_64.
14159         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14160         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14161         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14162         GOT_TYPE_TLS_DESC.
14163         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14164         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14165         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14166         relocations.
14167         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14168         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14169         Fix problem with initial-exec relocations.
14170         (Target_i386::Relocate::relocate_tls): Likewise.
14171         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14172         relaxation.
14173         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14174         support for section-plus-offset dynamic table entries.
14175         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14176         (Output_data_dynamic::Dynamic_entry): Add support for
14177         section-plus-offset dynamic table entries.
14178         (Output_data_dynamic::Classification): Likewise.
14179         (Output_data_dynamic::classification_): Renamed offset_.
14180         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14181         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14182         (Target_x86_64::make_plt_section): New function.
14183         (Target_x86_64::reserve_tlsdesc_entries): New function.
14184         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14185         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14186         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14187         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14188         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14189         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14190         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14191         add extra PLT entry for TLS descriptors.
14192         (Output_data_plt_x86_64::got_): New field.
14193         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14194         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14195         fields.
14196         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14197         descriptors.
14198         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14199         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14200         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14201         R_386_TLS_DESC_CALL relocations.
14202         (Target_x86_64::Scan::global): Likewise.
14203         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14204         for TLS descriptors.
14205         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14206         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14207         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14208         GD-to-IE relaxation.
14209         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14210         and TLS_DESCRIPTORS.
14211         * Makefile.in: Rebuild.
14212         * configure: Rebuild.
14213         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14214         (tls_test_shared2.so): New target.
14215         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14216         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14217         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14218         (tls_shared_gd_to_ie_test_LDADD): New variable.
14219         (tls_shared_gnu2_gd_to_ie_test): New target.
14220         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14221         New targets.
14222         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14223         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14224         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14225         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14226         (tls_shared_gnu2_test): New target.
14227         (tls_test_gnu2_shared.so): New target.
14228         (tls_shared_gnu2_test_SOURCES): New variable.
14229         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14230         (tls_shared_gnu2_test_LDFLAGS): New variable.
14231         (tls_shared_gnu2_test_LDADD): New variable.
14232         * testsuite/Makefile.in: Rebuild.
14233         * testsuite/Makefile.
14234
14235 2008-04-11  Ian Lance Taylor  <iant@google.com>
14236
14237         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14238         justsyms.t.
14239         * testsuite/Makefile.in: Rebuild.
14240
14241         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14242         long.
14243         * testsuite/script_test_2.cc (main): Adjust test.
14244
14245 2008-04-11  David S. Miller  <davem@davemloft.net>
14246             Ian Lance Taylor  <iant@google.com>
14247
14248         * options.h (General_options): Add entries for '-Y' and
14249         '-relax'.
14250         * options.cc (General_options:finalize): If -Y was used, add those
14251         entries to the library path instead of the default "/lib" and
14252         "/usr/lib".
14253
14254 2008-04-11  David S. Miller  <davem@davemloft.net>
14255
14256         * testsuite/justsyms.t: Start at 0x100.
14257         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14258         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14259         long.
14260         * testsuite/script_test_2.cc: Adjust string and section length
14261         checks.
14262
14263 2008-04-09  Ian Lance Taylor  <iant@google.com>
14264
14265         PR gold/5996
14266         * script-sections.cc (Sections_element::allocate_to_segment): Add
14267         orphan parameter.
14268         (Output_section_definition::allocate_to_segment): Likewise.
14269         (Orphan_output_section::allocate_to_segment): Likewise.
14270         (Script_sections::attach_sections_using_phdrs_clause): Don't
14271         propagate non-PT_LOAD segments to orphan sections.
14272         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14273         readelf rather than objdump.
14274         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14275         .interp section and PT_INTERP segment are the same size.
14276         * testsuite/Makefile.in: Rebuild.
14277
14278         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14279         aliases for symbols defined in the same object.
14280         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14281         (weak_alias_test_SOURCES): New variable.
14282         (weak_alias_test_DEPENDENCIES): New variable.
14283         (weak_alias_test_LDFLAGS): New variable.
14284         (weak_alias_test_LDADD): New variable.
14285         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14286         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14287         (weak_alias_test_3.o): New target.
14288         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14289         * testsuite/weak_alias_test_main.cc: New file.
14290         * testsuite/weak_alias_test_1.cc: New file.
14291         * testsuite/weak_alias_test_2.cc: New file.
14292         * testsuite/weak_alias_test_3.cc: New file.
14293
14294 2008-04-08  Ian Lance Taylor  <iant@google.com>
14295
14296         * options.h (class General_options): Add --noinhibit-exec option.
14297         * main.cc (main): Check --noinhibit-exec.
14298
14299         * options.h (class General_options): Define --wrap as a special
14300         option.  Add wrap_symbols_ field.
14301         (General_options::any_wrap_symbols): New function.
14302         (General_options::is_wrap_symbol): New function.
14303         * options.cc (General_options::parse_wrap): New function.
14304         (General_options::General_options): Initialize wrap_symbols_.
14305         * symtab.cc (Symbol_table::wrap_symbol): New function.
14306         (Symbol_table::add_from_object): Handle --wrap.
14307         * symtab.h (class Symbol_table): Declare wrap_symbol.
14308         * target.h (Target::wrap_char): New function.
14309         (Target::Target_info): Add wrap_char field.
14310         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14311         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14312         * testsuite/testfile.cc (Target_test::test_target_info):
14313         Likewise.
14314
14315         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14316         there is one.
14317
14318         * layout.h (class Layout): Add added_eh_frame_data_ field.
14319         * layout.cc (Layout::Layout): Initialize new field.
14320         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14321         output section until we find a section we merged successfully.
14322         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14323         that the size be non-zero.
14324
14325         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14326         qualifier.
14327
14328 2008-04-08  Craig Silverstein  <csilvers@google.com>
14329
14330         * configure.ac: Export new conditional variable HAVE_ZLIB.
14331         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14332         on HAVE_ZLIB.
14333         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14334         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14335
14336 2008-04-07  Ian Lance Taylor  <iant@google.com>
14337
14338         * version.cc (version_string): Set to "1.5".
14339
14340         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14341         Add issued_non_pic_error_ field.  Declare check_non_pic.
14342         (Target_x86_64::Scan::check_non_pic): New function.
14343         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14344         (Target_x86_64::Scan::global): Likewise.
14345
14346         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14347         addend parameter.  Change caller.  Handle merge sections.
14348         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14349         Address to Addend.  Don't add in the result of
14350         local_section_offset, pass down the addend and use the returned
14351         value.
14352         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14353         Update declarations of local_section_offset and symbol_value.
14354         * testsuite/two_file_test_1.cc (t18): New function.
14355         * testsuite/two_file_test_2.cc (f18): New function.
14356         * testsuite/two_file_test_main.cc (main): Call t18.
14357         * testsuite/two_file_test.h (t18, f18): Declare.
14358
14359         * configure.ac: Don't test for objdump, c++filt, or readelf.
14360         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14361         conditionals.
14362         (TEST_READELF): New variable.
14363         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14364         (check_PROGRAMS): Add two_file_strip_test.
14365         (two_file_strip_test): New target.
14366         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14367         (two_file_same_shared_strip_test_SOURCES): New variable.
14368         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14369         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14370         (two_file_same_shared_strip_test_LDADD): New variable.
14371         (two_file_shared_strip.so): New target.
14372         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14373         (ver_test_5.syms, ver_test_7.syms): Likewise.
14374         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14375         (strip_test_3.stdout): Use TEST_OBJDUMP.
14376         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14377
14378 2008-04-04  Cary Coutant  <ccoutant@google.com>
14379
14380         * symtab.h (Symbol::is_weak_undefined): New function.
14381         (Symbol::is_strong_undefined): New function.
14382         (Symbol::is_absolute): New function.
14383         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14384         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14385         absolute symbols.
14386         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14387         (weak_undef_test): New target.
14388         * testsuite/Makefile.in: Rebuild.
14389         * testsuite/weak_undef_file1.cc: New file.
14390         * testsuite/weak_undef_file2.cc: New file.
14391         * testsuite/weak_undef_test.cc: New file.
14392
14393 2008-04-03  Craig Silverstein  <csilvers@google.com>
14394
14395         * compressed_output.h (class Output_compressed_section): Use
14396         unsigned buffer.
14397         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14398         add zlib header.
14399         (zlib_compressed_suffix): Removed.
14400         (Output_compressed_section::set_final_data_size): Use unsigned
14401         buffers.
14402         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14403         Fix linker invocation.
14404         (flagstest_o_specialfile_and_compress_debug_sections):
14405         Likewise.
14406         * testsuite/Makefile.in: Regenerated.
14407
14408 2008-04-02  David S. Miller  <davem@davemloft.net>
14409
14410         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14411         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14412
14413 2008-04-02  Craig Silverstein  <csilvers@google.com>
14414
14415         * TODO: New file.
14416
14417 2008-04-02  Ian Lance Taylor  <iant@google.com>
14418
14419         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14420         parameters.  Update for new key type to views_.  Change all
14421         callers.
14422         (File_read::read): Adjust for byteshift in returned view.
14423         (File_read::add_view): New function, broken out of
14424         find_and_make_view.
14425         (File_read::make_view): New function, broken out of
14426         find_and_make_view.
14427         (File_read::find_or_make_view): Add offset and aligned
14428         parameters.  Rewrite accordingly.  Change all callers.
14429         (File_read::get_view): Add offset and aligned parameters.  Adjust
14430         for byteshift in return value.
14431         (File_read::get_lasting_view): Likewise.
14432         * fileread.h (class File_read): Update declarations.
14433         (class File_read::View): Add byteshift_ field.  Add byteshift to
14434         constructor.  Add byteshift method.
14435         * archive.h (Archive::clear_uncached_views): New function.
14436         (Archive::get_view): Add aligned parameter.  Change all callers.
14437         * object.h (Object::get_view): Add aligned parameter.  Change all
14438         callers.
14439         (Object::get_lasting_view): Likewise.
14440
14441         * fileread.cc (File_read::release): Don't call clear_views if
14442         there are multiple objects.
14443         * fileread.h (File_read::clear_uncached_views): New function.
14444         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14445         on the archive.
14446
14447 2008-03-31  Cary Coutant  <ccoutant@google.com>
14448
14449         Add thin archive support.
14450         * archive.cc (Archive::armagt): New const.
14451         (Archive::setup): Remove task parameter and calls to unlock.
14452         (Archive::unlock_nested_archives): New function.
14453         (Archive::read_header): Add nested_off parameter. Change
14454         all callers.
14455         (Archive::interpret_header): Likewise.
14456         (Archive::include_all_members): Change to handle thin
14457         archives.
14458         (Archive::include_member): Likewise.
14459         * archive.h (Archive::Archive): Add new parameters and
14460         initializers.
14461         (Archive::armagt): New const.
14462         (Archive::setup): Remove task parameter.
14463         (Archive::unlock_nested_archives): New function.
14464         (Archive::read_header): Add nested_off parameter.
14465         (Archive::interpret_header): Likewise.
14466         (Archive::Nested_archive_table): New typedef.
14467         (Archive::is_thin_archive_): New field.
14468         (Archive::nested_archives_): New field.
14469         (Archive::options_): New field.
14470         (Archive::dirpath_): New field.
14471         (Archive::task_): New field.
14472         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14473         for thin archives.  Pass additional parameters to
14474         Archive::Archive.  Unlock the archive file after calling
14475         Archive::setup.
14476
14477 2008-03-29  Ian Lance Taylor  <iant@google.com>
14478
14479         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14480         version symbol to be local.
14481         * testsuite/ver_test_4.sh: New file.
14482         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14483         (check_DATA): Add ver_test_4.syms.
14484         (ver_test_4.syms): New target.
14485         * testsuite/Makefile.in: Rebuild.
14486
14487         * output.cc
14488         (Output_section::Input_section_sort_entry::has_priority): New
14489         function.
14490         (Output_section::Input_section_sort_entry::match_file_name): New
14491         function.
14492         (Output_section::Input_section_sort_entry::match_section_name):
14493         Remove.
14494         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14495         Remove.
14496         (Output_section::Input_section_sort_entry::match_section_file):
14497         Remove.
14498         (Output_section::Input_section_sort_compare::operator()): Rewrite
14499         using new Input_section_sort_entry functions.  Sort crtbegin and
14500         crtend first.  Sort sections with no priority before sections with
14501         a priority.
14502         * testsuite/initpri1.c (d3): Check j != 4.
14503         (cd5): New constructor/destructor function.
14504         (main): Check j != 2.
14505
14506         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14507         new symbol when resolving, don't call set_is_default.
14508         * testsuite/ver_test_7.cc: New file.
14509         * testsuite/ver_test_7.sh: New file.
14510         * testsuite/Makefile.am (ver_test_7.so): New target.
14511         (ver_test_7.o): New target.
14512         (check_SCRIPTS): Add ver_test_7.sh.
14513         (check_DATA): Add ver_test_7.syms.
14514         (ver_test_7.syms): New target.
14515
14516 2008-03-28  Ian Lance Taylor  <iant@google.com>
14517
14518         * layout.cc (Layout::layout): If we see an input section with a
14519         name that needs sorting, set the must_sort flag for the output
14520         section.
14521         (Layout::make_output_section): If the name of the output section
14522         indicates that it might require sorting, set the may_sort flag.
14523         * output.h (Output_section::may_sort_attached_input_sections): New
14524         function.
14525         (Output_section::set_may_sort_attached_input_sections): New
14526         function.
14527         (Output_section::must_sort_attached_input_sections): New
14528         function.
14529         (Output_section::set_must_sort_attached_input_sections): New
14530         function.
14531         (class Output_section): Declare Input_section_sort_entry.  Define
14532         Input_section_sort_compare.  Declare
14533         sort_attached_input_sections.  Add new fields:
14534         may_sort_attached_input_sections_,
14535         must_sort_attached_input_sections_,
14536         attached_input_sections_are_sorted_.
14537         * output.cc (Output_section::Output_section): Initialize new
14538         fields.
14539         (Output_section::add_input_section): Add an entry to
14540         input_sections_ if may_sort or must_sort are true.
14541         (Output_section::set_final_data_size): Call
14542         sort_attached_input_sections if necessary.
14543         (Output_section::Input_section_sort_entry): Define new class.
14544         (Output_section::Input_section_sort_compare::operator()): New
14545         function.
14546         (Output_section::sort_attached_input_sections): New function.
14547         * configure.ac: Check whether the compiler supports constructor
14548         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14549         * testsuite/initpri1.c: New file.
14550         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14551         CONSTRUCTOR_PRIORITY.
14552         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14553         (initpri1_LDFLAGS): New variable.
14554         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14555
14556 2008-03-27  Ian Lance Taylor  <iant@google.com>
14557
14558         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14559         * testsuite/common_test_1.c: New file.
14560         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14561         (common_test_1_SOURCES): New variable.
14562         (common_test_1_DEPENDENCIES): New variable.
14563         (common_test_1_LDFLAGS): New variable.
14564
14565         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14566         and commons_ correctly when NAME/VERSION does not override
14567         NAME/NULL.
14568         * testsuite/ver_test_6.c: New file.
14569         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14570         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14571         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14572
14573 2008-03-26  Ian Lance Taylor  <iant@google.com>
14574
14575         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14576         of an undefined symbol from a version script.
14577         * testsuite/Makefile.am (ver_test_5.so): New target.
14578         (ver_test_5.o): New target.
14579         (check_SCRIPTS): Add ver_test_5.sh.
14580         (check_DATA): Add ver_test_5.syms.
14581         (ver_test_5.syms): New target.
14582         * testsuite/ver_test_5.cc: New file.
14583         * testsuite/ver_test_5.script: New file.
14584         * testsuite/ver_test_5.sh: New file.
14585         * Makefile.in, testsuite/Makefile.in: Rebuild.
14586
14587         PR gold/5986
14588         Fix problems building gold with gcc 4.3.0.
14589         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14590         (gold_error_at_location, gold_warning_at_location): Use it.
14591         * configure.ac: Check whether we can compile and use a template
14592         function with a printf attribute.
14593         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14594         when jumping over bytes.
14595         * object.cc: Instantiate Object::read_section_data.
14596         * debug.h: Include <cstring>
14597         * dwarf_reader.cc: Include <algorithm>
14598         * main.cc: Include <cstring>.
14599         * options.cc: Include <cstring>.
14600         * output.cc: Include <cstring>.
14601         * script.cc: Include <cstring>.
14602         * script.h: Include <string>.
14603         * symtab.cc: Include <cstring> and <algorithm>.
14604         * target-select.cc: Include <cstring>.
14605         * version.cc: Include <string>.
14606         * testsuite/testmain.cc: Include <cstdlib>.
14607         * configure, config.in: Rebuild.
14608
14609 2008-03-25  Ian Lance Taylor  <iant@google.com>
14610
14611         * options.cc: Include "../bfd/bfdver.h".
14612         (options::help): Print bug reporting address.
14613
14614         * version.cc (print_version): Adjust output for current value of
14615         BFD_VERSION_STRING.
14616
14617         * NEWS: New file.
14618
14619         * options.cc (options::help): Print list of supported targets.
14620         * target-select.h: Include <vector>.
14621         (class Target_selector): Make machine_, size_, and is_big_endian_
14622         fields const.  Add bfd_name_ and instantiated_target_ fields.
14623         (Target_selector::Target_selector): Add bfd_name parameter.
14624         (Target_selector::recognize): Make non-virtual, call
14625         do_recognize.
14626         (Target_selector::recognize_by_name): Make non-virtual, call
14627         do_recognize_by_name.
14628         (Target_selector::supported_names): New function.
14629         (Target_selector::bfd_name): New function.
14630         (Target_selector::do_instantiate_target): New pure virtual
14631         function.
14632         (Target_selector::do_recognize): New virtual function.
14633         (Target_selector::do_recognize_by_name): New virtual function.
14634         (Target_selector::instantiate_target): New private function.
14635         (supported_target_names): Declare.
14636         * target-select.cc (Target_selector::Target_selector): Update for
14637         new parameter and fields.
14638         (select_target_by_name): Check that the name matches before
14639         calling recognize_by_name.
14640         (supported_target_names): New function.
14641         * i386.cc (class Target_selector_i386): Update Target_selector
14642         constructor call.  Remove recognize and recognize_by_name.  Add
14643         do_instantiate_target.
14644         * x86_64.cc (class Target_selector_x86_64): Likewise.
14645         * testsuite/testfile.cc (class Target_selector_test): Update for
14646         changes to Target_selector.
14647
14648         * README: Rewrite, with some notes on unsupported features.
14649
14650 2008-03-24  Cary Coutant  <ccoutant@google.com>
14651
14652         * i386.cc (Target_i386::Got_type): New enum declaration.
14653         (Target_i386::Scan::local): Updated callers of Output_data_got
14654         member functions.
14655         (Target_i386::Scan::global): Likewise.
14656         (Target_i386::Relocate::relocate): Likewise.
14657         (Target_i386::Relocate::relocate_tls): Likewise.
14658         * object.h (Got_offset_list): New class.
14659         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14660         (Sized_relobj::local_got_offset): Likewise.
14661         (Sized_relobj::set_local_got_offset): Likewise.
14662         (Sized_relobj::local_has_tls_got_offset): Removed.
14663         (Sized_relobj::local_tls_got_offset): Removed.
14664         (Sized_relobj::set_local_tls_got_offset): Removed.
14665         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14666         * output.cc (Output_data_got::add_global): Added got_type parameter.
14667         (Output_data_got::add_global_with_rel): Likewise.
14668         (Output_data_got::add_global_with_rela): Likewise.
14669         (Output_data_got::add_global_pair_with_rel): New function.
14670         (Output_data_got::add_global_pair_with_rela): New function.
14671         (Output_data_got::add_local): Added got_type parameter.
14672         (Output_data_got::add_local_with_rel): Likewise.
14673         (Output_data_got::add_local_with_rela): Likewise.
14674         (Output_data_got::add_local_pair_with_rel): New function.
14675         (Output_data_got::add_local_pair_with_rela): New function.
14676         (Output_data_got::add_global_tls): Removed.
14677         (Output_data_got::add_global_tls_with_rel): Removed.
14678         (Output_data_got::add_global_tls_with_rela): Removed.
14679         (Output_data_got::add_local_tls): Removed.
14680         (Output_data_got::add_local_tls_with_rel): Removed.
14681         (Output_data_got::add_local_tls_with_rela): Removed.
14682         * output.h (Output_data_got::add_global): Added got_type parameter.
14683         (Output_data_got::add_global_with_rel): Likewise.
14684         (Output_data_got::add_global_with_rela): Likewise.
14685         (Output_data_got::add_global_pair_with_rel): New function.
14686         (Output_data_got::add_global_pair_with_rela): New function.
14687         (Output_data_got::add_local): Added got_type parameter.
14688         (Output_data_got::add_local_with_rel): Likewise.
14689         (Output_data_got::add_local_with_rela): Likewise.
14690         (Output_data_got::add_local_pair_with_rel): New function.
14691         (Output_data_got::add_local_pair_with_rela): New function.
14692         (Output_data_got::add_global_tls): Removed.
14693         (Output_data_got::add_global_tls_with_rel): Removed.
14694         (Output_data_got::add_global_tls_with_rela): Removed.
14695         (Output_data_got::add_local_tls): Removed.
14696         (Output_data_got::add_local_tls_with_rel): Removed.
14697         (Output_data_got::add_local_tls_with_rela): Removed.
14698         * resolve.cc (Symbol::override_base_with_special): Removed
14699         reference to has_got_offset_ field.
14700         * symtab.cc (Symbol::init_fields): Replaced initialization
14701         of got_offset_ with got_offsets_.  Removed initialization
14702         of has_got_offset_
14703         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14704         (Symbol::got_offset): Likewise.
14705         (Symbol::set_got_offset): Likewise.
14706         (Symbol::has_tls_got_offset): Removed.
14707         (Symbol::tls_got_offset): Removed.
14708         (Symbol::set_tls_got_offset): Removed.
14709         (Symbol::got_offset_): Removed.
14710         (Symbol::tls_mod_got_offset_): Removed.
14711         (Symbol::tls_pair_got_offset_): Removed.
14712         (Symbol::got_offsets_): New field.
14713         (Symbol::has_got_offset): Removed.
14714         (Symbol::has_tls_mod_got_offset): Removed.
14715         (Symbol::has_tls_pair_got_offset): Removed.
14716         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14717         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14718         member functions.
14719         (Target_x86_64::Scan::global): Likewise.
14720         (Target_x86_64::Relocate::relocate): Likewise.
14721         (Target_x86_64::Relocate::relocate_tls): Likewise.
14722
14723 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14724
14725         * yyscript.y: Fix spelling error in comment.
14726
14727 2008-03-24  Ian Lance Taylor  <iant@google.com>
14728
14729         * options.h (class General_options): Define build_id option.
14730         * layout.h (class Layout): Declare write_build_id, create_note,
14731         create_build_id.  Add build_id_note_ member.
14732         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14733         "libiberty.h", "md5.h", "sha1.h".
14734         (Layout::Layout): Initialize eh_frame_data_,
14735         eh_frame_hdr_section_, and build_id_note_.
14736         (Layout::finalize): Call create_build_id.
14737         (Layout::create_note): New function, broken out of
14738         Layout::create_gold_note.
14739         (Layout::create_gold_note): Call create_note.
14740         (Layout::create_build_id): New function.
14741         (Layout::write_build_id): New function.
14742         (Close_task_runner::run): Call write_build_id.
14743
14744         * x86_64.cc: Correct license to GPLv3.
14745
14746 2008-03-23  Ian Lance Taylor  <iant@google.com>
14747
14748         * options.cc: Include "demangle.h".
14749         (parse_optional_string): New function.
14750         (parse_long_option): Handle takes_optional_argument.
14751         (parse_short_option): Update dash_z initializer.  Handle
14752         takes_optional_argument.
14753         (General_options::General_options): Initialize do_demangle_.
14754         (General_options::finalize): Set do_demangle_.  Handle demangling
14755         style.
14756         * options.h (parse_optional_string): Declare.
14757         (struct One_option): Add optional_arg field.  Update constructor.
14758         Update call constructor calls.  Add takes_optional_argument
14759         function.
14760         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14761         (DEFINE_optional_string): Define.
14762         (General_options::demangle): Change from DEFINE_bool to
14763         DEFINE_optional_string.
14764         (General_options::no_demangle): New function.
14765         (General_options::do_demangle): New function.
14766         (General_options::set_do_demangle): New function.
14767         (General_options::execstack_status_): Move definition to end of
14768         class definition.
14769         (General_options::static_): Likewise.
14770         (General_options::do_demangle_): New field.
14771         * object.cc (big_endian>::get_symbol_location_info): Call
14772         Options::do_demangle, not Options::demangle.
14773         * symtab.cc (demangle): Likewise.
14774
14775 2008-03-22  Ian Lance Taylor  <iant@google.com>
14776
14777         * gold.h: Include <cstddef> and <sys/types.h>
14778         * options.h: Include <cstring>.
14779
14780 2008-03-21  Ian Lance Taylor  <iant@google.com>
14781
14782         * Added source code to GNU binutils.
14783 \f
14784 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14785
14786 Copying and distribution of this file, with or without modification,
14787 are permitted in any medium without royalty provided the copyright
14788 notice and this notice are preserved.
14789
14790 Local Variables:
14791 mode: change-log
14792 left-margin: 8
14793 fill-column: 74
14794 version-control: never
14795 End: