* merge.cc (Output_merge_string::do_add_input_section): Correct
[platform/upstream/binutils.git] / gold / ChangeLog
1 2013-05-03  Alan Modra  <amodra@gmail.com>
2
3         * merge.cc (Output_merge_string::do_add_input_section): Correct
4         scan for number of strings.  Rename vars to avoid shadowing.
5         Include missing terminator in input_size_.
6
7 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
8
9         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
10         Restore empty string handling.
11
12 2013-05-01  Cary Coutant  <ccoutant@google.com>
13
14         * stringpool.cc (Stringpool_template::new_key_offset): Fix
15         uninitialized warning.
16
17 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
18
19         * output.cc (Output_section::add_merge_input_section): Allow
20         to merge sections if the alignment is more than character size.
21         * merge.h (Output_merge_string::Output_merge_string): Remove
22         assert.
23         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
24         only not-null strings. Check the alignment of strings.
25         * stringpool.h
26         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
27         alignment as the argument.
28         (Stringpool_template<Stringpool_char>::addralign_): New class member.
29         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
30         Align non-zero length strings according to the addralign_.
31         (Stringpool_template<Stringpool_char>::set_string_offsets):
32         Updating offsets according to the given alignment.
33         * testsuite/Makefile.am (text_section_grouping): Test if string
34         literals are getting merged.
35         * testsuite/Makefile.in: Regenerate.
36         * testsuite/merge_string_literals_1.c: New file.
37         * testsuite/merge_string_literals_2.c: Ditto.
38         * testsuite/merge_string_literals.sh: Ditto.
39
40 2013-04-26  Ian Lance Taylor  <iant@google.com>
41
42         * target-reloc.h (relocate_section): If the reloc offset is out of
43         range, pass VIEW as NULL to relocate.relocate.
44         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
45         * i386.cc (Target_i386::Relocate::relocate): Likewise.
46         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
47         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
48         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
49         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
50
51 2013-04-26  Geoff Pike  <gpike@chromium.org>
52
53         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
54         * layout.cc (Hash_task): New class.
55         (Layout::queue_build_id_tasks): New function.
56         (Layout::write_build_id): Handle single-thread portion of build ID
57         computation.  (In some cases, all of it is single-threaded.)  Replace
58         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
59         functionality in fewer lines of code.
60         * layout.h (Layout::queue_build_id_tasks): New function declaration.
61         * options.h (General_options): make "--build-id" default to tree
62         rather than sha1.  Add two new options related to --build-id=tree:
63         --build-id-chunk-size-for-treehash and
64         --build-id-min-file-size-for-treehash.
65         * Makefile.am: add testing of --build-id=tree and related new options
66         (these tests will be invoked by "make check").
67         * Makefile.in: Regenerate.
68
69 2013-04-25  Alan Modra  <amodra@gmail.com>
70
71         * configure.tgt: Add powerpcle and powerpc64le.
72
73 2013-04-22  Alan Modra  <amodra@gmail.com>
74
75         PR gold/15355
76         * layout.cc (Layout::segment_precedes): Allow more than one
77         segment with the same type and flags.
78
79 2013-04-15  Cary Coutant  <ccoutant@google.com>
80
81         * layout.cc (Layout::set_relocatable_section_offsets): Don't
82         allocate space in file for BSS sections.
83
84 2013-04-15  Cary Coutant  <ccoutant@google.com>
85
86         * script-sections.cc (Orphan_output_section): Reset address
87         to zero after each orphaned section for relocatable links.
88
89 2013-04-15  Cary Coutant  <ccoutant@google.com>
90
91         * symtab.cc (Symbol_table::sized_write_globals): Subtract
92         section starting address for relocatable link.
93         * testsuite/Makefile.am (script_test_11): New test.
94         * testsuite/Makefile.in: Regenerate.
95         * testsuite/script_test_11.c: New source file.
96         * testsuite/script_test_11.t: New linker script.
97
98 2013-04-13  Alan Modra  <amodra@gmail.com>
99
100         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
101         owner when sections are not adjacent and exceed group size.
102         (Target_powerpc::group_sections): Handle corner case.
103         (Target_powerpc::Branch_info::make_stub): Handle case where
104         stub table doesn't exist due to branches in non-exec sections.
105         (Target_powerpc::Relocate::relocate): Likewise.
106
107 2013-04-11  Alan Modra  <amodra@gmail.com>
108
109         PR gold/15354
110         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
111         .branch_lt to match bfd ld.  Adjust comments throughout file.
112
113 2013-04-04  Ian Lance Taylor  <iant@google.com>
114
115         GCC PR c++/56840
116         * object.cc (do_layout_deferred_sections): Handle .eh_frame
117         sections before checking whether they are included in the link.
118
119 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
120
121         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
122         object before calling the plugin claim_file handler.  Pass the elf
123         object of the archive to the plugin. Delete the elf object if the
124         plugin claims the file.
125
126 2013-03-21  Alan Modra  <amodra@gmail.com>
127
128         * layout.cc (Layout::set_segment_offsets): Accept writable .text
129         segment when omagic.
130
131 2013-03-21  Alan Modra  <amodra@gmail.com>
132
133         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
134         comparison warning.
135         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
136         uninitialized" warning.
137
138 2013-03-20  Alan Modra  <amodra@gmail.com>
139
140         * symtab.h (Symbol::clear_version): New function.
141         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
142         is_needed by weak references.  Clear version for symbols defined
143         in as-needed objects that are not needed.
144
145 2013-03-15  Alan Modra  <amodra@gmail.com>
146
147         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
148         static and public.  Add report_err param.  Return false for data refs.
149         (Target_powerpc::rela_dyn_section): New overloaded function.
150         (Target_powerpc::plt_, iplt_): Elucidate.
151         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
152         (Output_data_plt_powerpc::do_write): Don't write .iplt.
153         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
154         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
155         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
156         push_branch and make_plt_entry for ifunc syms when
157         reloc_needs_plt_for_ifunc.
158         (Target_powerpc::Relocate::relocate): Don't use plt entry value
159         for ifunc unless reloc_needs_plt_for_ifunc.
160
161 2013-03-15  Alan Modra  <amodra@gmail.com>
162
163         * gc.h (gc_process_relocs): Don't look through function descriptors.
164         * icf.cc (get_section_contents): Do so here instead.
165
166 2013-03-13  Alan Modra  <amodra@gmail.com>
167
168         * powerpc.cc (is_branch_reloc): Forward declare.
169         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
170         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
171         false for 64-bit, true for 32-bit non-branch relocs.
172         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
173         * testsuite/Makefile.am (icf_test): Use linker map file instead of
174         nm output.
175         (icf_safe_test): Generate linker map file as well as nm output.
176         (icf_safe_so_test): Likewise.
177         * testsuite/Makefile.in: Regenerate.
178         * testsuite/icf_test.sh: Parse linker map file to determine
179         section folding.
180         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
181         * testsuite/icf_safe_so_test.sh: Likewise.
182         (X86_32_or_ARM_specific_safe_fold): Merge into..
183         (arch_specific_safe_fold): ..this.
184         (X86_64_specific_safe_fold): Delete unused function.
185
186 2013-03-12  Alan Modra  <amodra@gmail.com>
187
188         * gc.h (gc_process_relocs): Look through function descriptors
189         to determine shndx, symvalue and addend used by ICF.  Tidy
190         variable duplication.
191
192 2013-03-11  Alan Modra  <amodra@gmail.com>
193
194         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
195         * layout.cc (Layout_task_runner::run): ..to here.
196         * symtab.h (struct Symbol_location): Extract from..
197         (class Symbol_table): ..here.
198         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
199         * target.h (class Target): Add function_location and
200         do_function_location functions.
201         (class Sized_target): Add do_function_location.
202         * object.h (class Sized_relobj_file): Move find_shdr..
203         (class Object): ..to here.
204         * object.cc: Likewise.  Update to suit.  Instantiate.
205         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
206         * powerpc.cc (class Powerpc_dynobj): New.
207         (Target_powerpc::do_function_location): New function.
208         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
209         (Powerpc_dynobj::do_read_symbols): New function.
210         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
211
212 2013-03-08  Ian Lance Taylor  <iant@google.com>
213
214         * options.cc (General_options::string_to_object_format): Accept
215         "default".
216
217 2013-03-08  Alan Modra  <amodra@gmail.com>
218
219         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
220         pointer to Post_fde.
221         (struct Post_fde): Move definition to here..
222         * ehframe.cc (struct Post_fde): ..from here.
223         (Cie::write): Don't alloc Post_fde.
224         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
225
226 2013-03-07  Alan Modra  <amodra@gmail.com>
227
228         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
229         relocation referencing .LC0.
230         * testsuite/discard_locals_test.sh: Remove FIXMEs.
231
232 2013-03-07  Alan Modra  <amodra@gmail.com>
233
234         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
235         always_inline.  Add assembly for powerpc to avoid GOT.
236
237 2013-03-07  Alan Modra  <amodra@gmail.com>
238
239         * testsuite/script_test_10.sh: Don't test .bss section
240         header number.
241
242 2013-03-06  Alan Modra  <amodra@gmail.com>
243
244         * powerpc.cc (class Powerpc_relobj): Move some member functions.
245         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
246         all callers.  Handle folded sections.
247         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
248         to Powerpc_relobj.
249         (Global_symbol_visitor_opd::operator()): Likewise.
250
251 2013-03-04  Alan Modra  <amodra@gmail.com>
252
253         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
254         * testsuite/Makefile.in: Regenerate.
255
256 2013-03-01  Cary Coutant  <ccoutant@google.com>
257
258         Add dwp support for v2 DWARF package file format.
259         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
260         tu_length parameter.  Adjust all callers.
261         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
262         * dwp.cc: Include dwarf.h.
263         (Section_bounds): New struct type.
264         (Unit_set): New struct type.
265         (Dwo_file::Dwo_file): Initialize new data member.
266         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
267         Combine and rename to...
268         (Dwo_file::read_unit_index): ...this.
269         (Dwo_file::sized_read_compunit_index)
270         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
271         (Dwo_file::sized_read_unit_index): ...this.
272         (Dwo_file::copy_section): Remove section_name, is_str_offsets
273         parameters; add section_id parameter.
274         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
275         (Dwo_file::add_unit_set): ...this.
276         (Dwo_file::shndx_map_): Remove.
277         (Dwo_file::sect_offsets_): New data member.
278         (Dwp_output_file::Dwp_output_file): Initialize new data members.
279         (Dwp_output_file::add_section): Rename to...
280         (Dwp_output_file::add_contribution): ...this.
281         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
282         (Dwp_output_file::add_tu_set): Likewise.
283         (Dwp_output_file::Contribution): New type.
284         (Dwp_output_file::Section::contributions): New data member.
285         (Dwp_output_file::Cu_or_tu_set): Remove.
286         (Dwp_output_file::Section::Section): New ctor.
287         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
288         (Dwp_output_file::Dwp_index::Section_table): New type.
289         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
290         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
291         parameter.
292         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
293         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
294         (Dwp_output_file::Dwp_index::section_table): New member function.
295         (Dwp_output_file::Dwp_index::section_table_end): New member function.
296         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
297         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
298         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
299         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
300         (Dwp_output_file::Dwp_index::section_table_): New data member.
301         (Dwp_output_file::Dwp_index::section_mask_): New data member.
302         (Dwp_output_file::add_output_section): New member function.
303         (Dwp_output_file::write_new_section): New member function.
304         (Dwp_output_file::write_contributions): New member function.
305         (Dwp_output_file::section_id_map_): New data member.
306         (class Dwo_id_info_reader): Remove.
307         (class Unit_reader): New class.
308         (get_dwarf_section_name): New function.
309         (Dwo_file::read_executable): Adjust initializations of class data.
310         (Dwo_file::read): Add support for v2 package file format.
311         (Dwo_file::read_unit_index): Likewise.
312         (Dwo_file::sized_read_unit_index): Likewise.
313         (Dwo_file::copy_section): Likewise.
314         (Dwo_file::add_unit_set): Likewise.
315         (Dwp_output_file::add_output_section): Likewise.
316         (Dwp_output_file::add_contribution): Likewise.
317         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
318         for empty slot.
319         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
320         file format.
321         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
322         slot.
323         (Dwp_output_file::initialize): Remove unused function.
324         (Dwp_output_file::finalize): Add support for v2 package file format.
325         (Dwp_output_file::write_index): Likewise.
326         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
327         function prototype.
328
329 2013-03-01  Cary Coutant  <ccoutant@google.com>
330
331         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
332         function into class definition in header file.
333         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
334         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
335         New function.
336         (Dwarf_info_reader::check_buffer): Move here from .cc file.
337
338 2013-02-28  Alan Modra  <amodra@gmail.com>
339
340         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
341         * target.cc (Target::do_plt_fde_location): New function.
342         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
343         accessor function, and constructor param.
344         (struct Post_fde, Post_fdes): Declare.
345         (Cie::write): Add post_fdes param.
346         * ehframe.cc (Fde::write): Use plt_fde_location.
347         (struct Post_fde): Define.
348         (Cie::write): Stash FDEs added post merge mapping.
349         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
350         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
351         (Eh_frame::do_sized_write): Arrange to write post map FDES after
352         other FDEs.
353         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
354         (Target_powerpc::has_glink): New function.
355         (Target_powerpc::do_relax): Add eh_frame info for stubs.
356         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
357         glink_eh_frame_fde_32, default_fde): New data.
358         (Stub_table::eh_frame_added_): New var.
359         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
360         Make const.
361         (Stub_table::add_eh_frame): New function.
362         (Output_data_glink::add_eh_frame): New function.
363         (Target_powerpc::make_glink_section): Call add_eh_frame.
364
365 2013-02-15  Ian Lance Taylor  <iant@google.com>
366
367         * options.h (DEFINE_uint64_alias): Define.
368         (class General_options): Add -Ttext-segment as an alias for
369         -Ttext.
370
371 2013-02-15  Alan Modra  <amodra@gmail.com>
372
373         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
374         (Stub_table::do_write): ..here, two places.
375         (Stub_table::plt_call_size): Use it here too.
376
377 2013-02-11  Ian Lance Taylor  <iant@google.com>
378
379         * descriptors.cc (Descriptors::close_all): New function.
380         * descriptors.h (class Descriptors): Declare close_all.
381         (close_all_descriptors): New inline function.
382         * plugin.cc: Include "descriptors.h".
383         (Plugin_manager::cleanup): Call close_all_descriptors.
384
385 2013-02-06  Alan Modra  <amodra@gmail.com>
386
387         * README: Update coding style link.
388
389 2013-01-28  Cary Coutant  <ccoutant@google.com>
390
391         * dwp.cc (File_list): New typedef.
392         (Dwo_name_info_reader): New class.
393         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
394         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
395         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
396         (Dwo_file::read_executable): New function.
397         (Dwo_file::read): Move common setup code to ...
398         (Dwo_file::make_object): ... here.
399         (dwp_options): Add --exec/-e.
400         (usage): Likewise.
401         (main): Likewise.
402
403 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
404
405         * layout.cc (Layout::layout): Check for option text_reorder.
406         (Layout::make_output_section): Ditto.
407         * options.h (text_reorder): New option.
408         * output.cc (Input_section_sort_compare): Remove special ordering
409         of section names.
410         (Output_section::
411          Input_section_sort_section_name_special_ordering_compare::
412          operator()): New function.
413         (Output_section::sort_attached_input_sections): Use new sort function
414         for .text.
415         * output.h (Input_section_sort_section_name_special_ordering_compare):
416         New struct.
417         * testsuite/Makefile.am (text_section_grouping): Test option
418         --no-text-reorder
419         * testsuite/Makefile.in: Regenerate.
420         * testsuite/text_section_grouping.sh: Check order of functions without
421         default text reordering.
422
423 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
424
425         * options.h (General_options): Change default to true for new_dtags.
426
427 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
428
429         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
430         when enable_new_dtags is false.  Only add DT_RUNPATH when
431         enable_new_dtags is true.
432
433 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
434
435         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
436         used in declaration and definition consistent.
437         (Target_powerpc::symval_for_branch): Ditto.
438
439 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
440
441         * testsuite/plugin_final_layout.cc: Fix comment.
442
443 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
444
445         * layout.cc (Layout::layout): Do not do default sorting for
446         text sections when section ordering is specified.
447         (make_output_section): Ditto.
448         * testsuite/plugin_final_layout.cc: Name the function sections
449         to catch reordering issues.
450
451 2013-01-15  Alan Modra  <amodra@gmail.com>
452
453         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
454         plt-thread-safe.
455
456 2013-01-15  Alan Modra  <amodra@gmail.com>
457
458         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
459         * testsuite/Makefile.in: Regenerate.
460
461 2013-01-14  Alan Modra  <amodra@gmail.com>
462
463         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
464         * testsuite/Makefile.in: Regenerate.
465
466 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
467
468         PR bfd/14430
469         Fix mingw gold build with plugins enabled
470         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
471         * configure.ac: Export DLOPEN_LIBS and add headers check.
472         * plugin.cc: Handle non-dlfcn case.
473         * Makefile.in: Regenerate.
474         * config.in: Regenerate.
475         * configure: Regenerate.
476         * testsuite/Makefile.in: Regenerate.
477
478 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
479
480         * output.h (sort_attached_input_sections): Change to be public.
481         * script-sections.cc
482         (Output_section_definition::set_section_addresses): Sort
483         attached input sections according to section order before linker
484         script assigns section addresses.
485         (Orphan_output_section::set_section_addresses): Sort
486         attached input sections according to section order before linker
487         script assigns section addresses.
488         * Makefile.am (final_layout.sh): Use a simple linker script to
489         check if section ordering still works.
490         * Makefile.in: Regenerate.
491
492 2013-01-09  Ben Cheng  <bccheng@google.com>
493
494         * arm.cc (Target_arm::attributes_accept_div): New function.
495         (Target_arm::attributes_forbid_div): New function.
496         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
497         attribute using the same new functions as what bfd/elf32_arm.c
498         does.
499
500 2013-01-07  Cary Coutant  <ccoutant@google.com>
501
502         PR gold/14993
503         * output.cc (Output_section::add_input_section): For incremental
504         updates, don't track input sections that are allocated from patch
505         space.
506
507 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
508             Ian Lance Taylor  <iant@google.com>
509
510         PR gold/14897
511         * configure.ac (--enable-ld): Removed.
512         (install_as_default): Set to yes only for --enable-gold=default
513         or --disable-ld.
514         * configure: Regenerated.
515
516 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
517
518         * options.h (General_options): Add -fuse-ld= for GCC linker
519         option compatibility.
520
521 2013-01-04  Cary Coutant  <ccoutant@google.com>
522
523         * configure.ac: Fix typo restoring CXXFLAGS.
524         * configure: Regenerate.
525
526 2013-01-04  Cary Coutant  <ccoutant@google.com>
527
528         * testsuite/Makefile.am (CXXLINK_S): New macro.
529         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
530         * testsuite/Makefile.in: Regenerate.
531
532 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
533
534         * version.cc (print_version): Update copyright year to 2013.
535
536 2012-12-20  Ian Lance Taylor  <iant@google.com>
537
538         * layout.cc (Layout::special_ordering_of_input_section): New
539         function.
540         (Layout::layout): If input section requires special ordering, must
541         sort input sections.
542         (Layout::make_output_section): May sort .text input sections.
543         (Layout::is_section_name_prefix_grouped): Remove.
544         * layout.h (class Layout): Declare
545         special_ordering_of_input_section.  Don't declare
546         is_section_name_prefix_grouped.
547         * output.cc (Output_section::add_input_section): Revert last
548         change.
549         (Output_section::Input_section_sort::match_file_name): Don't crash
550         if called on output section data.
551         (Output_section::Input_section_sort_compare): Sort based on
552         special ordering.
553         (Output_section::Input_section_sort_section_order_index_compare):
554         Revert last patch.
555         (Output_section::sort_attached_input_sections): Likewise.
556
557 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
558
559         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
560         * layout.h (Layout::is_section_name_prefix_grouped): New function.
561         * output.cc (Output_section::add_input_section): Check if section
562         name contains special prefix.  Keep input sections to sort such
563         sections.
564         (Output_section::Input_section_sort_section_order_index_compare
565          ::operator()): Group sections according to prefixes.
566         (Output_section::sort_attached_input_sections): Add condition to
567         Input_section_entry constructor call.
568         * testsuite/Makefile.am (text_section_grouping): New test.
569         * testsuite/Makefile.in: Regenerate.
570         * testsuite/text_section_grouping.cc: New file.
571         * testsuite/text_section_grouping.sh: New file.
572
573 2012-12-17  Nick Clifton  <nickc@redhat.com>
574
575         * Makefile.am: Add copyright notice.
576         * NEWS: Likewise.
577         * README: Likewise.
578         * configure.ac: Likewise.
579         * ftruncate.c: Likewise.
580         * Makefile.in: Regenerate.
581
582 2012-12-14  Cary Coutant  <ccoutant@google.com>
583
584         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
585         --no-as-needed flag.
586         (exception_separate_shared_12_test): Likewise.
587         (incremental_copy_test): Likewise.
588         * testsuite/Makefile.in: Regenerate.
589
590 2012-12-14  Cary Coutant  <ccoutant@google.com>
591
592         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
593         (Dwp_output_file::Dwp_index::enter_set): Add assert.
594
595 2012-12-12  Alan Modra  <amodra@gmail.com>
596
597         * powerpc.cc (class Track_tls): New.
598         (class Relocate, class Scan): Inherit Track_tls.
599         (Target_powerpc::Scan::local, global): Track tls optimization
600         and avoid creating plt entry for __tls_get_addr if all uses
601         are optimized away.
602         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
603
604 2012-12-12  Alan Modra  <amodra@gmail.com>
605
606         * options.h (General_options): Add --toc-sort/--no-toc-sort.
607         Replace no_toc_optimize with toc_optimize.
608         * output.h (Output_section::input_sections): Provide non-const variant.
609         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
610         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
611         accessors.
612         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
613         (class Sort_toc_sections): New.
614         (Target_powerpc::do_finalize_sections): Sort toc sections.
615         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
616
617 2012-12-10  Roland McGrath  <mcgrathr@google.com>
618
619         * testsuite/binary_unittest.cc (read_all): New function.
620         (Sized_binary_test): Use it instead of ::read.
621         * fileread.cc (do_read): Don't assume pread always reads the whole
622         amount in a single call.
623
624 2012-12-10  Alan Modra  <amodra@gmail.com>
625
626         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
627         Set EM_PPC64 or EM_PPC here.
628         (Target_selector_powerpc::do_recognize): Delete.
629
630 2012-12-10  Alan Modra  <amodra@gmail.com>
631
632         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
633         stub_table_.
634         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
635
636 2012-12-07  Roland McGrath  <mcgrathr@google.com>
637
638         * testsuite/binary_unittest.cc (Sized_binary_test):
639         Use open_descriptor rather than ::open.
640
641 2012-12-07  Alan Modra  <amodra@gmail.com>
642
643         * powerpc.cc (Stub_table::do_write): Delete redundant Address
644         typedef and invalid_address constant.
645         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
646         instantiate constants.
647
648 2012-12-06  Roland McGrath  <mcgrathr@google.com>
649
650         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
651         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
652         * aclocal.m4: Regenerate.
653         * configure: Regenerate.
654         * Makefile.in: Regenerate.
655         * testsuite/Makefile.in: Regenerate.
656
657 2012-12-07  Alan Modra  <amodra@gmail.com>
658
659         * options.h (General_options): Add no_toc_optimize.
660         * powerpc.cc (ok_lo_toc_insn): New function.
661         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
662
663 2012-12-06  Alan Modra  <amodra@gmail.com>
664
665         * options.h (General_options): Add plt_align, plt_static_chain,
666         plt_thread_safe.  Update stub_group_size help text.
667         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
668         for new plt_thread_safe_ var.
669         (use_plt_offset): Correct comments.
670         (Target_powerpc::do_relax): Look for thread creation symbols to
671         determine default plt_thread_safe value.  Clear plt call stubs
672         as well as branch stubs each iteration.
673         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
674         insn constants.
675         (l, hi, ha, write_insn): Move earlier.
676         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
677         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
678         plt stubs too.
679         (Stub_table::update_size): Adjust.
680         (Stub_table::prev_size, set_prev_size): Delete.
681         (Stub_table::stub_align): Let --plt-align affect result.
682         (Stub_table::plt_call_size): Calculate sizes for various stubs.
683         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
684         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
685         (Stub_table::do_write): Support more stub variants.
686
687 2012-12-04  Alan Modra  <amodra@gmail.com>
688
689         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
690         (Target_powerpc::do_define_standard_symbols): New function.
691
692 2012-12-03  Alan Modra  <amodra@gmail.com>
693
694         * output.h: Formatting, whitespace.
695
696 2012-12-03  Alan Modra  <amodra@gmail.com>
697
698         * layout.h (Layout::get_executable_sections): Declare.
699         * layout.cc (Layout::get_executable_sections): New function.
700         * arm.cc (Target_arm::group_sections): Use it.
701         (Arm_output_section::group_sections): Delete now redundant test.
702         * output.cc (Output_reloc::Output_reloc): Add is_relative.
703         param to handle relative relocs.
704         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
705         (Output_data_reloc::add_absolute): Adjust.
706         (Output_data_reloc::add_relative): New function.
707         (Output_data::reset_data_size): New function.
708         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
709         (Output_section::set_addralign): New function.
710         (Output_section::checkpoint_set_addralign): New function.
711         (Output_section::clear_section_offsets_need_adjustment): New function.
712         (Output_section::input_sections): Make public.
713         * powerpc.cc (class Output_data_brlt_powerpc): New.
714         (class Stub_table, class Stub_control): New.
715         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
716         stub_table_, set_stub_table, stub_table): New vectors and accessor
717         functions.
718         (Target_powerpc::do_may_relax, do_relax, push_branch,
719         new_stub_table, stub_tables, brlt_section, group_sections,
720         add_branch_lookup_table, find_branch_lookup_table,
721         write_branch_lookup_table, make_brlt_section): New functions.
722         (Target_powerpc::struct Sort_sections, class Branch_info): New.
723         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
724         branch_info_): New vars.
725         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
726         make call stubs here.
727         (Output_data_glink): Remove all call stub handling from this class.
728         (Target_powerpc::Scan::local, global): Save interesting branch
729         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
730         (Target_powerpc::do_finalize_sections): Only make reg save/restore
731         functions on final link.
732         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
733         Handle long branch destinations too.
734         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
735         do_plt_address_for_local): Adjust lookup of plt call stubs.
736
737 2012-11-30  Alan Modra  <amodra@gmail.com>
738
739         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
740         relocs against protected symbols when building 32-bit shared libs.
741
742 2012-11-30  Alan Modra  <amodra@gmail.com>
743
744         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
745         param.  Call got_section() to make .got.  Update all callers
746         and their callers and so on.
747
748 2012-11-30  Alan Modra  <amodra@gmail.com>
749
750         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
751         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
752         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
753         value if it already exists.
754
755 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
756
757         PR gold/14858
758         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
759
760 2012-11-14  Roland McGrath  <mcgrathr@google.com>
761
762         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
763         than bfc instruction for data sandboxing.
764
765 2012-11-08  Alan Modra  <amodra@gmail.com>
766
767         * po/POTFILES.in: Regenerate.
768
769 2012-11-05  Alan Modra  <amodra@gmail.com>
770
771         * configure.ac: Apply 2012-09-10 change to config.in here.
772         * configure: Regenerate.
773
774 2012-11-05  Alan Modra  <amodra@gmail.com>
775
776         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
777         (struct Opd_ent): Use "Address" rather than "Offset".
778         (Output_data_got_powerpc::got_base_offset): Return Valtype.
779         (Target_powerpc::got_section): Make public.
780         (Target_powerpc::scan_relocs): Move code setting symbols..
781         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
782         Create _SDA_BASE_ only when referenced.
783
784 2012-11-02  Roland McGrath  <mcgrathr@google.com>
785
786         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
787         from last change.
788
789 2012-11-01  Roland McGrath  <mcgrathr@google.com>
790
791         * target.h (Sized_target::relocate_relocs): Use Elf_Off
792         for offset_in_output_section parameter.
793         (Sized_target::relocate_special_relocatable): Likewise.
794         * arm.cc (Target_arm::relocate_relocs): Likewise.
795         (Target_arm::relocate_special_relocatable): Likewise.
796         * i386.cc (Target_i386::relocate_relocs): Likewise.
797         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
798         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
799         * target-reloc.h (relocate_relocs): Likewise.
800         * testsuite/testfile.cc (Target_test): Likewise.
801         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
802         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
803
804         * system.h: Move inclusion of <clocale> to after <libintl.h> in
805         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
806
807         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
808         parameter, which is unused in the [!F_SETFD] case.
809
810         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
811         SYMNDX to off_t before comparing it to this->data_size().
812         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
813         * incremental.cc (Output_section_incremental_inputs::do_write):
814         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
815
816         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
817
818 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
819
820         * gold.cc (Target_arm::do_adjust_elf_header): Add the
821         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
822         in EABI_VER5.
823
824 2012-10-29  Cary Coutant  <ccoutant@google.com>
825
826         * dwp.cc (usage): Add file and exit status parameters;
827         add --help and --version options.
828         (print_version): New function.
829         (main): Add --help and --version options.
830
831 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
832
833         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
834         final_layout_sequence.txt.
835         * testsuite/Makefile.in: Regenerated.
836
837 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
838
839         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
840         COMPILE generated by automake.
841         (LINK1): Likewise.
842         (CXXCOMPILE1): Likewise.
843         (CXXLINK1): Likewise.
844         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
845         (LINK): Likewise.
846         (CXXCOMPILE): Likewise.
847         (CXXLINK): Likewise.
848         * testsuite/Makefile.in: Regenerated.
849
850 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
851
852         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
853         on bad fwrite return.
854
855 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
856
857         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
858         on val.
859
860 2012-10-23  Cary Coutant  <ccoutant@google.com>
861
862         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
863         * testsuite/Makefile.in: Regenerate.
864         * testsuite/dwp_test.h: New source file.
865         * testsuite/dwp_test_1.cc: New source file.
866         * testsuite/dwp_test_1.s: New source file.
867         * testsuite/dwp_test_1.sh: New source file.
868         * testsuite/dwp_test_1b.cc: New source file.
869         * testsuite/dwp_test_1b.s: New source file.
870         * testsuite/dwp_test_2.cc: New source file.
871         * testsuite/dwp_test_2.s: New source file.
872         * testsuite/dwp_test_2.sh: New source file.
873         * testsuite/dwp_test_main.cc: New source file.
874         * testsuite/dwp_test_main.s: New source file.
875
876 2012-10-23  Cary Coutant  <ccoutant@google.com>
877
878         * dwp.h: New header file.
879         * dwp.cc: New source file.
880         * gold.h: Move shared declarations to system.h.
881         * system.h: New header file.
882         * Makefile.am: Add dwp.
883         * Makefile.in: Regenerate.
884
885 2012-10-23  Cary Coutant  <ccoutant@google.com>
886
887         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
888         Dwarf_info_reader::read_from_pointer.
889         (Dwarf_pubnames_table::read_header): Likewise.
890         (Dwarf_pubnames_table::next_name): Likewise.
891         (Dwarf_die::read_attributes): Likewise.
892         (Dwarf_die::skip_attributes): Likewise.
893         (Dwarf_info_reader::read_from_pointer): New function template.
894         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
895         (Dwarf_pubnames_table): Likewise.
896         (Dwarf_info_reader::read_from_pointer): New function template.
897         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
898         Dwarf_pubnames_table ctor.
899
900 2012-10-23  Cary Coutant  <ccoutant@google.com>
901
902         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
903         abbrev_shndx.
904         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
905         abbrev_shndx_.
906         (Dwarf_info_reader::set_abbrev_shndx): New method.
907         (Dwarf_info_reader::abbrev_shndx_): New data member.
908
909 2012-10-23  Cary Coutant  <ccoutant@google.com>
910
911         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
912         from object, not parameters.
913         (Dwarf_info_reader::parse): Likewise.
914         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
915         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
916         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
917         methods.
918
919 2012-10-23  Cary Coutant  <ccoutant@google.com>
920
921         * fileread.cc (Input_file::Input_file): New constructor.
922         * fileread.h (class Input_file): Add new constructor.
923
924 2012-10-18  Alan Modra  <amodra@gmail.com>
925
926         PR gold/14727
927         * object.cc (Relobj::is_section_name_included): Also match
928         .sdata personality section.
929
930 2012-10-18  Alan Modra  <amodra@gmail.com>
931
932         * target-reloc.h (class Default_comdat_behavior): New, package up..
933         (get_comdat_behaviour): ..this.
934         (relocate_section): Add Relocate_comdat_behavior template arg,
935         adjust code to suit.
936         * arm.cc (Target_arm::relocate_section): Adjust to suit.
937         (Target_arm::scan_reloc_section): Likewise.
938         * i386.cc (Target_i386::relocate_section): Likewise.
939         * sparc.cc (Target_sparc::relocate_section): Likewise.
940         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
941         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
942         * powerpc.cc (class Relocate_comdat_behavior): New.
943         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
944         gold::relocate_section with new template arg.
945
946 2012-10-18  Alan Modra  <amodra@gmail.com>
947
948         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
949         dynamic relocs for GOT_TPREL got entries, without symbol if
950         resolving locally.
951         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
952         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
953         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
954
955 2012-10-17  Alan Modra  <amodra@gmail.com>
956
957         PR gold/14726
958         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
959
960 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
961
962         * layout.cc (Layout::include_section): Keep sections marked
963         SHF_EXCLUDE when doing relocatable links.
964
965 2012-10-16  Alan Modra  <amodra@gmail.com>
966
967         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
968         (Target_powerpc::do_finalize_sections): Call it.
969         (Output_data_save_res): New class and supporting functions.
970         (Target_powerpc::symval_for_branch): Only look up .opd entry for
971         normal symbols defined in object files.
972
973 2012-10-12  Alan Modra  <amodra@gmail.com>
974
975         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
976         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
977         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
978         section if scan_opd_relocs not yet called.
979         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
980
981 2012-10-12  Alan Modra  <amodra@gmail.com>
982
983         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
984         add_local_ifunc_entry): Revert last change.
985         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
986
987 2012-10-05  Alan Modra  <amodra@gmail.com>
988
989         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
990         do_plt_address_for_global): New functions.
991         (Output_data_got_powerpc::do_write): Don't segfault when linking
992         statically.
993         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
994         add_local_ifunc_entry): Return true on adding entry..
995         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
996         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
997         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
998         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
999         set up symbols here.
1000         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1001         syms here.  Do so even when no .iplt.  Don't segfault when linking
1002         statically.
1003         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1004         new variants without reloc param.
1005         (Glink_sym_ent::Glink_sym_ent): Likewise.
1006         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1007         reloc when refs will resolve to plt call stub.
1008         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1009         R_PPC_PLTREL24 to resolve locally.
1010         (Target_powerpc::Scan::global): Correct ifunc handling.
1011         (Target_powerpc::Relocate::relocate): Correct local sym glink
1012         lookup.  Don't destroy "value" when we have a plt call stub,
1013         and when checking plt call validity.
1014         (Target_powerpc::do_dynsym_value): Simplify.
1015
1016 2012-10-05  Alan Modra  <amodra@gmail.com>
1017
1018         * i386.cc (Output_data_plt_i386::address_for_global,
1019         address_for_local): Add plt offset to returned value.  Adjust uses.
1020         * sparc.cc (Output_data_plt_sparc::address_for_global,
1021         address_for_local): Likewise.
1022         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1023         address_for_local): Likewise.
1024         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1025         address_for_local): Likewise.
1026         * target.h (Target::plt_address_for_global, plt_address_for_local):
1027         Update comment.
1028         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1029         (Output_data_got::Got_entry::write): Nor here.
1030         * output.h: Comment fix.
1031
1032 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1033
1034         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1035         global_offset_table_ value for larget got.
1036         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1037
1038 2012-09-29  Alan Modra  <amodra@gmail.com>
1039
1040         * powerpc.cc (Target_powerpc::iplt_): New output section.
1041         (Target_powerpc::iplt_section, make_iplt_section,
1042         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1043         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1044         Target_powerpc::plt_entry_count): Count iplt entries too.
1045         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1046         reloc section in constructor.  New params.
1047         (Target_powerpc::make_plt_section): Create reloc section here instead.
1048         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1049         functions.
1050         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1051         (Output_data_glink::add_entry, find_entry): New functions to
1052         deal with local syms.
1053         (Glink_sym_ent): Add support for local syms.
1054         (Output_data_glink::do_write): Handle ifunc plt entries.
1055         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1056         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1057         (Target_powerpc::Relocate::relocate): Likewise.
1058         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1059
1060 2012-09-25  Alan Modra  <amodra@gmail.com>
1061
1062         * object.h (Sized_relobj_file::adjust_local_symbol,
1063         do_adjust_local_symbol): New functions.
1064         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1065         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1066         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1067         and irregular opd entry spacing.
1068         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1069         (Global_symbol_visitor_opd): New functor.
1070         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1071         on deleted opd entries.
1072
1073 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1074
1075         * tilegx.cc: New file.
1076         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1077         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1078         * configure.tgt: Add entries for tilegx*.
1079         * configure.ac: Likewise.
1080         * Makefile.in: Rebuild.
1081         * configure: Likewise.
1082         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1083         tilegx.
1084
1085 2012-09-13  Alan Modra  <amodra@gmail.com>
1086
1087         * target-reloc.h (scan_relocs): Call scan.local for relocs
1088         against symbols in discarded sections.  Pass is_discarded
1089         param.
1090         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1091         Add is_discarded param.
1092         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1093         is_discarded to flag opd entry as discarded.  Don't emit dyn
1094         relocs on such entries.
1095         (Target_powerpc::Scan::global): Similarly detect and handle
1096         such opd entries.
1097         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1098         opd_ent_.  Update all uses.
1099         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1100         (Target_powerpc::relocate_section): Zero out discarded opd
1101         entry relocs.
1102
1103 2012-09-12  Ian Lance Taylor  <iant@google.com>
1104
1105         PR gold/14570
1106         * output.cc: Rename Output_data_got template parameter from size
1107         to got_size for all functions.  Compile all variants of
1108         Output_data_got.
1109         (Output_data_got::Got_entry::write): Correct use of size for
1110         symbol value.  Use local_is_tls rather than casting to
1111         Sized_relobj_file.
1112         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1113         (class Sized_relobj_file): Add do_local_is_tls.
1114         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1115
1116 2012-09-11  Alan Modra  <amodra@gmail.com>
1117
1118         PR gold/14566
1119         * layout.cc (Layout::set_segment_offsets): When using
1120         common-page-size alignment, ensure we are on a new max-page-size
1121         page.
1122         * output.cc (Output_segment::set_section_addresses): Use
1123         abi_pagesize, not common_pagesize for relro boundary.
1124         (Output_segment::set_offset): Likewise.
1125
1126 2012-09-11  Alan Modra  <amodra@gmail.com>
1127
1128         * output.h (Output_data_got::add_global_tls, add_local_tls,
1129         add_local_tls_pair): New functions.
1130         (Output_data_got::add_local_pair_with_rel): Remove second
1131         reloc param.  Expand comment.
1132         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1133         use_plt_or_tls_offset_, similarly for constructor param.
1134         (Output_data_got::Got_entry::write): Add got_index param.
1135         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1136         add_local_tls_pair): New functions.
1137         (Output_data_got::Got_entry::write): Handle tls symbols
1138         with use_plt_or_tls_offset_ set specially.
1139         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1140         (Output_data_got::do_write): Replace iterator with index, pass
1141         index to entry write function.
1142         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1143         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1144         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1145         call.
1146         * i386.cc (Target_i386::Scan::local): Likewise.
1147         * sparc.cc (Target_sparc::Scan::local): Likewise.
1148         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1149         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1150         do_tls_offset_for_global): New functions.
1151         (Target_powerpc::Scan::local): Correct TLS relocations and got
1152         entry values.
1153         (Target_powerpc::Scan::global): Don't emit unnecessary
1154         dynamic relocations on TLS GOT entries.
1155
1156 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1157
1158         * config.in: Disable sanity check for kfreebsd.
1159
1160 2012-09-10  Sterling Augustine  <saugustine@google.com>
1161
1162         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1163         (Gdb_index::pubtypes_read): New parameter.
1164         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1165         to calls.
1166         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1167         pubtypes_object_.
1168
1169 2012-09-09  Alan Modra  <amodra@gmail.com>
1170
1171         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1172         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1173         * gc.h (gc_process_relocs): Call target gc_add_reference.
1174         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1175         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1176         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1177         unnecessary cast.
1178         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1179         to cater for when we don't need code offset.  Update use.
1180         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1181         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1182         set_opd_valid): New functions.
1183         (Target_powerpc::do_gc_add_reference): New function.
1184         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1185         stashed refs.
1186         (Target_powerpc::do_gc_mark_symbol): New function.
1187
1188 2012-09-06  Cary Coutant  <ccoutant@google.com>
1189
1190         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1191         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1192         (Dwarf_die::skip_attributes): Likewise.
1193         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1194         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1195         (main): Call it.
1196         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1197
1198 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1199
1200         * testsuite/script_test_3.t: Add .got.plt output section
1201         statement.
1202         * testsuite/script_test_4.t: Likewise.
1203
1204 2012-09-05  Alan Modra  <amodra@gmail.com>
1205
1206         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1207         update all uses and lose "enum" when using type.
1208
1209 2012-09-05  Alan Modra  <amodra@gmail.com>
1210
1211         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1212         * configure: Regenerate.
1213         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1214         (plugin_final_layout.stdout): Likewise.
1215         (memory_test): Set page sizes to 0x1000.
1216         * testsuite/Makefile.in: Regenerate.
1217         * testsuite/discard_locals_test.sh: Add FIXME comment.
1218         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1219         * testsuite/pr14265.t: Add .got output section statement.
1220         * testsuite/script_test_2.t: Likewise.
1221         * testsuite/script_test_3.t: Likewise.
1222         * testsuite/script_test_4.t: Likewise.
1223         * testsuite/script_test_5.t: Likewise.
1224         * testsuite/script_test_6.t: Likewise.
1225         * testsuite/script_test_7.t: Likewise.
1226         * testsuite/script_test_9.t: Likewise.
1227
1228 2012-09-05  Alan Modra  <amodra@gmail.com>
1229
1230         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1231         (Powerpc_relocate_functions::Status): New typedef.
1232         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1233         (Target_powerpc::Scan::local): Handle REL64.
1234         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1235         for REL32 and REL64.
1236         (Target_powerpc::symval_for_branch): New function, extracted from..
1237         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1238         checks.  Report overflow errors.
1239
1240 2012-09-05  Alan Modra  <amodra@gmail.com>
1241
1242         * object.h (Sized_relobj_file::emit_relocs): Delete.
1243         (Sized_relobj_file::emit_relocs_reltype): Delete.
1244         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1245         relocate_relocs for --emit-relocs.
1246         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1247         * output.h: Update comment.
1248         (Output_segment::first_section): New function.
1249         (Output_segment::first_section_load_address): Use first_section.
1250         * output.cc (Output_segment::first_section): New function extracted..
1251         (Output_segment::first_section_load_address): ..from here.  Delete.
1252         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1253         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1254         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1255         adjust call to target.h function.
1256         * i386.cc (Target_i386): Likewise.
1257         * sparc.cc (Target_sparc): Likewise.
1258         * x86_64.cc (Target_x86_64): Likewise.
1259         * powerpc.cc (Target_powerpc): Likewise.
1260         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1261         first tls section has section symbol for optimised local dynamic
1262         output relocs.
1263         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1264         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1265         optimised tls code.
1266         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1267         Rename to relocate_relocs.  Update error message.
1268
1269 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1270
1271         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1272         --just-symbols.
1273
1274 2012-08-31  Alan Modra  <amodra@gmail.com>
1275
1276         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1277         (Powerpc_relobj::toc_base_offset): New stub function.
1278         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1279         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1280         (Target_powerpc::Relocate::enum skip_tls): New.
1281         (Target_powerpc::call_tls_get_addr_): New var.
1282         (Target_powerpc::is_branch_reloc): Move to file scope.
1283         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1284         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1285         New functions.
1286         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1287         (powerpc_info): Correct common_pagesize for ppc64.
1288         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1289         (Powerpc_relocate_functions): Add overflow check enums and functions.
1290         Add non-shift version of rela, rela_ua.  Delete all rel public
1291         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1292         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1293         addr16_ha3, addr14 functions.
1294         (Output_data_got_powerpc::add_constant_pair): New function.
1295         (Output_data_got_powerpc::got_base_offset): Likewise.
1296         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1297         (instruction constants): Sort, add some more.
1298         (Output_data_glink::do_write): Add and use Address typedef.  Use
1299         object->toc_base_offset() stub for 64-bit.
1300         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1301         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1302         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1303         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1304         Always treat .opd relocs as against locally defined symbol.
1305         Correct condition for RELATIVE relocs.
1306         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1307         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1308         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1309         calculations.  Handle TLS relocs, and more.  Add overflow
1310         checking and adjust for Powerpc_relocate_functions changes.
1311         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1312         Reinstate --emit-relocs code with FIXME.
1313
1314 2012-08-30  Alan Modra  <amodra@gmail.com>
1315
1316         * layout.cc (Layout::set_segment_offsets): Set p_align to
1317         abi_pagesize, not common_pagesize.
1318         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1319         to determine whether file header can go in segment.
1320
1321 2012-08-30  Alan Modra  <amodra@gmail.com>
1322
1323         * output.h (Output_reloc::Output_reloc <output section>): Add
1324         is_relative param.  Adjust calls.
1325         (Output_reloc::add_output_section_relative): New functions.
1326         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1327         is_relative.
1328         (Output_reloc::symbol_value): Handle SECTION_CODE.
1329
1330 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1331
1332         * gold.cc (queue_middle_tasks): Call layout again when unique
1333         segments for sections is desired.
1334         * layout.cc (Layout::Layout): Initialize new members.
1335         (Layout::get_output_section_flags): New function.
1336         (Layout::choose_output_section): Call get_output_section_flags.
1337         (Layout::layout): Make output section for mapping to a unique segment.
1338         (Layout::insert_section_segment_map): New function.
1339         (Layout::attach_allocated_section_to_segment): Make unique segment for
1340         output sections marked so.
1341         (Layout::segment_precedes): Check for unique segments when sorting.
1342         * layout.h (Layout::Unique_segment_info): New struct.
1343         (Layout::Section_segment_map): New typedef.
1344         (Layout::insert_section_segment_map): New function.
1345         (Layout::get_output_section_flags): New function.
1346         (Layout::is_unique_segment_for_sections_specified): New function.
1347         (Layout::set_unique_segment_for_sections_specified): New function.
1348         (Layout::unique_segment_for_sections_specified_): New member.
1349         (Layout::section_segment_map_): New member.
1350         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1351         Rename is_gc_pass_one to is_pass_one.
1352         Rename is_gc_pass_two to is_pass_two.
1353         Rename is_gc_or_icf to is_two_pass.
1354         Check for which pass based on whether symbols data is present.
1355         Make it two pass when unique segments for sections is desired.
1356         * output.cc (Output_section::Output_section): Initialize new
1357         members.
1358         * output.h (Output_section::is_unique_segment): New function.
1359         (Output_section::set_is_unique_segment): New function.
1360         (Output_section::is_unique_segment_): New member.
1361         (Output_section::extra_segment_flags): New function.
1362         (Output_section::set_extra_segment_flags): New function.
1363         (Output_section::extra_segment_flags_): New member.
1364         (Output_section::segment_alignment): New function.
1365         (Output_section::set_segment_alignment): New function.
1366         (Output_section::segment_alignment_): New member.
1367         (Output_segment::Output_segment): Initialize is_unique_segment_.
1368         (Output_segment::is_unique_segment): New function.
1369         (Output_segment::set_is_unique_segment): New function.
1370         (Output_segment::is_unique_segment_): New member.
1371         * plugin.cc (allow_unique_segment_for_sections): New function.
1372         (unique_segment_for_sections): New function.
1373         (Plugin::load): Add new functions to transfer vector.
1374         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1375         * Makefile.in: Regenerate.
1376         * testsuite/plugin_final_layout.sh: Check if unique segment
1377         functionality works.
1378         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1379         are available.
1380         (allow_unique_segment_for_sections): New global.
1381         (unique_segment_for_sections): New global.
1382         (claim_file_hook): Call allow_unique_segment_for_sections.
1383         (all_symbols_read_hook): Call unique_segment_for_sections.
1384
1385 2012-08-22  Cary Coutant  <ccoutant@google.com>
1386
1387         * layout.cc (Layout::include_section): Don't assert on GROUP
1388         sections with --emit-relocs.
1389
1390 2012-08-21  Cary Coutant  <ccoutant@google.com>
1391
1392         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1393         if --export-dynamic-symbol names an undef symbol.
1394
1395 2012-08-18  Alan Modra  <amodra@gmail.com>
1396
1397         * powerpc.cc: Formatting and white space.
1398         (Powerpc_relobj): Rename got2_section_ to special_.
1399         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1400         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1401         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1402         (Target_powerpc): Add Address typedef and invalid_address.  Use
1403         throughout.
1404         (Target_powerpc::is_branch_reloc): New function.
1405         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1406         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1407         for dst_mask, value and addend.
1408         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1409         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1410         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1411         uint16_t for 24-bit offset.  Use get_output_section_offset and
1412         check return.
1413         (Target_powerpc::Scan::local): Handle more relocs.
1414         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1415         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1416         Plug in toc restoring insn after plt calls.  Translate branches
1417         to function descriptor symbols to corresponding entry point.
1418         (Target_powerpc::relocate_for_relocatable): Check return from
1419         get_output_section_offset.
1420         * symtab.h: Comment typo.
1421
1422 2012-08-14  Ian Lance Taylor  <iant@google.com>
1423
1424         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1425         unsupported_relocal_local to call unsupported_reloc_global.
1426
1427 2012-08-14  Nick Clifton  <nickc@redhat.com>
1428
1429         PR ld/14265
1430         * script-sections.cc (Sections_element::output_section_name): Add
1431         keep return parameter.
1432         (Output_section_element::match_name): Add keep return parameter.
1433         Return the value of the keep_ member.
1434         * script-sections.h (class Output_section): Update
1435         output_section_name prototype.
1436         * layout.cc (Layout::keep_input_section): New public member
1437         function.
1438         (Layout::choose_output_section): Pass keep parameter to
1439         output_section_name.
1440         * layout.h (class Layout): Add keep_input_section.
1441         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1442         sections.
1443         * testsuite/Makefile.am: Add a test.
1444         * testsuite/Makefile.in: Regenerate.
1445         * testsuite/pr14265.c: Source file for the test.
1446         * testsuite/pr14265.t: Linker script for the test.
1447         * testsuite/pr14265.sh: Shell script for the test.
1448
1449 2012-08-14  Alan Modra  <amodra@gmail.com>
1450
1451         * target.h (Target::output_section_name): New function.
1452         (Target::do_output_section_name): New function.
1453         * layout.cc (Layout::choose_output_section): Call the above.
1454         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1455
1456 2012-08-14  Alan Modra  <amodra@gmail.com>
1457
1458         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1459         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1460         for replace_constant call.
1461         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1462         (Output_data_glink::do_print_to_mapfile): New function.
1463         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1464         (Target_powerpc::Relocate::relocate): Likewise.
1465
1466 2012-08-14  Alan Modra  <amodra@gmail.com>
1467
1468         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1469         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1470         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1471         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1472         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1473         here.
1474         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1475         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1476         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1477         here.
1478         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1479         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1480
1481 2012-08-12  Alan Modra  <amodra@gmail.com>
1482
1483         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1484         (glink insn constants): Use uint32_t.
1485         (Output_data_glink::add_entry): Use insert, not [] operator.
1486
1487 2012-08-11  Alan Modra  <amodra@gmail.com>
1488
1489         * object.h (Sized_relobj_file::find_shdr): New function.
1490         (Sized_relobj_file::find_special_sections): New function.
1491         * object.cc (Sized_relobj_file::find_shdr): New function.
1492         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1493         (Sized_relobj_file::find_special_sections): New function, split out..
1494         (Sized_relobj_file::do_read_symbols): ..from here.
1495         * output.h (Output_data_got::replace_constant): New function.
1496         (Output_data_got::num_entries): New function.
1497         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1498         (Output_data_got::got_offset): Protected rather than private.
1499         (Output_data_got::replace_got_entry): New function.
1500         * output.cc (Output_data_got::replace_got_entry): New function.
1501         * powerpc.cc (class Powerpc_relobj): New.
1502         (class Powerpc_relocate_functions): Delete all psymval variants or
1503         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1504         Implement _ha functions using corresponding _hi function.
1505         (Powerpc_relobj::find_special_sections): New function.
1506         (Target_powerpc::do_make_elf_object): New function.
1507         (class Output_data_got_powerpc): New.
1508         (class Output_data_glink): New.
1509         (class Powerpc_scan_relocatable_reloc): New.
1510         Many more changes througout file.
1511
1512 2012-08-09  Nick Clifton  <nickc@redhat.com>
1513
1514         * po/vi.po: Updated Vietnamese translation.
1515
1516 2012-08-07  Ian Lance Taylor  <iant@google.com>
1517
1518         * layout.cc (Layout::add_target_dynamic_tags): If
1519         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1520         plt_rel.
1521
1522 2012-07-30  Nick Clifton  <nickc@redhat.com>
1523
1524         * po/gold.pot: Updated template.
1525         * po/es.po: Updated Spanish translation.
1526
1527 2012-07-18  Cary Coutant  <ccoutant@google.com>
1528
1529         PR gold/14344
1530         * configure.ac: Add check for -gpubnames support.
1531         * configure: Regenerate.
1532         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1533         support; force -gno-pubnames.
1534         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1535         support.
1536         (gdb_index_test_4): New test.
1537         * testsuite/Makefile.in: Regenerate.
1538         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1539         * testsuite/gdb_index_test_2.sh: Likewise.
1540         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1541         * testsuite/gdb_index_test_4.sh: New script.
1542         * testsuite/gdb_index_test_comm.sh: New script with common code;
1543         don't look for space after colon.
1544
1545 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1546
1547         * gold.cc (queue_middle_tasks): Update function order only after
1548         deferred objects due to plugins are processed.
1549
1550 2012-07-11  Ian Lance Taylor  <iant@google.com>
1551
1552         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1553         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1554         (Target_arm::scan_reloc_for_stub): Likewise.
1555         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1556         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1557         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1558         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1559         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1560
1561 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1562             Ian Lance Taylor  <iant@google.com>
1563
1564         PR gold/14309
1565         * configure.ac: Test whether std::tr1::hash<off_t> works.
1566         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1567         needed.
1568         * output.h (class Output_fill): Add virtual destructor.
1569         * configure, config.in: Rebuild.
1570
1571 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1572
1573         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1574
1575 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1576
1577         * plugin.cc (Plugin::load): Handle position independent executables.
1578
1579 2012-06-06  Cary Coutant  <ccoutant@google.com>
1580
1581         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1582         add .debug_macro.
1583         (lines_only_debug_sections): Likewise.
1584         (gdb_fast_lookup_sections): New static array.
1585         (is_gdb_debug_section): Rename formal parameter.
1586         (is_lines_only_debug_section): Likewise.
1587         (is_gdb_fast_lookup_section): New function.
1588         (Layout::include_section): Check for ".zdebug_" prefix; pass
1589         section name suffix to is_gdb_debug_section, et al.; check for
1590         fast-lookup sections when building .gdb_index.
1591         * options.h (--strip-debug-gdb): Update GDB version number.
1592
1593 2012-06-06  Cary Coutant  <ccoutant@google.com>
1594
1595         * configure.ac: Add check for fallocate.
1596         * configure: Regenerate.
1597         * config.in: Regenerate.
1598
1599         * options.h (class General_options): Add --mmap-output-file and
1600         --posix-fallocate options.
1601         * output.cc: (posix_fallocate): Remove; replace with...
1602         (gold_fallocate): New function.
1603         (Output_file::map_no_anonymous): Call gold_fallocate.
1604         (Output_file::map): Check --mmap-output-file option.
1605
1606 2012-06-05  Jing Yu  <jingyu@google.com>
1607
1608         * gold.h (textdomain): Add do {} to empty while(0).
1609         (bindtextdomain): Likewise.
1610
1611 2012-06-04  Cary Coutant  <ccoutant@google.com>
1612
1613         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1614         has_dynsym_index.
1615
1616 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1617
1618         * symtab.cc (Symbol_table::define_special_symbol):
1619         Initialize *poldsym to prevent uninitialized variable errors.
1620
1621 2012-05-23  Cary Coutant  <ccoutant@google.com>
1622
1623         * layout.cc (Layout::section_name_mapping): Add rules to handle
1624         exact match on .data.rel.ro.local or .data.rel.ro.
1625         (Layout::output_section_name): Check for exact matches.
1626
1627 2012-05-23  Cary Coutant  <ccoutant@google.com>
1628
1629         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1630         more carefully.
1631
1632 2012-05-22  Cary Coutant  <ccoutant@google.com>
1633
1634         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1635         object before exporting symbol.
1636
1637 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1638
1639         * testsuite/tls_test.cc: Include "config.h" first.
1640         * testsuite/tls_test_c.c: Likewise.
1641
1642 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1643             Nick Clifton  <nickc@redhat.com>
1644
1645         PR 14072
1646         * configure.in: Add check that sysdep.h has been included before
1647         any system header files.
1648         * configure: Regenerate.
1649         * config.in: Regenerate.
1650
1651 2012-05-14  Cary Coutant  <ccoutant@google.com>
1652
1653         * layout.cc (Layout::make_output_section): Mark .tdata section
1654         as RELRO.
1655         * testsuite/relro_test.cc: Add a TLS variable.
1656
1657 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1658
1659         PR gold/14091
1660         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1661         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1662         R_X86_64_64.
1663
1664 2012-05-08  Cary Coutant  <ccoutant@google.com>
1665
1666         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1667         (lines_only_debug_sections): Likewise.
1668
1669 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1670
1671         * nacl.cc: New file.
1672         * nacl.h: New file.
1673         * Makefile.am (CCFILES, HFILES): Add them.
1674         * Makefile.in: Regenerate.
1675         * i386.cc (Output_data_plt_i386_nacl): New class.
1676         (Output_data_plt_i386_nacl_exec): New class.
1677         (Output_data_plt_i386_nacl_dyn): New class.
1678         (Target_i386_nacl): New class.
1679         (Target_selector_i386_nacl): New class.
1680         (target_selector_i386): Use it instead of Target_selector_i386.
1681         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1682         (Target_x86_64_nacl): New class.
1683         (Target_selector_x86_64_nacl): New class.
1684         (target_selector_x86_64, target_selector_x32): Use it instead of
1685         Target_selector_x86_64.
1686         * arm.cc (Output_data_plt_arm_nacl): New class.
1687         (Target_arm_nacl): New class.
1688         (Target_selector_arm_nacl): New class.
1689         (target_selector_arm, target_selector_armbe): Use it instead of
1690         Target_selector_arm.
1691
1692         * target-select.cc (select_target): Take new Input_file* and off_t
1693         arguments, pass them on to recognize method of selector.
1694         * object.cc (make_elf_sized_object): Update caller.
1695         * parameters.cc (parameters_force_valid_target): Likewise.
1696         * incremental.cc (make_sized_incremental_binary): Likewise.
1697         * target-select.h: Update decl.
1698         (Target_selector::recognize): Take new Input_file* argument,
1699         pass it on to do_recognize.
1700         (Target_selector::do_recognize): Take new Input_file* argument.
1701         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1702         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1703         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1704         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1705
1706         * target.h (Target::Target_info): New members isolate_execinstr
1707         and rosegment_gap.
1708         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1709         * arm.cc (Target_arm::arm_info): Update initializer.
1710         * i386.cc (Target_i386::i386_info): Likewise.
1711         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1712         * sparc.cc (Target_sparc::sparc_info): Likewise.
1713         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1714         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1715         * layout.cc (Layout::attach_allocated_section_to_segment):
1716         Take new const Target* argument.  If target->isolate_execinstr(), act
1717         like --rosegment.
1718         (Layout::find_first_load_seg): Take new const Target* argument;
1719         if target->isolate_execinstr(), reject PF_X segments.
1720         (Layout::relaxation_loop_body): Update caller.
1721         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1722         reset file offset to zero when we hit LOAD_SEG, and then do a second
1723         loop over the segments before LOAD_SEG to reassign offsets after
1724         addresses have been determined.  Handle target->rosegment_gap().
1725         (Layout::attach_section_to_segment): Take new const Target* argument;
1726         pass it to attach_allocated_section_to_segment.
1727         (Layout::make_output_section): Update caller.
1728         (Layout::attach_sections_to_segments): Take new const Target* argument;
1729         pass it to attach_section_to_segment.
1730         * gold.cc (queue_middle_tasks): Update caller.
1731         * layout.h (Layout): Update method decls with new arguments.
1732
1733         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1734         Target_info pointer to use.
1735         (Target_arm::do_make_data_plt): New virtual method.
1736         (Target_arm::make_data_plt): New method that calls it.
1737         (Target_arm::make_plt_entry): Use it.
1738         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1739         for the section alignment.
1740         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1741         method.
1742         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1743         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1744         method.
1745         (Output_data_plt_arm::get_plt_entry_size): Call it.
1746         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1747         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1748         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1749         method.
1750         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1751         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1752         method instead of sizeof(plt_entry).
1753         (Output_data_plt_arm::add_entry): Likewise.
1754         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1755         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1756         than static method.
1757         (Target_arm::plt_entry_size): Likewise.
1758         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1759         Move to ...
1760         (Output_data_plt_arm_standard): ... here, new class.
1761         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1762         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1763         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1764
1765         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1766         Take additional argument for the PLT entry size.
1767         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1768         Use get_plt_entry_size method rather than plt_entry_size variable.
1769         (Output_data_plt_x86_64::reserve_slot): Likewise.
1770         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1771         (Output_data_plt_x86_64::add_entry): Likewise.
1772         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1773         (Output_data_plt_x86_64::address_for_global): Likewise.
1774         (Output_data_plt_x86_64::address_for_local): Likewise.
1775         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1776         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1777         Make method non-static.
1778         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1779         method.
1780         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1781         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1782         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1783         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1784         virtual method.
1785         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1786         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1787         virtual method.
1788         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1789         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1790         virtual method.
1791         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1792         (Output_data_plt_x86_64::plt_entry_size)
1793         (Output_data_plt_x86_64::first_plt_entry)
1794         (Output_data_plt_x86_64::plt_entry)
1795         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1796         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1797         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1798         (Output_data_plt_x86_64_standard): ... here, new class.
1799         (Target_x86_64::Target_x86_64): Take optional argument for the
1800         Target_info pointer to use.
1801         (Target_x86_64::do_make_data_plt): New virtual method.
1802         (Target_x86_64::make_data_plt): New method to call it.
1803         (Target_x86_64::init_got_plt_for_update): Use that.
1804         Call this->plt_->add_eh_frame method here.
1805         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1806         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1807         rather than static method.
1808         (Target_x86_64::plt_entry_size): Likewise.
1809         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1810         rather than plt_entry_size variable.  Move guts of PLT filling to...
1811         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1812         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1813         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1814
1815         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1816         additional argument for the section alignment.
1817         Don't do add_eh_frame_for_plt here.
1818         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1819         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1820         variable.
1821         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1822         method.
1823         (Output_data_plt_i386::get_plt_entry_size): Call it.
1824         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1825         (Output_data_plt_i386::add_eh_frame): New method to call it.
1826         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1827         method.
1828         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1829         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1830         method.
1831         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1832         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1833         method instead of plt_entry_size.
1834         (Output_data_plt_i386::plt_entry_size)
1835         (Output_data_plt_i386::plt_eh_frame_fde_size)
1836         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1837         (Output_data_plt_i386_standard): ... here, new class.
1838         (Output_data_plt_i386_exec): New class.
1839         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1840         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1841         (Output_data_plt_i386::exec_plt_entry): Move to ...
1842         (Output_data_plt_i386_exec::plt_entry): ... here.
1843         (Output_data_plt_i386_dyn): New class.
1844         (Output_data_plt_i386::first_plt_entry): Move to ...
1845         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1846         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1847         (Output_data_plt_i386_dyn::plt_entry): ... here.
1848         (Target_i386::Target_i386): Take optional argument for the Target_info
1849         pointer to use.
1850         (Target_i386::do_make_data_plt): New virtual method.
1851         (Target_i386::make_data_plt): New method to call it.
1852         (Target_i386::make_plt_section): Use that.
1853         Call this->plt_->add_eh_frame method here.
1854         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1855         rather than plt_entry_size variable.
1856         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1857         (Output_data_plt_i386::address_for_local): Likewise.
1858         (Output_data_plt_i386::do_write): Likewise.
1859         Move guts of PLT filling to...
1860         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1861         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1862         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1863         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1864
1865 2012-05-01  Cary Coutant  <ccoutant@google.com>
1866
1867         * dwarf_reader.cc (Dwarf_die::read_attributes)
1868         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1869         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1870         * reduced_debug_output.cc
1871         (Output_reduced_debug_info_section::get_die_end): Remove
1872         DW_FORM_GNU_ref_index.  Add default case.
1873
1874 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1875
1876         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1877         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1878         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1879         DW_AT_high_pc as offset from DW_AT_low_pc.
1880
1881         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1882         * testsuite/Makefile.in: Regenerate.
1883         * testsuite/gdb_index_test_3.c: New test source file.
1884         * testsuite/gdb_index_test_3.sh: New test source file.
1885
1886 2012-04-25  Ian Lance Taylor  <iant@google.com>
1887
1888         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1889         pointer.
1890         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1891         as a class, not a struct.
1892         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1893         (Target_arm::apply_cortex_a8_workaround): Likewise.
1894         * gc.h: Declare Reloc_types as a struct, not a class.
1895         * object.h: Declare Symbols_data as a struct.
1896         * reloc.h: Declare Read_relocs_data as a struct.
1897         * target.h: Declare Relocate_info as a struct.
1898
1899 2012-04-24  David S. Miller  <davem@davemloft.net>
1900
1901         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1902         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1903         and R_SPARC_WPLT30.
1904
1905 2012-04-24  Cary Coutant  <ccoutant@google.com>
1906
1907         * incremental-dump.cc (find_input_containing_global): Replace
1908         magic number with symbolic constant.
1909         (dump_incremental_inputs): Update version number.
1910         * incremental.cc (Output_section_incremental_inputs): Update version
1911         number; import symbolic constants from Incremental_inputs_reader.
1912         (Incremental_inputs::create_data_sections): Align relocations
1913         section correctly for 64-bit targets.
1914         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1915         constants; add padding.
1916         (Output_section_incremental_inputs::write_header): Add assert for
1917         header_size.
1918         (Output_section_incremental_inputs::write_input_files): Add assert
1919         for input_entry_size.
1920         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1921         add assert for object_info_size, input_section_entry_size,
1922         global_sym_entry_size.
1923         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1924         for data structure sizes; use them.
1925         (Incremental_input_entry_reader): Import symbolic constants from
1926         Incremental_inputs_reader; use them.
1927
1928 2012-04-23  David S. Miller  <davem@davemloft.net>
1929
1930         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1931         and elf_flags_set_.
1932         (Target_sparc::Target_sparc): Initialize new fields.
1933         (Target_sparc::do_make_elf_object): New function.
1934         (Target_sparc::do_adjust_elf_header): New function.
1935
1936 2012-04-23  Cary Coutant  <ccoutant@google.com>
1937
1938         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1939         CU range table of gdb index.
1940
1941 2012-04-20  David S. Miller  <davem@davemloft.net>
1942
1943         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1944         instead of false.
1945
1946 2012-04-16  David S. Miller  <davem@davemloft.net>
1947
1948         * sparc.cc (Target_sparc::got_address): New function.
1949         (Sparc_relocate_functions::gdop_hix22): New function.
1950         (Sparc_relocate_functions::gdop_lox10): New function.
1951         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1952         relocs.
1953         (Target_sparc::Scan::local): Likewise if the global symbol is not
1954         preemptible and is not IFUNC.
1955         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1956         transformations for local and non-preemptible non-IFUNC global
1957         symbols.
1958
1959         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1960         writing out 64-bit part of ranges.
1961
1962         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1963         -fpic and -fpie respectively.
1964         * Makefile.in: Regenerate.
1965
1966         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1967         (Target_sparc::Target_sparc): Initialize new field.
1968         (Target_sparc::do_plt_section_for_global): New function.
1969         (Target_sparc::do_plt_section_for_local): New function.
1970         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1971         (Target_sparc::make_plt_section): New function, broken out of
1972         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1973         (Target_sparc::make_plt_entry): Call make_plt_section.
1974         (Target_sparc::make_local_ifunc_plt_entry): New function.
1975         (Target_sparc::rela_ifunc_section): New function.
1976         (Target_sparc::plt_section): Remove const.
1977         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1978         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1979         and ifunc_count_ fields.
1980         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1981         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1982         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1983         (Output_data_plt_sparc::rela_ifunc): New function.
1984         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1985         (Output_data_plt_sparc::has_ifunc_section): New function.
1986         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1987         (Output_data_plt_sparc::address_for_global): New function.
1988         (Output_data_plt_sparc::address_for_local): New function.
1989         (Output_data_plt_sparc::plt_index_to_offset): New function.
1990         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1991         and entry_count.
1992         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1993         entry_count.
1994         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1995         R_SPARC_JMP_IREL to switch.
1996         (Target_sparc::Scan::check_non_pic): Likewise.
1997         (Target_sparc::Scan::local): Handle IFUNC symbols.
1998         (Target_sparc::Scan::local): Likewise.
1999         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2000         and plt_address_for_local.
2001         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2002         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2003
2004         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2005         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2006         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2007         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2008         global relocs too.
2009         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2010         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2011         calls.
2012         * sparc.cc (Target_sparc::Scan::global): Likewise.
2013         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2014
2015 2012-04-16  Cary Coutant  <ccoutant@google.com>
2016
2017         * archive.cc (Library_base::should_include_member): Check for
2018         --export-dynamic-symbol.
2019         * options.h (class General_options): Add --export-dynamic-symbol.
2020         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2021         --export-dynamic-symbol.
2022         (Symbol_table::gc_mark_undef_symbols): Likewise.
2023         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2024
2025 2012-04-12  David S. Miller  <davem@davemloft.net>
2026
2027         * sparc.cc (Reloc::wdisp10): New relocation method.
2028         (Reloc::h34): Likewise.
2029         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2030         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2031         R_SPARC_WDISP10.
2032         (Target_sparc::Scan::local): Likewise.
2033         (Target_sparc::Scan::global): Likewise.
2034         (Target_sparc::Relocate::relocate): Likewise.
2035
2036 2012-04-09  Cary Coutant  <ccoutant@google.com>
2037
2038         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2039         low_pc == 0.
2040
2041 2012-04-06  Ian Lance Taylor  <iant@google.com>
2042
2043         * timer.cc: #include <unistd.h>.
2044
2045 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2046
2047         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2048         * config.in: Regenerate.
2049         * configure: Regenerate.
2050
2051 2012-04-05  Nick Clifton  <nickc@redhat.com>
2052
2053         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2054         (AM_LC_MESSAGES): Add.
2055         * aclocal.m4: Regenerate.
2056         * config.in: Regenerate.
2057         * configure: Regenerate.
2058
2059 2012-03-21  Cary Coutant  <ccoutant@google.com>
2060
2061         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2062         * Makefile.in: Regenerate.
2063         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2064         (Sized_elf_reloc_mapper::symbol_section): New function.
2065         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2066         (make_elf_reloc_mapper): New function.
2067         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2068         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2069         (Dwarf_abbrev_table::do_get_abbrev): New function.
2070         (Dwarf_ranges_table::read_ranges_table): New function.
2071         (Dwarf_ranges_table::read_range_list): New function.
2072         (Dwarf_pubnames_table::read_section): New function.
2073         (Dwarf_pubnames_table::read_header): New function.
2074         (Dwarf_pubnames_table::next_name): New function.
2075         (Dwarf_die::Dwarf_die): New function.
2076         (Dwarf_die::read_attributes): New function.
2077         (Dwarf_die::skip_attributes): New function.
2078         (Dwarf_die::set_name): New function.
2079         (Dwarf_die::set_linkage_name): New function.
2080         (Dwarf_die::attribute): New function.
2081         (Dwarf_die::string_attribute): New function.
2082         (Dwarf_die::int_attribute): New function.
2083         (Dwarf_die::uint_attribute): New function.
2084         (Dwarf_die::ref_attribute): New function.
2085         (Dwarf_die::child_offset): New function.
2086         (Dwarf_die::sibling_offset): New function.
2087         (Dwarf_info_reader::check_buffer): New function.
2088         (Dwarf_info_reader::parse): New function.
2089         (Dwarf_info_reader::do_parse): New function.
2090         (Dwarf_info_reader::do_read_string_table): New function.
2091         (Dwarf_info_reader::lookup_reloc): New function.
2092         (Dwarf_info_reader::get_string): New function.
2093         (Dwarf_info_reader::visit_compilation_unit): New function.
2094         (Dwarf_info_reader::visit_type_unit): New function.
2095         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2096         Sized_elf_reloc_mapper.
2097         (Sized_dwarf_line_info::symbol_section): Remove function.
2098         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2099         (Sized_dwarf_line_info::read_line_mappings): Remove object
2100         parameter, adjust callers.
2101         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2102         * dwarf_reader.h: Include <sys/types.h>.
2103         (class Track_relocs): Remove forward declaration.
2104         (class Elf_reloc_mapper): New class.
2105         (class Sized_elf_reloc_mapper): New class.
2106         (class Dwarf_abbrev_table): New class.
2107         (class Dwarf_range_list): New class.
2108         (class Dwarf_ranges_table): New class.
2109         (class Dwarf_pubnames_table): New class.
2110         (class Dwarf_die): New class.
2111         (class Dwarf_info_reader): New class.
2112         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2113         (Sized_dwarf_line_info::symbol_section): Remove member function.
2114         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2115         base class.
2116         * gdb-index.cc: New source file.
2117         * gdb-index.h: New source file.
2118         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2119         and .debug_types sections, call Layout::add_to_gdb_index.
2120         (Sized_relobj_incr::do_section_name): Implement.
2121         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2122         return type; Implement.
2123         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2124         return type.
2125         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2126         parameter list and return type.
2127         (Sized_incr_dynobj::do_section_contents): Likewise.
2128         * layout.cc: Include gdb-index.h.
2129         (Layout::Layout): Initialize gdb_index_data_.
2130         (Layout::init_fixed_output_section): Check for .gdb_index section.
2131         (Layout::add_to_gdb_index): New function. Instantiate.
2132         * layout.h: Add forward declaration for class Gdb_index.
2133         (Layout::add_to_gdb_index): New member function.
2134         (Layout::gdb_index_data_): New data member.
2135         * main.cc: Include gdb-index.h.
2136         (main): Print statistics for gdb index.
2137         * object.cc (Object::section_contents): Move code into
2138         do_section_contents.
2139         (need_decompressed_section): Check for sections needed when building
2140         gdb index.
2141         (build_compressed_section_map): Likewise.
2142         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2143         gdb index.
2144         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2145         sections; call Layout::add_to_gdb_index.
2146         (Sized_relobj_file::do_decompressed_section_contents): Call
2147         do_section_contents directly.
2148         * object.h (Object::do_section_contents): Adjust parameter list and
2149         return type.
2150         (Object::do_decompressed_section_contents): Call do_section_contents
2151         directly.
2152         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2153         return type.
2154         * options.h (class General_options): Add --gdb-index option.
2155         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2156         list and return type.
2157         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2158         * reloc.h (Track_relocs::checkpoint): New function.
2159         (Track_relocs::reset): New function.
2160
2161         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2162         New test cases.
2163         * testsuite/Makefile.in: Regenerate.
2164         * testsuite/gdb_index_test.cc: New test source file.
2165         * testsuite/gdb_index_test_1.sh: New test source file.
2166         * testsuite/gdb_index_test_2.sh: New test source file.
2167
2168 2012-03-19  Doug Kwan  <dougkwan@google.com>
2169
2170         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2171         (Target_arm::do_finalize_sections): Remove code which defines
2172         __exidx_start and __exidx_end.  Make symbol table parameter
2173         anonymous as it is not used.
2174         * gold.cc (queue_middle_tasks): Call target hook to define any
2175         target-specific symbols.
2176         * target.h (Target::define_standard_symbols): New method.
2177         (Target::do_define_standard_symbols): Same.
2178         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2179         * testsuite/Makefile.in: Regenerate.
2180         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2181         and __exidx_end.
2182         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2183         relocations are generated for __exidx_start and __exidx_end.
2184
2185 2012-03-16  Doug Kwan  <dougkwan@google.com>
2186
2187         * testsuite/Makefile.am: Disable test initpri3b.
2188         * testsuite/Makefile.in: Regenerate.
2189
2190 2012-03-15  Doug Kwan  <dougkwan@google.com>
2191
2192         * arm.cc (Target_arm::got_section): Make .got section read-only
2193         if -z now is given.
2194
2195 2012-03-15  Ian Lance Taylor  <iant@google.com>
2196
2197         PR gold/13850
2198         * layout.cc (Layout::make_output_section): Correctly mark
2199         SHT_INIT_ARRAY, et. al., as relro.
2200
2201 2012-03-14  Doug Kwan  <dougkwan@google.com>
2202
2203         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2204         dynamic relocations for protected symbols in shared objects.
2205
2206 2012-03-13  Ian Lance Taylor  <iant@google.com>
2207
2208         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2209         keep the larger alignment.
2210
2211 2012-03-12  Cary Coutant  <ccoutant@google.com>
2212
2213         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2214         handling of DW_LNE_define_file.
2215
2216 2012-03-12  Cary Coutant  <ccoutant@google.com>
2217
2218         * reduced_debug_output.cc
2219         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2220         codes to switch.
2221
2222 2012-02-29  Cary Coutant  <ccoutant@google.com>
2223
2224         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2225
2226 2012-02-29  Cary Coutant  <ccoutant@google.com>
2227
2228         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2229         Call Object::decompressed_section_contents.
2230         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2231         New dtor.
2232         (Sized_dwarf_line_info::buffer_start_): New data member.
2233         * merge.cc (Output_merge_data::do_add_input_section): Call
2234         Object::decompressed_section_contents.
2235         (Output_merge_string::do_add_input_section): Likewise.
2236         * object.cc (need_decompressed_section): New function.
2237         (build_compressed_section_map): Decompress sections needed later.
2238         (Sized_relobj_file::do_decompressed_section_contents): New function.
2239         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2240         * object.h (Object::decompressed_section_contents): New function.
2241         (Object::discard_decompressed_sections): New function.
2242         (Object::do_decompressed_section_contents): New function.
2243         (Object::do_discard_decompressed_sections): New function.
2244         (Compressed_section_info): New type.
2245         (Compressed_section_map): Include decompressed section contents.
2246         (Sized_relobj_file::do_decompressed_section_contents): New function.
2247         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2248
2249 2012-02-16  Cary Coutant  <ccoutant@google.com>
2250
2251         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2252         * testsuite/Makefile.in: Regenerate.
2253
2254 2012-02-14  Cary Coutant  <ccoutant@google.com>
2255
2256         * options.cc (General_options::finalize): Disallow -pie and -static.
2257
2258 2012-02-03  Doug Kwan  <dougkwan@google.com>
2259
2260         * arm.cc (Arm_relocate_functions::abs8,
2261         Arm_relocate_functions::abs16): Use
2262         Bits::has_signed_unsigned_overflow32.
2263         (Arm_relocate_functions::thm_abs8): Correct range of
2264         overflow check.
2265         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2266         in assertions.
2267
2268 2012-02-02  Doug Kwan  <dougkwan@google.com>
2269
2270         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2271         position independent outputs, not just shared objects.
2272
2273 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2274
2275         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2276         * configure: Regenerated.
2277
2278 2012-01-27  Ian Lance Taylor  <iant@google.com>
2279
2280         * reloc.h (Bits): New class with static functions, copied from
2281         namespace utils in arm.cc.
2282         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2283         instead.
2284
2285 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2286
2287         * incremental.cc (write_info_blocks): Correct relocation offset.
2288
2289 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2290
2291         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2292         (Relocate::tls_gd_to_le): Likewise.
2293
2294 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2295
2296         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2297
2298 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2299
2300         * configure.ac: Check if -mcmodel=medium works.
2301         * configure: Regenerated.
2302
2303 2012-01-24  Cary Coutant  <ccoutant@google.com>
2304
2305         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2306         definition and ...
2307         (read_unsigned_LEB_128_x): ... this new function.
2308         (read_signed_LEB_128): Replaced with inline definition and ...
2309         (read_signed_LEB_128_x): ... this new function.
2310         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2311         (read_unsigned_LEB_128): Add inline definition.
2312         (read_signed_LEB_128_x): New function.
2313         (read_signed_LEB_128): Add inline definition.
2314         * testsuite/Makefile.am (leb128_unittest): New unit test.
2315         * testsuite/Makefile.in: Regenerate.
2316         * testsuite/leb128_unittest.cc: New unit test.
2317
2318 2012-01-23  Ian Lance Taylor  <iant@google.com>
2319
2320         PR gold/13617
2321         * i386.cc (Target_i386::do_code_fill): When using a jmp
2322         instruction, pad with nop instructions.
2323         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2324
2325 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2326
2327         * x86_64.cc (gc_process_relocs): Add typename on types used in
2328         template.
2329         (scan_relocs): Likewise.
2330         (relocate_section): Likewise.
2331         (apply_relocation): Likewise.
2332
2333 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2334
2335         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2336         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2337         under x32.
2338
2339 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2340
2341         * x86_64.cc: Initial support for x32.
2342
2343 2012-01-03  Cary Coutant  <ccoutant@google.com>
2344
2345         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2346         Use abstract base class for GOT.
2347         * gold/output.h (class Output_data_got_base): New abstract base class.
2348         (class Output_data_got): Derive from new base class, adjust ctors.
2349         (Output_data_got::reserve_slot): Make virtual; rename to
2350         do_reserve_slot; Adjust callers.
2351         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2352         pointer to abstract base class.
2353         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2354
2355 2011-12-18  Ian Lance Taylor  <iant@google.com>
2356
2357         * object.h (Relobj::local_symbol_value): New function.
2358         (Relobj::local_plt_offset): New function.
2359         (Relobj::local_has_got_offset): New function.
2360         (Relobj::local_got_offset): New function.
2361         (Relobj::set_local_got_offset): New function.
2362         (Relobj::do_local_symbol_value): New pure virtual function.
2363         (Relobj::do_local_plt_offset): Likewise.
2364         (Relobj::do_local_has_got_offset): Likewise.
2365         (Relobj::do_local_got_offset): Likewise.
2366         (Relobj::do_set_local_got_offset): Likewise.
2367         (Sized_relobj::do_local_has_got_offset): Rename from
2368         local_has_got_offset.
2369         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2370         (Sized_relobj::do_set_local_got_offset): Rename from
2371         set_local_got_offset.
2372         (Sized_relobj_file::do_local_plt_offset): Rename from
2373         local_plt_offset.
2374         (Sized_relobj_file::do_local_symbol_value): New function.
2375         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2376         local_plt_offset.
2377         * output.cc (Output_data_got::Got_entry::write): Change object to
2378         Relobj.  Use local_symbol_value.
2379         (Output_data_got::add_global_with_rel): Change rel_dyn to
2380         Output_data_reloc_generic*.  Use add_global_generic.
2381         (Output_data_got::add_global_with_rela): Remove.  Change all
2382         callers to use add_global_with_rel.
2383         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2384         Output_data_reloc_generic*.  Use add_global_generic.
2385         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2386         callers to use add_global_pair_with_rel.
2387         (Output_data_got::add_local): Change object to Relobj*.
2388         (Output_data_got::add_local_plt): Likewise.
2389         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2390         change rel_dyn to Output_data_reloc_generic*.  Use
2391         add_local_generic.
2392         (Output_data_got::add_local_with_rela): Remove.  Change all
2393         callers to use all_local_with_rel.
2394         (Output_data_got::add_local_pair_with_rel): Change object to
2395         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2396         add_output_section_generic.
2397         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2398         callers to use add_local_pair_with_rel.
2399         (Output_data_got::reserve_local): Change object to Relobj*.
2400         * output.h: (class Output_data_reloc_generic): Add pure virtual
2401         declarations for add_global_generic, add_local_generic,
2402         add_output_section_generic.
2403         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2404         functions for Output_data_reloc_generic.  Update declarations for
2405         changes listed in output.cc.
2406         (class Output_data_got): Change template parameter to got_size.
2407         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2408         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2409         function.
2410         (Sized_relobj_incr::do_local_plt_offset): New function.
2411         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2412         add_global_generic.
2413
2414 2011-12-17  Cary Coutant  <ccoutant@google.com>
2415
2416         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2417         * resolve.cc (Symbol_table::resolve): Likewise.
2418         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2419         arrays.
2420         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2421
2422 2011-12-16  Ian Lance Taylor  <iant@google.com>
2423
2424         * output.h (Output_data_reloc_generic::add): Only call
2425         add_dynamic_reloc if this is a dynamic reloc section.
2426
2427 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2428
2429         PR gold/13505
2430         * target-reloc.h (apply_relocation): Replace <64, false> with
2431         <size, big_endian>.
2432
2433 2011-11-25  Nick Clifton  <nickc@redhat.com>
2434
2435         * po/it.po: New Italian translation.
2436
2437 2011-11-17  Sterling Augustine  <saugustine@google.com>
2438
2439         * script.cc (script_include_directive): Implement.
2440         (read_script_file): New local variables name and search_path. Update
2441         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2442         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2443         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2444
2445 2011-11-11  Sterling Augustine  <saugustine@google.com>
2446
2447         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2448         (file_or_sections_cmd): Likewise.
2449
2450 2011-11-11  Doug Kwan  <dougkwan@google.com>
2451
2452         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2453         if --just-symbols is given.
2454
2455 2011-11-10  Doug Kwan  <dougkwan@google.com>
2456
2457         PR gold/13362
2458         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2459         when processing data relocs.
2460         * reloc.h (Relocate_functions::rel_unaligned): New method.
2461         (Relocate_functions::pcrel_unaligned): Ditto.
2462         (Relocate_functions::rel32_unaligned): Ditto.
2463         (Relocate_functions::pcrel32_unaligned): Ditto.
2464
2465 2011-11-09  Doug Kwan  <dougkwan@google.com>
2466
2467         PR gold/13362
2468         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2469         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2470         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2471         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2472         (Relocate_functions::rel_unaligned): New.
2473         (Relocate_functions::rel32_unaligned): New.
2474         * target-reloc.h (relocate_for_relocatable): Add code to handle
2475         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2476         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2477         arm_unaligned_reloc_r): New targets.
2478         * testsuite/Makefile.in: Regenerate.
2479         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2480         linking.
2481
2482 2011-11-02  Ian Lance Taylor  <iant@google.com>
2483
2484         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2485         NATIVE_LINKER.
2486         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2487         * options.cc (General_options::finalize): Use library search path
2488         from configure script if specified.  If not native and no sysroot,
2489         only search TOOLLIBDIR.
2490         * options.h (Search_directory::Search_directory): Change name to
2491         const std::string&.
2492         (General_options::add_to_library_path_with_sysroot): Change arg to
2493         const std::string&.
2494         * configure, Makefile.in, config.in: Rebuild.
2495
2496 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2497
2498         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2499         we are working around the ARM1176 Erratum.
2500         * options.h (General_options::fix_arm1176): Add option.
2501         * testsuite/Makefile.am: Add testcases, and keep current ones
2502         working.
2503         * testsuite/Makefile.in: Regenerate.
2504         * testsuite/arm_fix_1176.s: New file.
2505         * testsuite/arm_fix_1176.sh: Likewise.
2506
2507 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2508
2509         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2510         may_use_blx_.
2511         (Target_arm::may_use_blx): Remove method.
2512         (Target_arm::set_may_use_blx): Likewise.
2513         (Target_arm::may_use_v4t_interworking): New method.
2514         (Target_arm::may_use_v5t_interworking): Likewise.
2515         (Target_arm::may_use_blx_): Remove member variable.
2516         (Arm_relocate_functions::arm_branch_common): Check for v5T
2517         interworking.
2518         (Arm_relocate_functions::thumb_branch_common): Likewise.
2519         (Reloc_stub::stub_type_for_reloc): Likewise.
2520         (Target_arm::do_finalize_sections): Correct interworking checks.
2521         * testsuite/Makefile.am: Add new tests.
2522         * testsuite/Makefile.in: Regenerate.
2523         * testsuite/arm_farcall_arm_arm.s: New test.
2524         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2525         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2526         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2527         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2528         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2529         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2530         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2531
2532 2011-10-31  Cary Coutant  <ccoutant@google.com>
2533
2534         PR gold/13023
2535         * expression.cc (Expression::eval_with_dot): Add
2536         is_section_dot_assignment parameter.
2537         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2538         absolute and assigning to dot within a section.
2539         * script-sections.cc
2540         (Output_section_element_assignment::set_section_addresses): Pass
2541         dot_section to set_if_absolute.
2542         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2543         as is_section_dot_assignment flag to eval_with_dot.
2544         (Output_section_element_dot_assignment::set_section_addresses):
2545         Likewise.
2546         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2547         parameter.  Also set value if relative to dot_section; set the
2548         symbol's output_section.
2549         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2550         parameter.  Adjust all callers.
2551         (Expression::eval_maybe_dot): Likewise.
2552         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2553         Adjust all callers.
2554         * testsuite/script_test_2.t: Test assignment of an absolute value
2555         to dot within an output section element.
2556
2557 2011-10-31  Cary Coutant  <ccoutant@google.com>
2558
2559         * options.h (class General_options): Add --[no-]gnu-unique options.
2560         * symtab.cc (Symbol_table::sized_write_globals): Convert
2561         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2562
2563 2011-10-31  Cary Coutant  <ccoutant@google.com>
2564
2565         PR gold/13359
2566         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2567         unnecessary assertion.
2568         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2569
2570 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2571
2572         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2573         gc_mark_symbol.
2574         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2575         gc_mark_symbol.
2576         Change to just keep the section associated with symbol.
2577         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2578         they are externally visible and --export-dynamic is turned on.
2579         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2580
2581 2011-10-19  Ian Lance Taylor  <iant@google.com>
2582
2583         PR gold/13163
2584         * script-sections.cc
2585         (Output_section_element_dot_assignment::needs_output_section): New
2586         function.
2587
2588 2011-10-19  Ian Lance Taylor  <iant@google.com>
2589
2590         PR gold/13204
2591         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2592         --section-start option was seen.
2593         * options.h (General_options::any_section_start): New function.
2594
2595 2011-10-18  David S. Miller  <davem@davemloft.net>
2596
2597         PR binutils/13301
2598         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2599         member to track relocation locations that have moved during TLS
2600         reloc optimizations.
2601         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2602         (Target_sparc::Relocate::relocate): Adjust view down by 4
2603         bytes if it matches reloc_adjust_addr_.
2604         (Target_sparc::Relocate::relocate_tls): Always move the
2605         __tls_get_addr call delay slot instruction forward 4 bytes when
2606         performing relaxation.
2607
2608 2011-10-18  Cary Coutant  <ccoutant@google.com>
2609
2610         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2611         (Output_file::map_no_anonymous): Check for non-zero
2612         return code from posix_fallocate.
2613
2614 2011-10-17  Cary Coutant  <ccoutant@google.com>
2615
2616         PR gold/13245
2617         * plugin.cc (is_visible_from_outside): Check for symbols
2618         referenced from dynamic objects.
2619         * resolve.cc (Symbol_table::resolve): Don't count references
2620         from dynamic objects as references from real ELF files.
2621         * testsuite/plugin_test_2.sh: Adjust expected result.
2622
2623 2011-10-17  Cary Coutant  <ccoutant@google.com>
2624
2625         * gold.cc: Include timer.h.
2626         (queue_middle_tasks): Stamp time.
2627         (queue_final_tasks): Likewise.
2628         * main.cc (main): Store timer in parameters.  Print timers
2629         for each pass.
2630         * parameters.cc (Parameters::Parameters): Initialize timer_.
2631         (Parameters::set_timer): New function.
2632         (set_parameters_timer): New function.
2633         * parameters.h (Parameters::set_timer): New function.
2634         (Parameters::timer): New function.
2635         (Parameters::timer_): New data member.
2636         (set_parameters_timer): New function.
2637         * timer.cc (Timer::stamp): New function.
2638         (Timer::get_pass_time): New function.
2639         * timer.h (Timer::stamp): New function.
2640         (Timer::get_pass_time): New function.
2641         (Timer::pass_times_): New data member.
2642
2643 2011-10-17  Cary Coutant  <ccoutant@google.com>
2644
2645         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2646         task for members of lib groups.
2647
2648 2011-10-17  Cary Coutant  <ccoutant@google.com>
2649
2650         PR gold/13288
2651         * fileread.cc (File_read::find_view): Add assert.
2652         (File_read::make_view): Move bounds check (replace with assert)...
2653         (File_read::find_or_make_view): ... to here.
2654
2655 2011-10-12  Cary Coutant  <ccoutant@google.com>
2656
2657         * output.cc (Output_file::open_base_file): Handle case where
2658         ::read returns less than requested size.
2659
2660 2011-10-10  Cary Coutant  <ccoutant@google.com>
2661
2662         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2663         Initialize defined_count_.
2664         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2665         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2666         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2667         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2668         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2669         * incremental.h (Sized_relobj_incr::defined_count_): New data
2670         member.
2671         (Sized_incr_dynobj::defined_count_): New data member.
2672         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2673         Return zeroes instead of internal error.
2674
2675 2011-10-10  Cary Coutant  <ccoutant@google.com>
2676
2677         PR gold/13249
2678         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2679         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2680         * output.h (class Output_reloc): Add use_plt_offset flag.
2681         (Output_reloc::type_): Adjust size of bit field.
2682         (Output_reloc::use_plt_offset_): New bit field.
2683         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2684         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2685         flag.  Adjust all callers.
2686         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2687         creating RELATIVE relocations.
2688
2689 2011-10-10  Nick Clifton  <nickc@redhat.com>
2690
2691         * po/es.po: Updated Spanish translation.
2692         * po/fi.po: Updated Finnish translation.
2693
2694 2011-10-03   Diego Novillo  <dnovillo@google.com>
2695
2696         * options.cc (parse_uint): Fix dereference of RETVAL.
2697
2698 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2699
2700         * layout.h (section_order_map_): New member.
2701         (get_section_order_map): New member function.
2702         * output.cc (Output_section::add_input_section): Check for patterns
2703         only when --section-ordering-file is specified.
2704         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2705         output_sections have been formed.
2706         * layout.cc (Layout_Layout): Initialize section_order_map_.
2707         * plugin.cc (update_section_order): Store order in order_map. Do not
2708         update the order.
2709         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2710         * testsuite/Makefile.in: Regenerate.
2711         * testsuite/plugin_section_order.c: New file.
2712         * testsuite/plugin_final_layout.cc: New file.
2713         * testsuite/plugin_final_layout.sh: New file.
2714
2715 2011-09-29  Cary Coutant  <ccoutant@google.com>
2716
2717         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2718         Check for NULL.
2719         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2720         symbols during incremental update.
2721         (Symbol_table::add_from_dynobj): Likewise.
2722
2723 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2724             Ian Lance Taylor  <iant@google.com>
2725
2726         * symtab.cc (Symbol_table::define_special_symbol): Always
2727         canonicalize version string.
2728
2729 2011-09-26  Cary Coutant  <ccoutant@google.com>
2730
2731         * gold.cc (queue_initial_tasks): Move option checks ...
2732         * options.cc (General_options::finalize): ... to here. Disable
2733         some options; make others fatal.
2734
2735 2011-09-26  Cary Coutant  <ccoutant@google.com>
2736
2737         gcc PR lto/47247
2738         * plugin.cc (get_symbols_v2): New function.
2739         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2740         (is_referenced_from_outside): New function.
2741         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2742         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2743         (get_symbols): Pass version parameter.
2744         (get_symbols_v2): New function.
2745         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2746         parameter.
2747         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2748         (onload): Add LDPT_GET_SYMBOLS_V2.
2749         (all_symbols_read_hook): Use get_symbols_v2; check for
2750         LDPR_PREVAILING_DEF_IRONLY_EXP.
2751         * testsuite/plugin_test_3.sh: Update expected results.
2752
2753 2011-09-23  Simon Baldwin  <simonb@google.com>
2754
2755         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2756         configuration options.
2757         * configure: Regenerate.
2758         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2759         * Makefile.in: Regenerate.
2760         * testsuite/Makefile.in: Regenerate.
2761
2762 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2763
2764         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2765
2766 2011-09-19  Cary Coutant  <ccoutant@google.com>
2767
2768         * incremental.cc (can_incremental_update): Fix typo in comment.
2769         * incremental.h (can_incremental_update): Likewise.
2770
2771 2011-09-18  Cary Coutant  <ccoutant@google.com>
2772
2773         * incremental.cc (can_incremental_update): New function.
2774         * incremental.h (can_incremental_update): New function.
2775         * layout.cc (Layout::init_fixed_output_section): Call it.
2776         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2777         * object.cc (Sized_relobj_file::do_layout): Call
2778         can_incremental_update.
2779
2780 2011-09-13  Cary Coutant  <ccoutant@google.com>
2781
2782         * configure.ac: Check for glibc support for gnu_indirect_function
2783         support with static linking, setting automake conditional
2784         IFUNC_STATIC.
2785         * Makefile.in: Regenerate.
2786         * configure: Regenerate.
2787
2788         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2789         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2790         for IFUNC_STATIC.
2791         * testsuite/Makefile.in: Regenerate.
2792
2793 2011-09-13  Cary Coutant  <ccoutant@google.com>
2794
2795         * incremental.cc (Sized_relobj_incr::do_layout): Call
2796         report_comdat_group for kept comdat sections.
2797         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2798         * testsuite/Makefile.in: Regenerate.
2799         * testsuite/incr_comdat_test_1.cc: New source file.
2800         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2801         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2802         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2803
2804 2011-09-13  Ian Lance Taylor  <iant@google.com>
2805
2806         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2807         variable external_symbols_offset.
2808
2809 2011-09-12  Ian Lance Taylor  <iant@google.com>
2810
2811         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2812         triggered if object has no symbols.
2813
2814 2011-09-09  David S. Miller  <davem@davemloft.net>
2815
2816         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2817         (Output_fill_debug_line::do_write): Likewise.
2818
2819 2011-08-29  Cary Coutant  <ccoutant@google.com>
2820
2821         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2822         casts to match formatting specs.
2823         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2824
2825 2011-08-26  Cary Coutant  <ccoutant@google.com>
2826
2827         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2828         remaining hole size when allocating.
2829         (Layout::make_output_section): Set fill methods for debug sections.
2830         * layout.h (Free_list::Free_list_node): Move from private to
2831         public.
2832         (Free_list::set_min_hole_size): New function.
2833         (Free_list::begin, Free_list::end): New functions.
2834         (Free_list::min_hole_): New data member.
2835         * output.cc: Include dwarf.h.
2836         (Output_fill_debug_info::do_minimum_hole_size): New function.
2837         (Output_fill_debug_info::do_write): New function.
2838         (Output_fill_debug_line::do_minimum_hole_size): New function.
2839         (Output_fill_debug_line::do_write): New function.
2840         (Output_section::Output_section): Initialize new data member.
2841         (Output_section::set_final_data_size): Ensure patch space is larger
2842         than minimum hole size.
2843         (Output_section::do_write): Fill holes in debug sections.
2844         * output.h (Output_fill): New class.
2845         (Output_fill_debug_info): New class.
2846         (Output_fill_debug_line): New class.
2847         (Output_section::set_free_space_fill): New function.
2848         (Output_section::free_space_fill_): New data member.
2849         * testsuite/Makefile.am (incremental_test_3): Add
2850         --incremental-patch option.
2851         (incremental_test_4): Likewise.
2852         (incremental_test_5): Likewise.
2853         (incremental_test_6): Likewise.
2854         (incremental_copy_test): Likewise.
2855         (incremental_common_test_1): Likewise.
2856         * testsuite/Makefile.in: Regenerate.
2857
2858 2011-08-26  Nick Clifton  <nickc@redhat.com>
2859
2860         * po/es.po: Updated Spanish translation.
2861
2862 2011-08-01  Cary Coutant  <ccoutant@google.com>
2863
2864         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2865         * gold/testsuite/Makefile.in: Regenerate.
2866         * gold/testsuite/justsyms_exec.c: New source file.
2867         * gold/testsuite/justsyms_lib.c: New source file.
2868
2869 2011-08-01  Cary Coutant  <ccoutant@google.com>
2870
2871         * layout.cc (Layout::set_segment_offsets): Don't realign text
2872         segment if -Ttext was specified.
2873         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2874         file type.
2875         * object.h (Sized_relobj_file::e_type): New function.
2876         (Sized_relobj_file::e_type_): New data member.
2877         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2878         base address for ET_EXEC files.
2879         * target.cc (Target::do_make_elf_object_implementation): Allow
2880         ET_EXEC files with --just-symbols option.
2881
2882 2011-07-28  Cary Coutant  <ccoutant@google.com>
2883
2884         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2885         Add thread_number parameter.
2886         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2887         * workqueue-threads.cc
2888         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2889         current thread if its thread number is greater than desired thread
2890         count.
2891         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2892         Add thread_number parameter.
2893         (Workqueue::should_cancel_thread): Likewise.
2894         (Workqueue::find_runnable_or_wait): Pass thread_number to
2895         should_cancel_thread.
2896         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2897         parameter.
2898
2899 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2900
2901         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2902         only after checking if it cannot be forced local.
2903         * symtab.h (is_externally_visible): Check if the symbol is not forced
2904         local.
2905
2906 2011-07-15  Ian Lance Taylor  <iant@google.com>
2907
2908         * options.h (class General_options): Add --print-output-format.
2909         Move -EL next to -EB, for  better --help output.
2910         * target-select.cc: Include <cstdio>, "options.h", and
2911         "parameters.h".
2912         (Target_selector::do_target_bfd_name): New function.
2913         (print_output_format): New function.
2914         * target-select.h (class Target_selector): Update declarations.
2915         (Target_selector::target_bfd_name): New function.
2916         (print_output_format): Declare.
2917         * main.cc: Include "target-select.h".
2918         (main): Handle --print-output-format.
2919         * gold.cc: Include "target-select.h".
2920         (queue_initial_tasks): Handle --print-output-format when there are
2921         no input files.
2922         * parameters.cc (parameters_force_valid_target): Give a better
2923         error message if -EB/-EL does not match target.
2924         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2925         function.
2926
2927 2011-07-15  Ian Lance Taylor  <iant@google.com>
2928
2929         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2930         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2931         (Output_data_plt_i386::do_write): Write address of .dynamic
2932         section to first entry in .got.plt section.
2933         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2934         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2935         Initialize layout_.
2936         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2937         section to first entry in .got.plt section.
2938         * layout.h (Layout::dynamic_section): New function.
2939
2940 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2941
2942         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2943         to claim_file call.
2944         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2945         input_section_position_, and input_section_glob_.
2946         (read_layout_from_file): Call function section_ordering_specified.
2947         * layout.h (is_section_ordering_specified): New function.
2948         (section_ordering_specified): New function.
2949         (section_ordering_specified_): New boolean member.
2950         * main.cc(main): Call load_plugins after layout object is defined.
2951         * output.cc (Output_section::add_input_section): Use
2952         function section_ordering_specified to check if section ordering is
2953         needed.
2954         * output.cc (Output_section::add_relaxed_input_section): Use
2955         function section_ordering_specified to check if section ordering is
2956         needed.
2957         (Output_section::update_section_layout): New function.
2958         (Output_section::sort_attached_input_sections): Check if input section
2959         must be reordered.
2960         * output.h (Output_section::update_section_layout): New function.
2961         * plugin.cc (get_section_count): New function.
2962         (get_section_type): New function.
2963         (get_section_name): New function.
2964         (get_section_contents): New function.
2965         (update_section_order): New function.
2966         (allow_section_ordering): New function.
2967         (Plugin::load): Add the new interfaces to the transfer vector.
2968         (Plugin_manager::load_plugins): New parameter.
2969         (Plugin_manager::all_symbols_read): New parameter.
2970         (Plugin_manager::claim_file): New parameter. Save the elf object for
2971         unclaimed objects.
2972         (Plugin_manager::get_elf_object): New function.
2973         (Plugin_manager::get_view): Change to directly use the bool to check
2974         if get_view is called from claim_file_hook.
2975         * plugin.h (input_objects): New function
2976         (Plugin__manager::load_plugins): New parameter.
2977         (Plugin_manager::claim_file): New parameter.
2978         (Plugin_manager::get_elf_object): New function.
2979         (Plugin_manager::in_claim_file_handler): New function.
2980         (Plugin_manager::in_claim_file_handler_): New member.
2981         (layout): New function.
2982         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2983         handler with an extra parameter. Make the elf object before calling
2984         claim_file handler.
2985         * testsuite/plugin_test.c (get_section_count): New function pointer.
2986         (get_section_type): New function pointer.
2987         (get_section_name): New function pointer.
2988         (get_section_contents): New function pointer.
2989         (update_section_order): New function pointer.
2990         (allow_section_ordering): New function pointer.
2991         (onload): Check if the new interfaces exist.
2992
2993 2011-07-13  Ian Lance Taylor  <iant@google.com>
2994
2995         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2996         relro section.
2997         * x86_64.cc (Target_x86_64::got_section): Likewise.
2998         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2999         (relro_now_test_SOURCES): New variable.
3000         (relro_now_test_DEPENDENCIES): New variable.
3001         (relro_now_test_LDFLAGS): New variable.
3002         (relro_now_test_LDADD): New variable.
3003         (relro_now_test.so): New target.
3004         * testsuite/Makefile.in: Rebuild.
3005
3006 2011-07-12  Ian Lance Taylor  <iant@google.com>
3007
3008         PR gold/12980
3009         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3010         GLOB_DAT relocation rather than a RELATIVE relocation for a
3011         protected symbol when creating a shared library.
3012         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3013         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3014         * testsuite/protected_main_1.cc (main): Test that protected
3015         function has same address.
3016
3017 2011-07-11  Ian Lance Taylor  <iant@google.com>
3018
3019         PR gold/12979
3020         * options.h (class General_options): Add -Bgroup.
3021         * options.cc (General_options::finalize): If -Bgroup is set,
3022         default to --unresolved-symbols=report-all.
3023         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3024         * target-reloc.h (issue_undefined_symbol_error): Handle
3025         --unresolved-symbols=report-all.
3026
3027 2011-07-08  Ian Lance Taylor  <iant@google.com>
3028
3029         PR gold/11985
3030         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3031         if linker script discards key sections.
3032         (Layout::create_dynamic_symtab): Likewise.
3033         (Layout::assign_local_dynsym_offsets): Likewise.
3034         (Layout::sized_create_version_sections): Likewise.
3035         (Layout::create_interp): Likewise.
3036         (Layout::finish_dynamic_section): Likewise.
3037         (Layout::set_dynamic_symbol_size): Likewise.
3038
3039 2011-07-08  Ian Lance Taylor  <iant@google.com>
3040
3041         PR gold/12386
3042         * options.h (class General_options): Add --unresolved-symbols.
3043         * target-reloc.h (issue_undefined_symbol_error): Check
3044         --unresolved-symbols.  Add comments.
3045
3046 2011-07-08  Ian Lance Taylor  <iant@google.com>
3047
3048         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3049         expression more complex.
3050
3051 2011-07-08  Ian Lance Taylor  <iant@google.com>
3052
3053         PR gold/11317
3054         * target-reloc.h (issue_undefined_symbol_error): New inline
3055         function, broken out of relocate_section.
3056         (relocate_section): Call issue_undefined_symbol_error.
3057         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3058         there is no TLS segment if we are about to issue an undefined
3059         symbol error.
3060         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3061
3062 2011-07-08  Ian Lance Taylor  <iant@google.com>
3063
3064         PR gold/12279
3065         * resolve.cc (Symbol_table::should_override): Add fromtype
3066         parameter.  Change all callers.  Give error when linking together
3067         TLS and non-TLS symbol.
3068         (Symbol_table::should_override_with_special): Add fromtype
3069         parameter.  Change all callers.
3070         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3071         there is no TLS segment if we have reported some errors.
3072         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3073
3074 2011-07-08  Ian Lance Taylor  <iant@google.com>
3075
3076         PR gold/12372
3077         * target.h (Target::plt_address_for_global): New function.
3078         (Target::plt_address_for_local): New function.
3079         (Target::plt_section_for_global): Remove.
3080         (Target::plt_section_for_local): Remove.
3081         (Target::do_plt_address_for_global): New virtual function.
3082         (Target::do_plt_address_for_local): New virtual function.
3083         (Target::do_plt_section_for_global): Remove.
3084         (Target::do_plt_section_for_local): Remove.
3085         (Target::register_global_plt_entry): Add Symbol_table and Layout
3086         parameters.
3087         * output.cc (Output_data_got::Got_entry::write): Use
3088         plt_address_for_global and plt_address_for_local.
3089         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3090         address of output section.
3091         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3092         got_irelative_, and irelative_count_ fields.  Update
3093         declarations.
3094         (Output_data_plt_i386::has_irelative_section): New function.
3095         (Output_data_plt_i386::entry_count): Add irelative_count_.
3096         (Output_data_plt_i386::set_final_data_size): Likewise.
3097         (class Target_i386): Add got_irelative_ and rel_irelative_
3098         fields.  Update declarations.
3099         (Target_i386::Target_i386): Initialize new fields.
3100         (Target_i386::do_plt_address_for_global): New function replacing
3101         do_plt_section_for_global.
3102         (Target_i386::do_plt_address_for_local): New function replacing
3103         do_plt_section_for_local.
3104         (Target_i386::got_section): Create got_irelative_.
3105         (Target_i386::rel_irelative_section): New function.
3106         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3107         fields.  Don't define __rel_iplt_{start,end}.
3108         (Output_data_plt_i386::add_entry): Add symtab and layout
3109         parameters.  Change all callers.  Use different PLT and GOT for
3110         IFUNC symbols.
3111         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3112         layout parameters.  Change all callers.  Use different PLT and
3113         GOT.
3114         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3115         (Output_data_plt_i386::rel_irelative): New function.
3116         (Output_data_plt_i386::address_for_global): New function.
3117         (Output_data_plt_i386::address_for_local): New function.
3118         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3119         IRELATIVE GOT when changing IFUNC GOT entries.
3120         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3121         reloc.
3122         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3123         if we didn't create an IRELATIVE GOT.
3124         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3125         plt_address_for_local.
3126         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3127         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3128         got_irelative_, and irelative_count_ fields.  Update
3129         declarations.
3130         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3131         Initialize new fields.  Remove symtab parameter.  Change all
3132         callers.
3133         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3134         irelative_count_.
3135         (Output_data_plt_x86_64::has_irelative_section): New function.
3136         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3137         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3138         fields.  Update declarations.
3139         (Target_x86_64::Target_x86_64): Initialize new fields.
3140         (Target_x86_64::do_plt_address_for_global): New function replacing
3141         do_plt_section_for_global.
3142         (Target_x86_64::do_plt_address_for_local): New function replacing
3143         do_plt_section_for_local.
3144         (Target_x86_64::got_section): Create got_irelative_.
3145         (Target_x86_64::rela_irelative_section): New function.
3146         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3147         all callers.  Don't create __rel_iplt_{start,end}.
3148         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3149         parameters.  Change all callers.  Use different PLT and GOT for
3150         IFUNC symbols.
3151         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3152         layout parameters.  Change all callers.  Use different PLT and
3153         GOT.
3154         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3155         parameters.  Change all callers.  Use different PLT and GOT for
3156         IFUNC symbols.
3157         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3158         (Output_data_plt_x86_64::rela_irelative): New function.
3159         (Output_data_plt_x86_64::address_for_global): New function.
3160         (Output_data_plt_x86_64::address_for_local): New function.
3161         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3162         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3163         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3164         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3165         parameters.
3166         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3167         reloc.
3168         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3169         symbols if we didn't create an IRELATIVE GOT.
3170         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3171         plt_address_for_local.
3172         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3173         * testsuite/ifuncvar1.c: New test file.
3174         * testsuite/ifuncvar2.c: New test file.
3175         * testsuite/ifuncvar3.c: New test file.
3176         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3177         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3178         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3179         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3180         * testsuite/Makefile.in: Rebuild.
3181
3182 2011-07-07  Cary Coutant  <ccoutant@google.com>
3183
3184         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3185         (two_file_test_1_ndebug.o): Likewise.
3186         (two_file_test_1b_ndebug.o): Likewise.
3187         (two_file_test_2_ndebug.o): Likewise.
3188         (two_file_test_main_ndebug.o): Likewise.
3189         (incremental_test_2): Link with no-debug versions.
3190
3191 2011-07-06  Cary Coutant  <ccoutant@google.com>
3192
3193         * gold/incremental.cc
3194         (Output_section_incremental_inputs::write_info_blocks): Check for
3195         hidden and internal symbols.
3196
3197 2011-07-06  Cary Coutant  <ccoutant@google.com>
3198
3199         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3200         Check disposition for startup file.
3201         (Incremental_inputs::report_command_line): Ignore
3202         --incremental-startup-unchanged option.
3203         * options.cc (General_options::parse_incremental_startup_unchanged):
3204         New function.
3205         (General_options::General_options): Initialize new data member.
3206         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3207         (General_options): Add --incremental-startup-unchanged option.
3208         (General_options::incremental_startup_disposition): New function.
3209         (General_options::incremental_startup_disposition_): New data member.
3210
3211 2011-07-06  Cary Coutant  <ccoutant@google.com>
3212
3213         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3214         input file index to Script_info ctor.
3215         (Sized_incremental_binary::do_file_has_changed): Find the
3216         command-line argument for files named in scripts.
3217         * incremental.h (Script_info::Script_info): New ctor
3218         with input file index.
3219         (Script_info::input_file_index): New function.
3220         (Script_info::input_file_index_): New data member.
3221         (Incremental_binary::get_library): Add const.
3222         (Incremental_binary::get_script_info): Add const.
3223         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3224         * testsuite/Makefile.am (incremental_test_5): New test case.
3225         (incremental_test_6): New test case.
3226         * testsuite/Makefile.in: Regenerate.
3227
3228 2011-07-06  Cary Coutant  <ccoutant@google.com>
3229
3230         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3231         debug output when command lines differ.
3232
3233 2011-07-06  Cary Coutant  <ccoutant@google.com>
3234
3235         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3236         --incremental-patch option.
3237         * layout.cc (Free_list::allocate): Extend allocation beyond original
3238         end if enabled.
3239         (Layout::make_output_section): Mark sections that should get
3240         patch space.
3241         * options.cc (parse_percent): New function.
3242         * options.h (parse_percent): New function.
3243         (DEFINE_percent): New macro.
3244         (General_options): Add --incremental-patch option.
3245         * output.cc (Output_section::Output_section): Initialize new data
3246         members.
3247         (Output_section::add_input_section): Print section name when out
3248         of patch space.
3249         (Output_section::add_output_section_data): Likewise.
3250         (Output_section::set_final_data_size): Add patch space when
3251         doing --incremental-full.
3252         (Output_section::do_reset_address_and_file_offset): Remove patch
3253         space.
3254         (Output_segment::set_section_list_addresses): Print debug output
3255         only if --incremental-update.
3256         * output.h (Output_section::set_is_patch_space_allowed): New function.
3257         (Output_section::is_patch_space_allowed_): New data member.
3258         (Output_section::patch_space_): New data member.
3259         * parameters.cc (Parameters::incremental_full): New function.
3260         * parameters.h (Parameters::incremental_full): New function
3261         * testsuite/Makefile.am (incremental_test_2): Add test for
3262         --incremental-patch option.
3263         * testsuite/Makefile.in: Regenerate.
3264         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3265         (t18): Remove function body.
3266
3267 2011-07-05  Doug Kwan  <dougkwan@google.com>
3268
3269         PR gold/12771
3270         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3271         Arm_Address type for relocation result.
3272         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3273         overflow check.
3274         (Arm_relocate_functions::abs32): Use unaligned access.
3275         (Arm_relocate_functions::rel32): Ditto.
3276         (Arm_relocate_functions::prel31): Ditto.
3277         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3278         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3279         static data relocations.
3280         * testsuite/Makefile.in: Regnerate.
3281         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3282
3283 2011-07-05  Ian Lance Taylor  <iant@google.com>
3284
3285         PR gold/12392
3286         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3287         symbols if necessary.
3288         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3289
3290 2011-07-05  Ian Lance Taylor  <iant@google.com>
3291
3292         PR gold/12952
3293         * resolve.cc (Symbol::override_base_with_special): Simply override
3294         version with special symbol version, ignoring previous version.
3295
3296 2011-07-05  Ian Lance Taylor  <iant@google.com>
3297
3298         * object.cc (Sized_relobj_file::include_section_group): Add
3299         information to comment about signature location.
3300
3301 2011-07-02  Ian Lance Taylor  <iant@google.com>
3302
3303         PR gold/12957
3304         * options.h (class General_options): Add -f and -F.
3305         * options.cc (General_options::finalize): Fatal error if -f/-F
3306         are used without -shared.
3307         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3308
3309 2011-07-02  Ian Lance Taylor  <iant@google.com>
3310
3311         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3312
3313 2011-07-01  Ian Lance Taylor  <iant@google.com>
3314
3315         PR gold/12525
3316         PR gold/12952
3317         * resolve.cc (Symbol::override_base_with_special): Don't override
3318         the version if the overriding symbol has a different name.
3319         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3320         all callers.  If we give an error about an undefined version,
3321         define the base version if necessary.
3322         * dynobj.h (class Versions): Update declaration.
3323         * testsuite/weak_alias_test_5.cc: New file.
3324         * testsuite/weak_alias_test.script: New file.
3325         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3326         and versioned_alias have the right value, and call t2.
3327         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3328         weak_alias_test_5.so.
3329         (weak_alias_test_LDADD): Likewise.
3330         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3331         * testsuite/Makefile.in: Rebuild.
3332
3333 2011-07-01  Ian Lance Taylor  <iant@google.com>
3334
3335         PR gold/12525
3336         * options.h (class General_options): Support -z notext.
3337         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3338         -Wl,-z,notext.
3339         (two_file_shared_nonpic.so): Likewise.
3340         (two_file_shared_mixed.so): Likewise.
3341         (two_file_shared_mixed_1.so): Likewise.
3342         (weak_undef_lib_nonpic.so): Likewise.
3343         (alt/weak_undef_lib_nonpic.so): Likewise.
3344         (tls_test_shared_nonpic.so): Likewise.
3345         * testsuite/Makefile.in: Rebuild.
3346
3347 2011-07-01  Ian Lance Taylor  <iant@google.com>
3348
3349         PR gold/12525
3350         * configure.ac: Test whether static linking works, setting
3351         the automake conditional HAVE_STATIC.
3352         * testsuite/Makefile.am: Disable tests using -static if
3353         HAVE_STATIC is not true.
3354         * configure, testsuite/Makefile.in: Rebuild.
3355
3356 2011-07-01  Ian Lance Taylor  <iant@google.com>
3357
3358         PR gold/12525
3359         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3360         Assert if we see DW_EH_PE_indirect.
3361         * target.h (Target::ehframe_datarel_base): New function.
3362         (Target::do_ehframe_datarel_base): New target function.
3363         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3364         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3365         function.
3366
3367 2011-07-01  Ian Lance Taylor  <iant@google.com>
3368
3369         PR gold/12571
3370         * options.h (class General_options): Add
3371         --ld-generated-unwind-info.
3372         * ehframe.cc (Fde::write): Add address parameter.  Change all
3373         callers.  If associated with PLT, fill in address and size.
3374         (Cie::set_output_offset): Only add merge mapping if there is an
3375         object.
3376         (Cie::write): Add address parameter.  Change all callers.
3377         (Eh_frame::add_ehframe_for_plt): New function.
3378         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3379         input_offset_ fields into union u_, with new plt field.
3380         (Fde::Fde): Adjust for new union field.
3381         (Fde::Fde) [Output_data version]: New constructor.
3382         (Fde::add_mapping): Only add merge mapping if there is an object.
3383         (class Cie): Update declarations.
3384         (class Eh_frame): Declare add_ehframe_for_plt.
3385         * layout.cc (Layout::layout_eh_frame): Break out code into
3386         make_eh_frame_section, and call it.
3387         (Layout::make_eh_frame_section): New function.
3388         (Layout::add_eh_frame_for_plt): New function.
3389         * layout.h (class Layout): Update declarations.
3390         * merge.cc (Merge_map::add_mapping): Add assertion.
3391         * i386.cc: Include "dwarf.h".
3392         (class Output_data_plt_i386): Make first_plt_entry,
3393         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3394         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3395         and plt_eh_frame_fde.
3396         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3397         boundary.  Call add_eh_frame_for_plt if appropriate.
3398         * x86_64.cc: Include "dwarf.h".
3399         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3400         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3401         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3402         and plt_eh_frame_fde.
3403         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3404         appropriate.
3405
3406 2011-06-29  Ian Lance Taylor  <iant@google.com>
3407
3408         PR gold/12629
3409         * object.cc (Sized_relobj_file::layout_section): Change shdr
3410         parameter to be const.
3411         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3412         out of do_layout.
3413         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3414         appropriate.  Call layout_eh_frame_section.
3415         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3416         sections.
3417         * object.h (class Sized_relobj_file): Update declarations.
3418
3419 2011-06-29  Ian Lance Taylor  <iant@google.com>
3420
3421         PR gold/12652
3422         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3423         modifier.
3424         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3425
3426 2011-06-29  Ian Lance Taylor  <iant@google.com>
3427
3428         PR gold/12675
3429         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3430         SHT_X86_64_UNWIND.
3431         * layout.cc (Layout::layout_eh_frame): Likewise.
3432
3433 2011-06-29  Ian Lance Taylor  <iant@google.com>
3434
3435         PR gold/12695
3436         * layout.cc (Layout::symtab_section_shndx): New function.
3437         * layout.h (class Layout): Declare symtab_section_shndx.
3438         * output.cc (Output_section::write_header): Call it.
3439
3440 2011-06-29  Ian Lance Taylor  <iant@google.com>
3441
3442         PR gold/12818
3443         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3444         symbols which are not used in a relocation.
3445
3446 2011-06-28  Ian Lance Taylor  <iant@google.com>
3447
3448         PR gold/12898
3449         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3450         script create indistinguishable segments.
3451         (Layout::set_segment_offsets): Use stable_sort when sorting
3452         segments.  Pass this to Compare_segments constructor.
3453         * layout.h (class Layout): Make segment_precedes non-static.
3454         (class Compare_segments): Change from struct to class.  Add
3455         layout_ field.  Add constructor.
3456         * script-sections.cc
3457         (Script_sections::attach_sections_using_phdrs_clause): Rename
3458         local orphan to is_orphan.  Don't report failure to put empty
3459         section in segment.  On attachment failure, report name of
3460         section, and attach to first PT_LOAD segment.
3461
3462 2011-06-28  Ian Lance Taylor  <iant@google.com>
3463
3464         PR gold/12934
3465         * target-select.cc (Target_selector::Target_selector): Add
3466         emulation parameter.  Change all callers.
3467         (select_target_by_bfd_name): Rename from select_target_by_name.
3468         Change all callers.
3469         (select_target_by_emulation): New function.
3470         (supported_emulation_names): New function.
3471         * target-select.h (class Target_selector): Add emulation_ field.
3472         Update declarations.
3473         (Target_selector::recognize_by_bfd_name): Rename from
3474         recognize_by_name.  Change all callers.
3475         (Target_selector::supported_bfd_names): Rename from
3476         supported_names.  Change all callers.
3477         (Target_selector::recognize_by_emulation): New function.
3478         (Target_selector::supported_emulations): New function.
3479         (Target_selector::emulation): New function.
3480         (Target_selector::do_recognize_by_bfd_name): Rename from
3481         do_recognize_by_name.  Change all callers.
3482         (Target_selector::do_supported_bfd_names): Rename from
3483         do_supported_names.  Change all callers.
3484         (Target_selector::do_recognize_by_emulation): New function.
3485         (Target_selector::do_supported_emulations): New function.
3486         (select_target_by_bfd_name): Change name in declaration.
3487         (select_target_by_emulation): Declare.
3488         (supported_emulation_names): Declare.
3489         * parameters.cc (parameters_force_valid_target): Try to find
3490         target based on emulation from -m option.
3491         * options.h (class General_options): Change doc string for -m.
3492         * options.cc (help): Print emulations.
3493         (General_options::parse_V): Likewise.
3494         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3495         Add emulation parameter.  Change all callers.
3496
3497 2011-06-28  Ian Lance Taylor  <iant@google.com>
3498
3499         * target.h (class Target): Add osabi_ field.
3500         (Target::osabi): New function.
3501         (Target::set_osabi): New function.
3502         (Target::Target): Initialize osabi_.
3503         (Target::do_adjust_elf_header): Make pure virtual.
3504         (Sized_target::do_adjust_elf_header): Declare.
3505         * target.cc (Sized_target::do_adjust_elf_header): New function.
3506         (class Sized_target): Instantiate all versions.
3507         * freebsd.h (class Target_freebsd): Remove.
3508         (Target_selector_freebsd::do_recognize): Call set_osabi on
3509         Target.
3510         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3511         (Target_selector_freebsd::set_osabi): Remove.
3512         * i386.cc (class Target_i386): Inherit from Sized_target rather
3513         than Target_freebsd.
3514         * x86_64.cc (class Target_x86_64): Likewise.
3515
3516 2011-06-28  Ian Lance Taylor  <iant@google.com>
3517
3518         * target.h (Target::can_check_for_function_pointers): Rewrite.
3519         Make non-virtual.
3520         (Target::can_icf_inline_merge_sections): Likewise.
3521         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3522         (Target::Target_info): Add can_icf_inline_merge_sections field.
3523         (Target::do_can_check_for_function_pointers): New virtual
3524         function.
3525         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3526         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3527         from can_check_for_function_pointers, move in file.
3528         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3529         section_may_have_icf_unsafe_poineters, move in file.
3530         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3531         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3532         Rename from can_check_for_function_pointers, move in file.
3533         (Target_i386::can_icf_inline_merge_sections): Remove.
3534         (Target_i386::i386_info): Initialize
3535         can_icf_inline_merge_sections.
3536         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3537         Initialize can_icf_inline_merge_sections.
3538         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3539         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3540         Rename from can_check_for_function_pointers, move in file.
3541         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3542         (Target_x86_64::x86_64_info): Initialize
3543         can_icf_inline_merge_sections.
3544         * testsuite/testfile.cc (Target_test::test_target_info):
3545         Likewise.
3546         * icf.cc (get_section_contents): Correct formatting.
3547
3548 2011-06-27  Ian Lance Taylor  <iant@google.com>
3549
3550         * symtab.cc (Symbol::versioned_name): New function.
3551         (Symbol_table::add_to_final_symtab): Use versioned_name when
3552         appropriate.
3553         (Symbol_table::sized_write_symbol): Likewise.
3554         * symtab.h (class Symbol): Declare versioned_name.
3555         * stringpool.h (class Stringpool_template): Add variant of add
3556         which takes a std::basic_string.
3557         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3558         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3559         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3560         (ver_test_12.o): New target.
3561         * testsuite/Makefile.in: Rebuild.
3562
3563 2011-06-27  Doug Kwan  <dougkwan@google.com>
3564
3565         * arm.cc (Arm_relocate_functions::thm_jump8,
3566         Arm_relocate_functions::thm_jump11): Use a wider signed
3567         type to compute offset.
3568         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3569         arm_thm_jump8.
3570         * testsuite/Makefile.in: Regenerate.
3571         * testsuite/arm_branch_in_range.sh: Check test results of
3572         arm_thm_jump11 and arm_thm_jump8.
3573         * testsuite/arm_thm_jump11.s: New test source file.
3574         * testsuite/arm_thm_jump11.t: New linker script.
3575         * testsuite/arm_thm_jump8.s: New test source file.
3576         * testsuite/arm_thm_jump8.t: New linker script.
3577
3578 2011-06-24  Ian Lance Taylor  <iant@google.com>
3579
3580         * layout.cc: Include "object.h".
3581         (ctors_sections_in_init_array): New static variable.
3582         (Layout::is_ctors_in_init_array): New function.
3583         (Layout::layout): Add entry to ctors_sections_in_init_array if
3584         appropriate.
3585         * layout.h (class Layout): Declare is_ctors_in_init_array.
3586         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3587         is_ctors_reverse_view is set.
3588         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3589         all callers.  Set is_ctors_reverse_view field of View_size.
3590         (Sized_relobj_file::reverse_words): New function.
3591         * object.h (Sized_relobj_file::View_size): Add
3592         is_ctors_reverse_view field.
3593         (class Sized_relobj_file): Update declarations.
3594         * testsuite/initpri3.c: New test.
3595         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3596         initpri3b.
3597         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3598         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3599         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3600         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3601         * testsuite/Makefile.in: Rebuild.
3602
3603 2011-06-24  Cary Coutant  <ccoutant@google.com>
3604
3605         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3606         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3607         (debug_msg_cdebug.err): New targets.
3608         * testsuite/Makefile.in: Regenerate.
3609         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3610         Fix checks for link with shared library.
3611
3612 2011-06-24  Doug Kwan  <dougkwan@google.com>
3613
3614         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3615         skip empty text sections.
3616         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3617
3618 2011-06-22  Ian Lance Taylor  <iant@google.com>
3619
3620         PR gold/12910
3621         * options.h (class General_options): Add --ctors-in-init-array.
3622         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3623         friends as SHT_PROGBITS for merging sections.
3624         (Layout::layout): Remove special handling of .init_array and
3625         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3626         and .dtors if ctors_in_init_array.
3627         (Layout::make_output_section): Force correct section types for
3628         .init_array and friends.  Don't sort if doing relocatable link,
3629         Don't sort .ctors and .dtors if ctors_in_init_array.
3630         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3631         (Layout::output_section_name): Add relobj parameter.  Change all
3632         callers.  Handle .ctors. and .dtors. in code rather than table.
3633         Handle .ctors and .dtors if ctors_in_init_array.
3634         (Layout::match_file_name): New function, moved from output.cc.
3635         * layout.h (class Layout): Update declarations.
3636         * output.cc: Include "layout.h".
3637         (Input_section_sort_entry::get_priority): New function.
3638         (Input_section_sort_entry::match_file_name): Just call
3639         Layout::match_file_name.
3640         (Output_section::Input_section_sort_init_fini_compare::operator()):
3641         Handle .ctors and .dtors.  Sort by explicit priority rather than
3642         by name.
3643         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3644         * testsuite/initpri2.c: New test.
3645         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3646         (check_PROGRAMS): Add initpri2.
3647         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3648         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3649         * configure, testsuite/Makefile.in: Rebuild.
3650
3651 2011-06-19  Ian Lance Taylor  <iant@google.com>
3652
3653         PR gold/12880
3654         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3655         .interp section to a PT_INTERP segment even if we have seen a
3656         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3657         clause in a linker script.
3658         (Layout::finalize): Don't create a .interp section if we've
3659         already create a PT_INTERP segment.
3660         (Layout::create_interp): Always call choose_output_section (revert
3661         patch of 2011-06-17).  Don't create PT_INTERP segment.
3662         * script-sections.cc
3663         (Script_sections::create_note_and_tls_segments): Add a .interp
3664         section to a PT_INTERP segment even if we have seen a
3665         --dynamic-linker option.
3666
3667 2011-06-18  Ian Lance Taylor  <iant@google.com>
3668
3669         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3670         merely because a non-PT_LOAD segment has a dynamic reloc.
3671
3672 2011-06-18  Ian Lance Taylor  <iant@google.com>
3673
3674         * layout.cc (Layout::finish_dynamic_section): Don't create
3675         DT_FLAGS entry if not needed.
3676
3677 2011-06-18  Ian Lance Taylor  <iant@google.com>
3678
3679         PR gold/12745
3680         * layout.cc (Layout::layout_eh_frame): Correct handling of
3681         writable .eh_frame section.
3682
3683 2011-06-17  Ian Lance Taylor  <iant@google.com>
3684
3685         PR gold/12893
3686         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3687         symbol is redefined with the exact same object and value.
3688
3689 2011-06-17  Ian Lance Taylor  <iant@google.com>
3690
3691         PR gold/12880
3692         * layout.h (class Layout): Add interp_segment_ field.
3693         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3694         (Layout::attach_allocated_section_to_segment): If making shared
3695         library, put .interp section in PT_INTERP segment.
3696         (Layout::finalize): Also call create_interp if -dynamic-linker
3697         option was used.
3698         (Layout::create_interp): Assert that there is no PT_INTERP
3699         segment.  If not using a SECTIONS clause, use make_output_section.
3700         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3701         * script-sections.cc
3702         (Script_sections::create_note_and_tls_segments): If making shared
3703         library, put .interp section in PT_INTERP segment.
3704
3705 2011-06-17  Ian Lance Taylor  <iant@google.com>
3706
3707         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3708         when making a shared library.
3709
3710 2011-06-17  Ian Lance Taylor  <iant@google.com>
3711
3712         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3713         parameter.  Change all callers.  Don't issue warning about PC32
3714         against locally defined symbol.
3715
3716 2011-06-16  Ian Lance Taylor  <iant@google.com>
3717
3718         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3719         occurs in same object.
3720
3721 2011-06-14  Alan Modra  <amodra@gmail.com>
3722
3723         * po/POTFILES.in: Regenerate.
3724
3725 2011-06-09  Ian Lance Taylor  <iant@google.com>
3726
3727         * script-sections.cc
3728         (Orphan_output_section::set_section_addresses): For a relocatable
3729         link set address to 0.
3730
3731 2011-06-09  Cary Coutant  <ccoutant@google.com>
3732
3733         PR gold/12804
3734         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3735         used with --compress-debug-sections.
3736         * gold/object.cc (Sized_relobj_file::do_layout): Report
3737         uncompressed size of compressed input sections.
3738
3739 2011-06-08  Cary Coutant  <ccoutant@google.com>
3740
3741         PR gold/12804
3742         * testsuite/two_file_test_2_v1.cc: Change initialization of
3743         v2 to keep it in .data.
3744
3745 2011-06-07  Cary Coutant  <ccoutant@google.com>
3746
3747         * common.cc (Symbol_table::do_allocate_commons_list): Call
3748         gold_fallback.
3749         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3750         (Errors::fallback): New function.
3751         (gold_fallback): New function.
3752         * errors.h (Errors::fallback): New function.
3753         * gold.cc (gold_exit): Change status parameter to enum; adjust
3754         all callers.
3755         (queue_initial_tasks): Call gold_fallback.
3756         * gold.h: Include cstdlib.
3757         (Exit_status): New enum type.
3758         (gold_exit): Change status parameter to enum.
3759         (gold_fallback): New function.
3760         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3761         (Layout::create_symtab_sections): Likewise.
3762         (Layout::create_shdrs): Likewise.
3763         * main.cc (main): Adjust call to gold_exit.
3764         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3765         (Output_data_got::add_got_entry_pair): Likewise.
3766         (Output_section::add_input_section): Likewise.
3767         (Output_section::add_output_section_data): Likewise.
3768         (Output_segment::set_section_list_addresses): Likewise.
3769         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3770
3771 2011-06-07  Cary Coutant  <ccoutant@google.com>
3772
3773         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3774         for incremental links.
3775         * output.cc (Output_segment::set_section_list_addresses): Remove
3776         FIXME and test for TLS or BSS.
3777
3778 2011-06-07  Cary Coutant  <ccoutant@google.com>
3779
3780         * testsuite/Makefile.am: Add incremental_copy_test,
3781         incremental_common_test_1.
3782         * testsuite/Makefile.in: Regenerate.
3783         * testsuite/common_test_1_v1.c: New source file.
3784         * testsuite/common_test_1_v2.c: New source file.
3785         * testsuite/copy_test_v1.cc: New source file.
3786
3787 2011-06-07  Cary Coutant  <ccoutant@google.com>
3788
3789         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3790         update, allocate common from bss section's free list.
3791         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3792         linker-defined symbols.
3793         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3794         Skip GOT and PLT entries that are no longer referenced.
3795         (Output_section_incremental_inputs::write_info_blocks): Mark
3796         linker-defined symbols.
3797         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3798         * output.cc (Output_section::allocate): New function.
3799         * output.h (Output_section::allocate): New function.
3800         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3801         linker-defined symbols.
3802         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3803         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3804         (Symbol::init_base_output_data): Likewise.
3805         (Symbol::init_base_output_segment): Likewise.
3806         (Symbol::init_base_constant): Likewise.
3807         (Sized_symbol::init_output_data): Likewise.
3808         (Sized_symbol::init_output_segment): Likewise.
3809         (Sized_symbol::init_constant): Likewise.
3810         (Symbol_table::do_define_in_output_data): Likewise.
3811         (Symbol_table::do_define_in_output_segment): Likewise.
3812         (Symbol_table::do_define_as_constant): Likewise.
3813         * symtab.h (Symbol::is_predefined): New function.
3814         (Symbol::init_base_output_data): Add is_predefined parameter.
3815         (Symbol::init_base_output_segment): Likewise.
3816         (Symbol::init_base_constant): Likewise.
3817         (Symbol::is_predefined_): New data member.
3818         (Sized_symbol::init_output_data): Add is_predefined parameter.
3819         (Sized_symbol::init_output_segment): Likewise.
3820         (Sized_symbol::init_constant): Likewise.
3821         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3822
3823 2011-06-07  Cary Coutant  <ccoutant@google.com>
3824
3825         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3826         instead of emit_copy_reloc.
3827         (Copy_relocs::emit_copy_reloc): Refactor.
3828         (Copy_relocs::make_copy_reloc): New function.
3829         (Copy_relocs::add_copy_reloc): Remove.
3830         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3831         section.
3832         (Copy_relocs::make_copy_reloc): New function.
3833         (Copy_relocs::add_copy_reloc): Remove.
3834         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3835         unchanged input files.
3836         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3837         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3838         Reserve BSS space for COPY relocations.
3839         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3840         (Output_section_incremental_inputs::write_info_blocks): Record
3841         whether a symbol is copied from a shared object.
3842         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3843         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3844         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3845         (Incremental_input_entry_reader::get_output_symbol_index): Add
3846         is_copy parameter.
3847         (Incremental_binary::emit_copy_relocs): New function.
3848         (Incremental_binary::do_emit_copy_relocs): New function.
3849         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3850         new data member.
3851         (Sized_incremental_binary::add_copy_reloc): New function.
3852         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3853         (Sized_incremental_binary::Copy_reloc): New struct.
3854         (Sized_incremental_binary::Copy_relocs): New typedef.
3855         (Sized_incremental_binary::copy_relocs_): New data member.
3856         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3857         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3858         * target.h (Sized_target::emit_copy_reloc): New function.
3859         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3860
3861 2011-06-02  Cary Coutant  <ccoutant@google.com>
3862
3863         PR gold/12163
3864         * gold/archive.cc (Archive::Archive): Initialize new data member.
3865         (Archive::include_all_members): Return if archive has already been
3866         included.
3867         * gold/archive.h (Archive::include_all_members_): New data member.
3868
3869 2011-06-02  Nick Clifton  <nickc@redhat.com>
3870
3871         * dynobj.h: Fix spelling mistake in comment.
3872         * output.cc: Likewise.
3873
3874 2011-05-31  Doug Kwan  <dougkwan@google.com>
3875             Asier Llano
3876
3877         PR gold/12826
3878         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3879         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3880         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3881         redundant arm_exidx_test.so.
3882         * testsuite/Makefile.in: Regenerate.
3883         (check_SCRIPTS): Add pr12826.sh
3884         (check_DATA): Add pr12826.stdout
3885         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3886         * testsuite/pr12826.sh: New file.
3887         * testsuite/pr12826_1.s: Ditto.
3888         * testsuite/pr12826_1.s: Ditto.
3889
3890 2011-05-30  Ian Lance Taylor  <iant@google.com>
3891
3892         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3893         sections.
3894
3895 2011-05-29  Ian Lance Taylor  <iant@google.com>
3896
3897         PR gold/12804
3898         * testsuite/Makefile.am: Use different file name for two_file_test
3899         temporary file for each incremental test.
3900         * testsuite/Makefile.in: Rebuild.
3901
3902 2011-05-29  Ian Lance Taylor  <iant@google.com>
3903
3904         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3905         binary input file is empty.
3906
3907 2011-05-27  Ian Lance Taylor  <iant@google.com>
3908
3909         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3910         (ver_test_9.so): Likewise.
3911         * testsuite/Makefile.in: Rebuild.
3912
3913 2011-05-26 Cary Coutant  <ccoutant@google.com>
3914
3915         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3916         * incremental.cc (Incremental_inputs::report_input_section): Fix
3917         comment, indentation.
3918         (Incremental_inputs::report_comdat_group): New function.
3919         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3920         of data for incremental input file entry.
3921         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3922         group count, COMDAT group signatures.
3923         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3924         an unchanged input file.
3925         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3926         Initialize new data member.
3927         (Incremental_object_entry::add_comdat_group): New function.
3928         (Incremental_object_entry::get_comdat_group_count): New function.
3929         (Incremental_object_entry::get_comdat_signature_key): New function.
3930         (Incremental_object_entry::groups_): New data member.
3931         (Incremental_inputs::report_comdat_group): New function.
3932         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3933         data for incremental input file entry.
3934         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3935         (Incremental_input_entry_reader::get_input_section): Adjust size of
3936         data for incremental input file entry.
3937         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3938         (Incremental_input_entry_reader::get_comdat_group_signature): New
3939         function.
3940         * object.cc (Sized_relobj::include_section_group): Report kept
3941         COMDAT groups for incremental links.
3942
3943 2011-05-24  David Meyer  <pdox@google.com>
3944
3945         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3946         with name parameter.  Add found_name parameter.
3947         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3948         * dirsearch.h (class Dirsearch): Update declaration.
3949
3950 2011-05-24  Ian Lance Taylor  <iant@google.com>
3951
3952         * archive.cc (Library_base::should_include_member): Pull in object
3953         from archive if it defines the entry symbol.
3954         * parameters.cc (Parameters::entry): New function.
3955         * parameters.h (class Parameters): Declare entry.
3956         * output.h (class Output_file_header): Remove entry_ field.
3957         * output.cc (Output_file_header::Output_file_header): Remove entry
3958         parameter.  Change all callers.
3959         (Output_file_header::entry): Use parameters->entry.
3960         * gold.cc (queue_middle_tasks): Likewise.
3961         * plugin.cc (Plugin_hook::run): Likewise.
3962
3963 2011-05-24 Cary Coutant  <ccoutant@google.com>
3964
3965         * gold.cc (queue_initial_tasks): Pass incremental base filename
3966         to Output_file::open_base_file; don't print error message.
3967         * incremental-dump.cc (main): Adjust call to
3968         Output_file::open_for_modification.
3969         * incremental-dump.cc (main): Likewise.
3970         * incremental.cc (Incremental_inputs::report_command_line):
3971         Ignore --incremental-base option when comparing command lines.
3972         Ignore parameter when given as separate argument.
3973         * options.h (class General_options): Add --incremental-base.
3974         * output.cc (Output_file::Output_file):
3975         (Output_file::open_base_file): Add base_name and writable parameters;
3976         read base file into new file; print error message here.
3977         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3978         callers.
3979         * output.h (Output_file::open_for_modification): Rename to...
3980         (Output_file::open_base_file): ...this; add base_name and
3981         writable parameters; adjust all callers.
3982         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3983         callers.
3984         * testsuite/Makefile.am (incremental_test_4): Test
3985         --incremental-base.
3986         * testsuite/Makefile.in: Regenerate.
3987
3988 2011-05-24 Cary Coutant  <ccoutant@google.com>
3989
3990         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3991         incremental_test_4.
3992         * testsuite/Makefile.in: Regenerate.
3993         * testsuite/two_file_test_1_v1.cc: New test source file.
3994         * testsuite/two_file_test_1b_v1.cc: New test source file.
3995         * testsuite/two_file_test_2_v1.cc: New test source file.
3996
3997 2011-05-24 Cary Coutant  <ccoutant@google.com>
3998
3999         * dynobj.h (Dynobj::do_dynobj): New function.
4000         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4001         flag and soname for shared objects.
4002         * incremental.cc (Incremental_inputs::report_object): Make
4003         either Incremental_object_entry or Incremental_dynobj_entry; add
4004         soname to string table.
4005         (Incremental_inputs::report_input_section): Add assertion.
4006         (Output_section_incremental_inputs::set_final_data_size): Adjust
4007         type of input file entry for shared libraries; adjust size of
4008         shared library info entry.
4009         (Output_section_incremental_inputs::write_input_files): Write
4010         as_needed flag for shared libraries.
4011         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4012         of input file entry for shared libraries; write soname.
4013         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4014         soname from incremental info.
4015         * incremental.h (enum Incremental_input_flags): Add
4016         INCREMENTAL_INPUT_AS_NEEDED.
4017         (Incremental_input_entry::Incremental_input_entry): Initialize new
4018         data member.
4019         (Incremental_input_entry::set_as_needed): New function.
4020         (Incremental_input_entry::as_needed): New function.
4021         (Incremental_input_entry::do_dynobj_entry): New function.
4022         (Incremental_input_entry::as_needed_): New data member.
4023         (Incremental_object_entry::Incremental_object_entry): Don't check
4024         for shared library.
4025         (Incremental_object_entry::do_type): Likewise.
4026         (class Incremental_dynobj_entry): New class.
4027         (Incremental_input_entry_reader::as_needed): New function.
4028         (Incremental_input_entry_reader::get_soname): New function.
4029         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4030         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4031         size of shared library info entry.
4032         * layout.cc (Layout::finish_dynamic_section): Don't test for
4033         incremental link when adding DT_NEEDED entries.
4034         * object.h (Object::Object): Initialize new data member.
4035         (Object::dynobj): New function.
4036         (Object::set_as_needed): New function.
4037         (Object::as_needed): New function.
4038         (Object::do_dynobj): New function.
4039         (Object::as_needed_): New data member.
4040
4041 2011-05-24 Cary Coutant  <ccoutant@google.com>
4042
4043         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4044         info; adjust display of GOT entries.
4045         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4046         vector of input objects; remove file_status_.
4047         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4048         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4049         got_plt reader; call target hooks to reserve GOT entries.
4050         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4051         of input file info header and GOT info entry.
4052         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4053         relocation info.
4054         (Got_plt_view_info::got_descriptor): Remove.
4055         (Got_plt_view_info::sym_index): New data member.
4056         (Got_plt_view_info::input_index): New data member.
4057         (Local_got_offset_visitor::visit): Write input file index.
4058         (Global_got_offset_visitor::visit): Write 0 for input file index.
4059         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4060         with sym_index and input_index.
4061         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4062         incremental info GOT entry; replace got_descriptor with input_index.
4063         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4064         map from input file index to object.
4065         (Sized_relobj_incr::do_layout): Replace direct data member reference
4066         with accessor function.
4067         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4068         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4069         Adjust size of input file info header.
4070         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4071         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4072         (Incremental_input_entry_reader::get_input_section): Adjust size of
4073         input file info header.
4074         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4075         of incremental info GOT entry.
4076         (Incremental_got_plt_reader::get_got_desc): Remove.
4077         (Incremental_got_plt_reader::get_got_symndx): New function.
4078         (Incremental_got_plt_reader::get_got_input_index): New function.
4079         (Sized_incremental_binary::Sized_incremental_binary): Remove
4080         file_status_; add input_objects_.
4081         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4082         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4083         (Sized_incremental_binary::file_is_unchanged): Remove.
4084         (Sized_incremental_binary::set_input_object): New function.
4085         (Sized_incremental_binary::input_object): New function.
4086         (Sized_incremental_binary::file_status_): Remove.
4087         (Sized_incremental_binary::input_objects_): New data member.
4088         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4089         references.
4090         (Sized_relobj_incr::invalid_address): Move to base class.
4091         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4092         class.
4093         (Sized_relobj_incr::do_output_section_offset): Likewise.
4094         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4095         (Sized_relobj_incr::section_offsets_): Likewise.
4096         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4097         function.
4098         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4099         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4100         with accessor function.
4101         (Sized_relobj_file::do_layout): Likewise.
4102         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4103         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4104         (Sized_relobj_file::compute_final_local_value): Replace refs to
4105         section_offsets_ with accessor function.
4106         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4107         * object.h (Relobj::Relobj): Initialize new data members.
4108         (Relobj::add_dyn_reloc): New function.
4109         (Relobj::first_dyn_reloc): New function.
4110         (Relobj::dyn_reloc_count): New function.
4111         (Relobj::first_dyn_reloc_): New data member.
4112         (Relobj::dyn_reloc_count_): New data member.
4113         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4114         references.
4115         (Sized_relobj::Address): New typedef.
4116         (Sized_relobj::invalid_address): Move here from child class.
4117         (Sized_relobj::Sized_relobj): Initialize new data members.
4118         (Sized_relobj::sized_relobj): New function.
4119         (Sized_relobj::is_output_section_offset_invalid): Move here from
4120         child class.
4121         (Sized_relobj::get_output_section_offset): Likewise.
4122         (Sized_relobj::local_has_got_offset): Likewise.
4123         (Sized_relobj::local_got_offset): Likewise.
4124         (Sized_relobj::set_local_got_offset): Likewise.
4125         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4126         (Sized_relobj::clear_got_offsets): New function.
4127         (Sized_relobj::section_offsets): Move here from child class.
4128         (Sized_relobj::do_output_section_offset): Likewise.
4129         (Sized_relobj::do_set_section_offset): Likewise.
4130         (Sized_relobj::Local_got_offsets): Likewise.
4131         (Sized_relobj::local_got_offsets_): Likewise.
4132         (Sized_relobj::section_offsets_): Likewise.
4133         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4134         references.
4135         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4136         class.
4137         (Sized_relobj_file::sized_relobj): New function
4138         (Sized_relobj_file::local_has_got_offset): Move to base class.
4139         (Sized_relobj_file::local_got_offset): Likewise.
4140         (Sized_relobj_file::set_local_got_offset): Likewise.
4141         (Sized_relobj_file::get_output_section_offset): Likewise.
4142         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4143         (Sized_relobj_file::do_output_section_offset): Likewise.
4144         (Sized_relobj_file::do_set_section_offset): Likewise.
4145         (Sized_relobj_file::Local_got_offsets): Likewise.
4146         (Sized_relobj_file::local_got_offsets_): Likewise.
4147         (Sized_relobj_file::section_offsets_): Likewise.
4148         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4149         (all constructors).
4150         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4151         (Output_reloc::get_symbol_index): Likewise.
4152         (Output_reloc::local_section_offset): Likewise.
4153         (Output_reloc::get_address): Likewise.
4154         (Output_reloc::symbol_value): Likewise.
4155         (Output_data_got::reserve_slot): Move to class definition.
4156         (Output_data_got::reserve_local): New function.
4157         (Output_data_got::reserve_slot_for_global): Remove.
4158         (Output_data_got::reserve_global): New function.
4159         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4160         (all constructors, two instantiations).
4161         (Output_reloc::get_relobj): New function (two instantiations).
4162         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4163         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4164         (Output_data_reloc::add_global): Adjust type of relobj.
4165         (Output_data_reloc::add_global_relative): Likewise.
4166         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4167         (Output_data_reloc::add_local): Likewise.
4168         (Output_data_reloc::add_local_relative): Likewise.
4169         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4170         (Output_data_reloc::add_local_section): Likewise.
4171         (Output_data_reloc::add_output_section): Likewise.
4172         (Output_data_reloc::add_absolute): Likewise.
4173         (Output_data_reloc::add_target_specific): Likewise.
4174         (Output_data_got::reserve_slot): Move definition here.
4175         (Output_data_got::reserve_local): New function.
4176         (Output_data_got::reserve_global): New function.
4177         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4178         section_offsets_ with accessor function.
4179         (Sized_relobj_file::write_sections): Likewise.
4180         (Sized_relobj_file::do_relocate_sections): Likewise.
4181         * target.h (Sized_target::reserve_local_got_entry): New function.
4182         (Sized_target::reserve_global_got_entry): New function.
4183         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4184         (Target_x86_64::reserve_global_got_entry): New function.
4185         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4186
4187 2011-05-23 Cary Coutant  <ccoutant@google.com>
4188
4189         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4190         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4191         bit when checking got_type.
4192         * incremental.cc (Sized_incremental_binary::setup_readers):
4193         Store symbol table and string table locations; initialize bit vector
4194         of file status flags.
4195         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4196         unchanged files.
4197         (Sized_incremental_binary::do_process_got_plt): New function.
4198         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4199         (Output_section_incremental_inputs::set_final_data_size): Record
4200         file index for each input file.
4201         (Output_section_incremental_inputs::write_got_plt): Store file index
4202         instead of input entry offset for each GOT entry.
4203         * incremental.h
4204         (Incremental_input_entry::Incremental_input_entry): Initialize new
4205         data member.
4206         (Incremental_input_entry::set_offset): Store file index.
4207         (Incremental_input_entry::get_file_index): New function.
4208         (Incremental_input_entry::file_index_): New data member.
4209         (Incremental_binary::process_got_plt): New function.
4210         (Incremental_binary::do_process_got_plt): New function.
4211         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4212         data members.
4213         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4214         (Sized_incremental_binary::set_file_is_unchanged): New function.
4215         (Sized_incremental_binary::file_is_unchanged): New function.
4216         (Sized_incremental_binary::do_process_got_plt): New function.
4217         (Sized_incremental_binary::file_status_): New data member.
4218         (Sized_incremental_binary::main_symtab_loc_): New data member.
4219         (Sized_incremental_binary::main_strtab_loc_): New data member.
4220         * output.cc (Output_data_got::Got_entry::write): Add case
4221         RESERVED_CODE.
4222         (Output_data_got::add_global): Call add_got_entry.
4223         (Output_data_got::add_global_plt): Likewise.
4224         (Output_data_got::add_global_with_rel): Likewise.
4225         (Output_data_got::add_global_with_rela): Likewise.
4226         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4227         (Output_data_got::add_global_pair_with_rela): Likewise.
4228         (Output_data_got::add_local): Call add_got_entry.
4229         (Output_data_got::add_local_plt): Likewise.
4230         (Output_data_got::add_local_with_rel): Likewise.
4231         (Output_data_got::add_local_with_rela): Likewise.
4232         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4233         (Output_data_got::add_local_pair_with_rela): Likewise.
4234         (Output_data_got::reserve_slot): New function.
4235         (Output_data_got::reserve_slot_for_global): New function.
4236         (Output_data_got::add_got_entry): New function.
4237         (Output_data_got::add_got_entry_pair): New function.
4238         (Output_section::add_output_section_data): Edit FIXME.
4239         * output.h
4240         (Output_section_data_build::Output_section_data_build): New
4241         constructor with size parameter.
4242         (Output_data_space::Output_data_space): Likewise.
4243         (Output_data_got::Output_data_got): Initialize new data member; new
4244         constructor with size parameter.
4245         (Output_data_got::add_constant): Call add_got_entry.
4246         (Output_data_got::reserve_slot): New function.
4247         (Output_data_got::reserve_slot_for_global): New function.
4248         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4249         (Output_data_got::add_got_entry): New function.
4250         (Output_data_got::add_got_entry_pair): New function.
4251         (Output_data_got::free_list_): New data member.
4252         * target.h (Sized_target::init_got_plt_for_update): New function.
4253         (Sized_target::register_global_plt_entry): New function.
4254         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4255         Initialize new data member; call init; add constructor with PLT count.
4256         (Output_data_plt_x86_64::init): New function.
4257         (Output_data_plt_x86_64::add_relocation): New function.
4258         (Output_data_plt_x86_64::reserve_slot): New function.
4259         (Output_data_plt_x86_64::free_list_): New data member.
4260         (Target_x86_64::init_got_plt_for_update): New function.
4261         (Target_x86_64::register_global_plt_entry): New function.
4262         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4263         incremental updates.
4264         (Output_data_plt_x86_64::add_relocation): New function.
4265         * testsuite/object_unittest.cc (Object_test): Set default options.
4266
4267 2011-05-16  Ian Lance Taylor  <iant@google.com>
4268
4269         * options.h (class General_options): Make -i a synonym for -r.
4270
4271 2011-05-16  Ian Lance Taylor  <iant@google.com>
4272
4273         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4274
4275 2011-05-10 Cary Coutant  <ccoutant@google.com>
4276
4277         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4278         strip_all (-s).
4279
4280 2011-05-06  Ian Lance Taylor  <iant@google.com>
4281
4282         * layout.cc (Layout::layout): If the output section flags change,
4283         update the ordering.
4284
4285 2011-04-25 Cary Coutant  <ccoutant@google.com>
4286
4287         * incremental-dump.cc (dump_incremental_inputs): Print local
4288         symbol info for each input file.
4289         * incremental.cc
4290         (Output_section_incremental_inputs::set_final_data_size): Add local
4291         symbol info to input file entries in incremental info.
4292         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4293         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4294         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4295         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4296         implementation.
4297         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4298         (Sized_incr_relobj::do_relocate): Write the local symbols.
4299         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4300         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4301         Adjust size of input file header.
4302         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4303         (Incremental_inputs_reader::get_local_symbol_count): New function.
4304         (Incremental_inputs_reader::get_input_section): Adjust size of input
4305         file header.
4306         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4307         (Sized_incr_relobj::This): New typedef.
4308         (Sized_incr_relobj::sym_size): New const data member.
4309         (Sized_incr_relobj::Local_symbol): New struct.
4310         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4311         (Sized_incr_relobj::do_local_symbol_offset): New function.
4312         (Sized_incr_relobj::local_symbol_count_): New data member.
4313         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4314         (Sized_incr_relobj::local_symbol_index_): New data member.
4315         (Sized_incr_relobj::local_symbol_offset_): New data member.
4316         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4317         (Sized_incr_relobj::local_symbols_): New data member.
4318         * object.h (Relobj::output_local_symbol_count): New function.
4319         (Relobj::local_symbol_offset): New function.
4320         (Relobj::do_output_local_symbol_count): New function.
4321         (Relobj::do_local_symbol_offset): New function.
4322         (Sized_relobj::do_output_local_symbol_count): New function.
4323         (Sized_relobj::do_local_symbol_offset): New function.
4324
4325 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4326
4327         * descriptors.cc (set_close_on_exec): New function.
4328         (Descriptors::open): Use set_close_on_exec.
4329         * output.cc (S_ISLNK): Define if not defined.
4330
4331 2011-04-22 Cary Coutant  <ccoutant@google.com>
4332
4333         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4334         global symbol map.
4335         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4336         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4337         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4338         relocations.
4339         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4340         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4341         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4342         * incremental.h
4343         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4344         function.
4345         (Incremental_binary::apply_incremental_relocs): New function.
4346         (Incremental_binary::do_apply_incremental_relocs): New function.
4347         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4348         data member.
4349         (Sized_incremental_binary::add_global_symbol): New function.
4350         (Sized_incremental_binary::global_symbol): New function.
4351         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4352         (Sized_incremental_binary::symbol_map_): New data member.
4353         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4354         * target.h (Sized_target::apply_relocation): New function.
4355         * target-reloc.h (apply_relocation): New function.
4356         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4357
4358 2011-04-22  Doug Kwan  <dougkwan@google.com>
4359
4360         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4361         flag of a SHT_ARM_EXIDX section.
4362         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4363         * testsuite/Makefile.in: Regenerate.
4364         * testsuite/arm_exidx_test.s: New file.
4365         * testsuite/arm_exidx_test.sh: Same.
4366
4367 2011-04-20 Cary Coutant  <ccoutant@google.com>
4368
4369         PR gold/12689
4370         * archive.h (Incremental_archive_entry::Archive_member):
4371         Initialize arg_serial_ (second constructor).
4372
4373 2011-04-17  Ian Lance Taylor  <iant@google.com>
4374
4375         * object.cc (Relocate_info::location): Simplify location string.
4376         * errors.cc (Errors::error_at_location): Don't print program
4377         name.
4378         (Errors::warning_at_location): Likewise.
4379         (Errors::undefined_symbol): Likewise.
4380         * testsuite/debug_msg.sh: Update accordingly.
4381
4382 2011-04-14 Cary Coutant  <ccoutant@google.com>
4383
4384         * gold/layout.cc (Layout::symtab_section_offset): New function.
4385         * gold/layout.h (Layout::symtab_section_offset): New function.
4386         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4387
4388 2011-04-12  Ian Lance Taylor  <iant@google.com>
4389
4390         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4391         with MREMAP_MAYMOVE.
4392         * output.h (class Output_file): Add map_is_allocated_ field.
4393         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4394         not available, provide stubs.  If mremap is not available, #define
4395         it to gold_mremap.
4396         (MREMAP_MAYMOVE): Define if not defined.
4397         (Output_file::Output_file): Initialize map_is_allocated_.
4398         (Output_file::resize): Check map_is_allocated_.
4399         (Output_file::map_anonymous): If mmap fails, use malloc.
4400         (Output_file::unmap): Don't do anything for an anonymous map.
4401         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4402         is not available, provide stubs.
4403         (File_read::View::~View): Use free rather than delete[].
4404         (File_read::make_view): Use malloc rather than new[].  If mmap
4405         fails, use malloc.
4406         (File_read::find_or_make_view): Use malloc rather than new[].
4407         * gold.h: Remove HAVE_REMAP code.
4408         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4409         exists.  Rename mremap to gold_mremap.  If mmap is not available
4410         don't do anything.
4411         * configure, config.in: Rebuild.
4412
4413 2011-04-11  Ian Lance Taylor  <iant@google.com>
4414
4415         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4416         initialize local variable v.
4417
4418 2011-04-11  Cary Coutant  <ccoutant@google.com>
4419
4420         * archive.cc (Archive::include_member): Adjust call to
4421         report_object.
4422         (Add_archive_symbols::run): Track argument serial numbers.
4423         (Lib_group::include_member): Likewise.
4424         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4425         * archive.h (Incremental_archive_entry::Archive_member):
4426         Initialize arg_serial_.
4427         (Archive_member::arg_serial_): New data member.
4428         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4429         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4430         incremental link.
4431         (Sized_dynobj::do_for_all_local_got_entries): New function.
4432         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4433         function.
4434         * fileread.cc (get_mtime): New function.
4435         * fileread.h (get_mtime): New function.
4436         * gold.cc (queue_initial_tasks): Check for incremental update.
4437         (process_incremental_input): New function.
4438         (queue_middle_tasks): Don't force valid target for incremental
4439         update.
4440         * incremental-dump.cc (find_input_containing_global): Adjust
4441         size of symbol info entry.
4442         (dump_incremental_inputs): Dump argument serial number and
4443         in_system_directory flag; bias shndx by 1; print symbol names
4444         when dumping per-file symbol lists; use new symbol info readers.
4445         * incremental.cc
4446         (Output_section_incremental_inputs:update_data_size): New function.
4447         (Sized_incremental_binary::setup_readers): Setup input readers
4448         for each input file; build maps for files added from libraries
4449         and scripts.
4450         (Sized_incremental_binary::check_input_args): New function.
4451         (Sized_incremental_binary::do_check_inputs): Build map of argument
4452         serial numbers to input arguments.
4453         (Sized_incremental_binary::do_file_has_changed): Rename
4454         do_file_is_unchanged to this; compare file modification times.
4455         (Sized_incremental_binary::do_init_layout): New function.
4456         (Sized_incremental_binary::do_reserve_layout): New function.
4457         (Sized_incremental_binary::do_get_input_reader): Remove.
4458         (Sized_incremental_binary::get_symtab_view): New function.
4459         (Incremental_checker::can_incrementally_link_output_file): Remove.
4460         (Incremental_inputs::report_command_line): Exclude --debug options.
4461         (Incremental_inputs::report_archive_begin): Add parameter; track
4462         argument serial numbers; don't put input file entry for archive
4463         before archive members.
4464         (Incremental_inputs::report_archive_end): Put input file entry
4465         for archive after archive members.
4466         (Incremental_inputs::report_object): Add parameter; track argument
4467         serial numbers and in_system_directory flag.
4468         (Incremental_inputs::report_script): Add parameter; track argument
4469         serial numbers.
4470         (Output_section_incremental_inputs::set_final_data_size): Adjust
4471         size of symbol info entry; check for forwarding symbols.
4472         (Output_section_incremental_inputs::write_input_files): Write
4473         in_system_directory flag and argument serial number.
4474         (Output_section_incremental_inputs::write_info_blocks): Map section
4475         indices between incremental info and original input file; store
4476         input section index for each symbol.
4477         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4478         change operator() to visit().
4479         (class Global_got_offset_visitor): Likewise.
4480         (class Global_symbol_visitor_got_plt):
4481         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4482         classes.
4483         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4484         (Sized_incr_relobj::do_read_symbols): New function.
4485         (Sized_incr_relobj::do_layout): New function.
4486         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4487         (Sized_incr_relobj::do_add_symbols): New function.
4488         (Sized_incr_relobj::do_should_include_member): New function.
4489         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4490         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4491         (Sized_incr_relobj::do_section_size): New function.
4492         (Sized_incr_relobj::do_section_name): New function.
4493         (Sized_incr_relobj::do_section_contents): New function.
4494         (Sized_incr_relobj::do_section_flags): New function.
4495         (Sized_incr_relobj::do_section_entsize): New function.
4496         (Sized_incr_relobj::do_section_address): New function.
4497         (Sized_incr_relobj::do_section_type): New function.
4498         (Sized_incr_relobj::do_section_link): New function.
4499         (Sized_incr_relobj::do_section_info): New function.
4500         (Sized_incr_relobj::do_section_addralign): New function.
4501         (Sized_incr_relobj::do_initialize_xindex): New function.
4502         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4503         (Sized_incr_relobj::do_read_relocs): New function.
4504         (Sized_incr_relobj::do_gc_process_relocs): New function.
4505         (Sized_incr_relobj::do_scan_relocs): New function.
4506         (Sized_incr_relobj::do_count_local_symbols): New function.
4507         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4508         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4509         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4510         (Sized_incr_relobj::do_relocate): New function.
4511         (Sized_incr_relobj::do_set_section_offset): New function.
4512         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4513         (Sized_incr_dynobj::do_read_symbols): New function.
4514         (Sized_incr_dynobj::do_layout): New function.
4515         (Sized_incr_dynobj::do_add_symbols): New function.
4516         (Sized_incr_dynobj::do_should_include_member): New function.
4517         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4518         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4519         (Sized_incr_dynobj::do_section_size): New function.
4520         (Sized_incr_dynobj::do_section_name): New function.
4521         (Sized_incr_dynobj::do_section_contents): New function.
4522         (Sized_incr_dynobj::do_section_flags): New function.
4523         (Sized_incr_dynobj::do_section_entsize): New function.
4524         (Sized_incr_dynobj::do_section_address): New function.
4525         (Sized_incr_dynobj::do_section_type): New function.
4526         (Sized_incr_dynobj::do_section_link): New function.
4527         (Sized_incr_dynobj::do_section_info): New function.
4528         (Sized_incr_dynobj::do_section_addralign): New function.
4529         (Sized_incr_dynobj::do_initialize_xindex): New function.
4530         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4531         (make_sized_incremental_object): New function.
4532         (Incremental_library::copy_unused_symbols): New function.
4533         (Incremental_library::do_for_all_unused_symbols): New function.
4534         * incremental.h (enum Incremental_input_flags): New type.
4535         (class Incremental_checker): Remove.
4536         (Incremental_input_entry::Incremental_input_entry): Add argument
4537         serial number.
4538         (Incremental_input_entry::arg_serial): New function.
4539         (Incremental_input_entry::set_is_in_system_directory): New function.
4540         (Incremental_input_entry::is_in_system_directory): New function.
4541         (Incremental_input_entry::arg_serial_): New data member.
4542         (Incremental_input_entry::is_in_system_directory_): New data member.
4543         (class Script_info): Move here from script.h.
4544         (Script_info::Script_info): Add filename parameter.
4545         (Script_info::filename): New function.
4546         (Script_info::filename_): New data member.
4547         (Incremental_script_entry::Incremental_script_entry): Add argument
4548         serial number.
4549         (Incremental_object_entry::Incremental_object_entry): Likewise.
4550         (Incremental_object_entry::add_input_section): Build list of input
4551         sections with map to original shndx.
4552         (Incremental_object_entry::get_input_section_index): New function.
4553         (Incremental_object_entry::shndx_): New data member.
4554         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4555         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4556         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4557         serial number.
4558         (Incremental_inputs::report_archive_begin): Likewise.
4559         (Incremental_inputs::report_object): Likewise.
4560         (Incremental_inputs::report_script): Likewise.
4561         (class Incremental_global_symbol_reader): New class.
4562         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4563         and store flags and input file type.
4564         (Incremental_input_entry_reader::arg_serial): New function.
4565         (Incremental_input_entry_reader::type): Extract type from flags.
4566         (Incremental_input_entry_reader::is_in_system_directory): New function.
4567         (Incremental_input_entry_reader::get_input_section_count): Call
4568         accessor function for type.
4569         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4570         function for type; adjust size of global symbol entry.
4571         (Incremental_input_entry_reader::get_global_symbol_count): Call
4572         accessor function for type.
4573         (Incremental_input_entry_reader::get_object_count): Likewise.
4574         (Incremental_input_entry_reader::get_object_offset): Likewise.
4575         (Incremental_input_entry_reader::get_member_count): Likewise.
4576         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4577         (Incremental_input_entry_reader::get_member_offset): Likewise.
4578         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4579         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4580         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4581         (Incremental_input_entry_reader::get_global_symbol_reader): New
4582         function.
4583         (Incremental_input_entry_reader::get_output_symbol_index): New
4584         function.
4585         (Incremental_input_entry_reader::type_): Remove.
4586         (Incremental_input_entry_reader::flags_): New data member.
4587         (Incremental_inputs_reader::input_file_offset): New function.
4588         (Incremental_inputs_reader::input_file_index): New function.
4589         (Incremental_inputs_reader::input_file): Call input_file_offset.
4590         (Incremental_inputs_reader::input_file_at_offset): New function.
4591         (Incremental_relocs_reader::get_r_type): Reformat.
4592         (Incremental_relocs_reader::get_r_shndx): Reformat.
4593         (Incremental_relocs_reader::get_r_offset): Reformat.
4594         (Incremental_relocs_reader::data): New function.
4595         (Incremental_binary::Incremental_binary): Initialize new data members.
4596         (Incremental_binary::check_inputs): Add cmdline parameter.
4597         (Incremental_binary::file_is_unchanged): Remove.
4598         (Input_reader::arg_serial): New function.
4599         (Input_reader::get_unused_symbol_count): New function.
4600         (Input_reader::get_unused_symbol): New function.
4601         (Input_reader::do_arg_serial): New function.
4602         (Input_reader::do_get_unused_symbol_count): New function.
4603         (Input_reader::do_get_unused_symbol): New function.
4604         (Incremental_binary::input_file_count): New function.
4605         (Incremental_binary::get_input_reader): Change signature to use
4606         index instead of filename.
4607         (Incremental_binary::file_has_changed): New function.
4608         (Incremental_binary::get_input_argument): New function.
4609         (Incremental_binary::get_library): New function.
4610         (Incremental_binary::get_script_info): New function.
4611         (Incremental_binary::init_layout): New function.
4612         (Incremental_binary::reserve_layout): New function.
4613         (Incremental_binary::output_file): New function.
4614         (Incremental_binary::do_check_inputs): New function.
4615         (Incremental_binary::do_file_is_unchanged): Remove.
4616         (Incremental_binary::do_file_has_changed): New function.
4617         (Incremental_binary::do_init_layout): New function.
4618         (Incremental_binary::do_reserve_layout): New function.
4619         (Incremental_binary::do_input_file_count): New function.
4620         (Incremental_binary::do_get_input_reader): Change signature.
4621         (Incremental_binary::input_args_map_): New data member.
4622         (Incremental_binary::library_map_): New data member.
4623         (Incremental_binary::script_map_): New data member.
4624         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4625         new data members.
4626         (Sized_incremental_binary::output_section): New function.
4627         (Sized_incremental_binary::inputs_reader): Add const.
4628         (Sized_incremental_binary::symtab_reader): Add const.
4629         (Sized_incremental_binary::relocs_reader): Add const.
4630         (Sized_incremental_binary::got_plt_reader): Add const.
4631         (Sized_incremental_binary::get_symtab_view): New function.
4632         (Sized_incremental_binary::Inputs_reader): New typedef.
4633         (Sized_incremental_binary::Input_entry_reader): New typedef.
4634         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4635         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4636         (Sized_incremental_binary::do_file_has_changed): New function.
4637         (Sized_incremental_binary::do_init_layout): New function.
4638         (Sized_incremental_binary::do_reserve_layout): New function.
4639         (Sized_input_reader::Inputs_reader): Remove.
4640         (Sized_input_reader::Input_entry_reader): Remove.
4641         (Sized_input_reader::do_arg_serial): New function.
4642         (Sized_input_reader::do_get_unused_symbol_count): New function.
4643         (Sized_input_reader::do_get_unused_symbol): New function.
4644         (Sized_incremental_binary::do_input_file_count): New function.
4645         (Sized_incremental_binary::do_get_input_reader): Change signature;
4646         use index instead of filename.
4647         (Sized_incremental_binary::section_map_): New data member.
4648         (Sized_incremental_binary::input_entry_readers_): New data member.
4649         (class Sized_incr_relobj): New class.
4650         (class Sized_incr_dynobj): New class.
4651         (make_sized_incremental_object): New function.
4652         (class Incremental_library): New class.
4653         * layout.cc (Free_list::num_lists): New static data member.
4654         (Free_list::num_nodes): New static data member.
4655         (Free_list::num_removes): New static data member.
4656         (Free_list::num_remove_visits): New static data member.
4657         (Free_list::num_allocates): New static data member.
4658         (Free_list::num_allocate_visits): New static data member.
4659         (Free_list::init): New function.
4660         (Free_list::remove): New function.
4661         (Free_list::allocate): New function.
4662         (Free_list::dump): New function.
4663         (Free_list::print_stats): New function.
4664         (Layout_task_runner::run): Resize output file for incremental updates.
4665         (Layout::Layout): Initialize new data members.
4666         (Layout::set_incremental_base): New function.
4667         (Layout::init_fixed_output_section): New function.
4668         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4669         incremental updates.
4670         (Layout::create_gold_note): Do not create gold note section for
4671         incremental updates.
4672         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4673         for incremental updates.
4674         (Layout::set_section_offsets): For incremental updates, allocate space
4675         from free list.
4676         (Layout::create_symtab_sections): Layout with offsets relative to
4677         start of section; for incremental updates, allocate space from free
4678         list.
4679         (Layout::create_shdrs): For incremental updates, allocate space from
4680         free list.
4681         (Layout::finish_dynamic_section): For incremental updates, do not
4682         check --as-needed (fixed in subsequent patch).
4683         * layout.h (class Free_list): New class.
4684         (Layout::set_incremental_base): New function.
4685         (Layout::incremental_base): New function.
4686         (Layout::init_fixed_output_section): New function.
4687         (Layout::allocate): New function.
4688         (Layout::incremental_base_): New data member.
4689         (Layout::free_list_): New data member.
4690         * main.cc (main): Print Free_list statistics.
4691         * object.cc (Relobj::finalize_incremental_relocs): Add
4692         clear_counts parameter; clear counts only when clear_counts is set.
4693         (Sized_relobj::Sized_relobj): Initialize new base class.
4694         (Sized_relobj::do_layout): Don't report special sections.
4695         (Sized_relobj::do_for_all_local_got_entries): New function.
4696         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4697         symtab_off to all symbol table offsets.
4698         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4699         * object.h (class Got_offset_list): Move to top of file.
4700         (Object::Object): Allow case where input_file == NULL.
4701         (Object::~Object): Likewise.
4702         (Object::input_file): Assert that input_file != NULL.
4703         (Object::lock): Allow case where input_file == NULL.
4704         (Object::unlock): Likewise.
4705         (Object::is_locked): Likewise.
4706         (Object::token): Likewise.
4707         (Object::release): Likewise.
4708         (Object::is_incremental): New function.
4709         (Object::get_mtime): New function.
4710         (Object::for_all_local_got_entries): New function.
4711         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4712         (Object::set_is_in_system_directory): New function.
4713         (Object::is_in_system_directory): New function.
4714         (Object::do_is_incremental): New function.
4715         (Object::do_get_mtime): New function.
4716         (Object::do_for_all_local_got_entries): New function.
4717         (Object::is_in_system_directory_): New data member.
4718         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4719         (class Sized_relobj_base): New class.
4720         (class Sized_relobj): Derive from Sized_relobj_base.
4721         (class Sized_relobj::Symbols): Redeclare from base class.
4722         (class Sized_relobj::local_got_offset_list): Remove.
4723         (class Sized_relobj::Output_sections): Redeclare from base class.
4724         (class Sized_relobj::do_for_all_local_got_entries): New function.
4725         (class Sized_relobj::write_local_symbols): Add offset parameter.
4726         (class Sized_relobj::local_symbol_offset_): Update comment.
4727         (class Sized_relobj::local_dynsym_offset_): Update comment.
4728         * options.cc (Input_arguments::add_file): Remove const.
4729         * options.h (Input_file_argument::Input_file_argument):
4730         Initialize arg_serial_ (all constructors).
4731         (Input_file_argument::set_arg_serial): New function.
4732         (Input_file_argument::arg_serial): New function.
4733         (Input_file_argument::arg_serial_): New data member.
4734         (Input_arguments::Input_arguments): Initialize file_count_.
4735         (Input_arguments::add_file): Remove const.
4736         (Input_arguments::number_of_input_files): New function.
4737         (Input_arguments::file_count_): New data member.
4738         (Command_line::number_of_input_files): Call
4739         Input_arguments::number_of_input_files.
4740         * output.cc (Output_segment_headers::Output_segment_headers):
4741         Set current size.
4742         (Output_section::Input_section::current_data_size): New function.
4743         (Output_section::Output_section): Initialize new data members.
4744         (Output_section::add_input_section): Don't do merge sections for
4745         an incremental link; allocate space from free list for an
4746         incremental update.
4747         (Output_section::add_output_section_data): Allocate space from
4748         free list for an incremental update.
4749         (Output_section::update_data_size): New function.
4750         (Output_section::set_fixed_layout): New function.
4751         (Output_section::reserve): New function.
4752         (Output_segment::set_section_addresses): Remove const.
4753         (Output_segment::set_section_list_addresses): Remove const; allocate
4754         space from free list for an incremental update.
4755         (Output_segment::set_offset): Adjust size of RELRO segment for an
4756         incremental update.
4757         * output.h (Output_data::current_data_size): Move here from
4758         child classes.
4759         (Output_data::pre_finalize_data_size): New function.
4760         (Output_data::update_data_size): New function.
4761         (Output_section_headers::update_data_size): new function.
4762         (Output_section_data_build::current_data_size): Move to Output_data.
4763         (Output_data_strtab::update_data_size): New function.
4764         (Output_section::current_data_size): Move to Output_data.
4765         (Output_section::set_fixed_layout): New function.
4766         (Output_section::has_fixed_layout): New function.
4767         (Output_section::reserve): New function.
4768         (Output_section::update_data_size): New function.
4769         (Output_section::has_fixed_layout_): New data member.
4770         (Output_section::free_list_): New data member.
4771         (Output_segment::set_section_addresses): Remove const.
4772         (Output_segment::set_section_list_addresses): Remove const.
4773         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4774         New function.
4775         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4776         New function.
4777         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4778         parameter when calling Add_symbols constructor; store argument
4779         serial number for members of a lib group.
4780         (Add_symbols::locks): Allow case where token == NULL.
4781         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4782         (Read_member::~Read_member): New function.
4783         (Read_member::is_runnable): New function.
4784         (Read_member::locks): New function.
4785         (Read_member::run): New function.
4786         (Check_script::~Check_script): New function.
4787         (Check_script::is_runnable): New function.
4788         (Check_script::locks): New function.
4789         (Check_script::run): New function.
4790         (Check_library::~Check_library): New function.
4791         (Check_library::is_runnable): New function.
4792         (Check_library::locks): New function.
4793         (Check_library::run): New function.
4794         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4795         (Add_symbols::library_): New data member.
4796         (class Read_member): New class.
4797         (class Check_script): New class.
4798         (class Check_library): New class.
4799         * reloc.cc (Read_relocs::is_runnable): Allow case where
4800         token == NULL.
4801         (Read_relocs::locks): Likewise.
4802         (Scan_relocs::locks): Likewise.
4803         (Relocate_task::locks): Likewise.
4804         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4805         to clear counters.
4806         (Sized_relobj::incremental_relocs_scan): Fix comment.
4807         (Sized_relobj::do_relocate): Pass output file offset to
4808         write_local_symbols.
4809         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4810         from class declaration.
4811         * script.cc (read_input_script): Allocate Script_info; pass
4812         argument serial number to report_script.
4813         * script.h (class Script_info): Move to incremental.h.
4814         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4815         * symtab.h (Symbol_table::add_from_incrobj): New function.
4816         (Symbol_table::set_file_offset): New function.
4817
4818 2011-04-05  Cary Coutant  <ccoutant@google.com>
4819
4820         * incremental-dump.cc (dump_incremental_inputs): Change signature
4821         to take a Sized_incremental_binary; change caller.  Use readers
4822         in Sized_incremental_binary.
4823         * incremental.cc
4824         (Sized_incremental_binary::find_incremental_inputs_sections):
4825         Rename do_find_incremental_inputs_sections to this.
4826         (Sized_incremental_binary::setup_readers): New function.
4827         (Sized_incremental_binary::do_check_inputs): Check
4828         has_incremental_info_ flag; move setup code to setup_readers;
4829         use input readers.
4830         (Sized_incremental_binary::do_file_is_unchanged): New function.
4831         (Sized_incremental_binary::do_get_input_reader): New function.
4832         * incremental.h (class Incremental_binary): Move to end of file.
4833         (Incremental_binary::file_is_unchanged): New function.
4834         (Incremental_binary::do_file_is_unchanged): New function.
4835         (Incremental_binary::Input_reader): New class.
4836         (Incremental_binary::get_input_reader): New function.
4837         (class Sized_incremental_binary): Move to end of file.
4838         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4839         input section reader classes.
4840         (Sized_incremental_binary::has_incremental_info): New function.
4841         (Sized_incremental_binary::inputs_reader): New function.
4842         (Sized_incremental_binary::symtab_reader): New function.
4843         (Sized_incremental_binary::relocs_reader): New function.
4844         (Sized_incremental_binary::got_plt_reader): New function.
4845         (Sized_incremental_binary::do_file_is_unchanged): New function.
4846         (Sized_incremental_binary::Sized_input_reader): New class.
4847         (Sized_incremental_binary::get_input_reader): New function.
4848         (Sized_incremental_binary::find_incremental_inputs_sections):
4849         Rename do_find_incremental_inputs_sections to this.
4850         (Sized_incremental_binary::setup_readers): New function.
4851         (Sized_incremental_binary::has_incremental_info_): New data member.
4852         (Sized_incremental_binary::inputs_reader_): New data member.
4853         (Sized_incremental_binary::symtab_reader_): New data member.
4854         (Sized_incremental_binary::relocs_reader_): New data member.
4855         (Sized_incremental_binary::got_plt_reader_): New data member.
4856         (Sized_incremental_binary::current_input_file_): New data member.
4857
4858 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4859
4860         PR gold/12640
4861         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4862         violation.
4863
4864 2011-03-30  Cary Coutant  <ccoutant@google.com>
4865
4866         * archive.cc (Archive::include_member): Adjust call to report_object.
4867         (Add_archive_symbols::run): Add script_info to call to
4868         report_archive_begin.
4869         (Lib_group::include_member): Adjust call to report_object.
4870         (Add_lib_group_symbols::run): Adjust call to report_object.
4871         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4872         blocks.  Add object count for script input files.
4873         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4874         script_info parameter; change all callers.
4875         (Incremental_inputs::report_object): Add script_info parameter;
4876         change all callers.
4877         (Incremental_inputs::report_script): Store backpointer to
4878         incremental info entry.
4879         (Output_section_incremental_inputs::set_final_data_size): Record
4880         additional information for scripts.
4881         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4882         * incremental.h (Incremental_script_entry::add_object): New function.
4883         (Incremental_script_entry::get_object_count): New function.
4884         (Incremental_script_entry::get_object): New function.
4885         (Incremental_script_entry::objects_): New data member; adjust
4886         constructor.
4887         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4888         (Incremental_inputs::report_object): Add script_info parameter.
4889         (Incremental_inputs_reader::get_object_count): New function.
4890         (Incremental_inputs_reader::get_object_offset): New function.
4891         * options.cc (Input_arguments::add_file): Return reference to
4892         new input argument.
4893         * options.h (Input_argument::set_script_info): New function.
4894         (Input_argument::script_info): New function.
4895         (Input_argument::script_info_): New data member; adjust all
4896         constructors.
4897         (Input_file_group::add_file): Return reference to new input argument.
4898         (Input_file_lib::add_file): Likewise.
4899         (Input_arguments::add_file): Likewise.
4900         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4901         * script.cc (Parser_closure::Parser_closure): Add script_info
4902         parameter; adjust all callers.
4903         (Parser_closure::script_info): New function.
4904         (Parser_closure::script_info_): New data member.
4905         (read_input_script): Report scripts earlier to incremental info.
4906         (script_add_file): Set script_info in Input_argument.
4907         (script_add_library): Likewise.
4908         * script.h (Script_options::Script_info): Rewrite class.
4909
4910 2011-03-29  Cary Coutant  <ccoutant@google.com>
4911
4912         * archive.cc (Library_base::should_include_member): Move
4913         method here from class Archive.
4914         (Archive::Archive): Initialize base class.
4915         (Archive::should_include_member): Move to base class.
4916         (Archive::do_for_all_unused_symbols): New function.
4917         (Add_archive_symbols::run): Remove redundant access to
4918         incremental_inputs.
4919         (Lib_group::Lib_group): Initialize base class.
4920         (Lib_group::do_filename): New function.
4921         (Lib_group::include_member): Pass pointer to Lib_group to
4922         report_object.
4923         (Lib_group::do_for_all_unused_symbols): New function.
4924         (Add_lib_group_symbols::run): Report archive information for
4925         incremental links.
4926         * archive.h (class Library_base): New base class.
4927         (class Archive): Derive from Library_base.
4928         (Archive::filename): Move to base class.
4929         (Archive::set_incremental_info): Likewise.
4930         (Archive::incremental_info): Likewise.
4931         (Archive::Should_include): Likewise.
4932         (Archive::should_include_member): Likewise.
4933         (Archive::Armap_entry): Remove.
4934         (Archive::Unused_symbol_iterator): Remove.
4935         (Archive::unused_symbols_begin): Remove.
4936         (Archive::unused_symbols_end): Remove.
4937         (Archive::do_filename): New function.
4938         (Archive::do_get_mtime): New function.
4939         (Archive::do_for_all_unused_symbols): New function.
4940         (Archive::task_): Move to base class.
4941         (Archive::incremental_info_): Likewise.
4942         (class Lib_group): Derive from Library_base.
4943         (Lib_group::do_filename): New function.
4944         (Lib_group::do_get_mtime): New function.
4945         (Lib_group::do_for_all_unused_symbols): New function.
4946         (Lib_group::task_): Move to base class.
4947         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4948         function.
4949         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4950         function.
4951         * incremental.cc (Incremental_inputs::report_archive_begin):
4952         Use Library_base; call library's get_mtime; add incremental inputs
4953         entry before members.
4954         (class Unused_symbol_visitor): New class.
4955         (Incremental_inputs::report_archive_end): Use Library_base; use
4956         visitor class to record unused symbols; don't add incremental inputs
4957         entry after members.
4958         (Incremental_inputs::report_object): Use Library_base.
4959         * incremental.h
4960         (Incremental_archive_entry::Incremental_archive_entry): Remove
4961         unused Archive parameter.
4962         (Incremental_inputs::report_archive_begin): Use Library_base.
4963         (Incremental_inputs::report_archive_end): Likewise.
4964         (Incremental_inputs::report_object): Likewise.
4965         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4966         function.
4967         * object.h (Object::for_all_global_symbols): New function.
4968         (Object::do_for_all_global_symbols): New function.
4969         (Sized_relobj::do_for_all_global_symbols): New function.
4970         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4971         function.
4972         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4973         function.
4974
4975 2011-03-27  Ian Lance Taylor  <iant@google.com>
4976
4977         * archive.cc (Archive::interpret_header): Return -1 if something
4978         goes wrong.  Change callers accordingly.
4979
4980 2011-03-25  Cary Coutant  <ccoutant@google.com>
4981
4982         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4983         * testsuite/Makefile.in: Regenerate.
4984
4985 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4986
4987         * plugin.cc (get_view): New.
4988         (Plugin::load): Pass get_view to the plugin.
4989         (Plugin_manager::get_view): New.
4990
4991 2011-03-21  Ian Lance Taylor  <iant@google.com>
4992
4993         * testsuite/final_layout.sh: Rewrite to not use dc.
4994         * testsuite/relro_test.sh: Fail if dc is not present.
4995
4996 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4997
4998         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4999         Change == to -eq.
5000         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5001         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5002         Change == to -eq.
5003         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5004         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5005
5006 2011-03-14  Ian Lance Taylor  <iant@google.com>
5007
5008         * script-sections.cc (Sort_output_sections::script_compare):
5009         Rename from is_before, change return type.
5010         (Sort_output_sections::operator()): Adjust accordingly.
5011
5012 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5013
5014         PR gold/12572
5015         * testsuite/odr_violation2.cc: Add comment to make all error line
5016         numbers double digits.
5017         * testsuite/debug_msg.sh: Adjust expected errors.
5018
5019 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5020
5021         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5022         but mark earlier ones as non-canonical
5023         (offset_to_iterator): Update search target and example
5024         (do_addr2line): Return extra lines in a vector*
5025         (format_file_lineno): Extract from do_addr2line
5026         (one_addr2line): Add vector* out-param
5027         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5028         when a lineno entry appeared last for its instruction
5029         (Dwarf_line_info): Add vector* out-param
5030         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5031         * symtab.cc (Odr_violation_compare): Include the lineno in the
5032         comparison again.
5033         (linenos_from_loc): New. Combine the canonical line for an
5034         address with its other lines.
5035         (True_if_intersect): New. Helper functor to make
5036         std::set_intersection a query.
5037         (detect_odr_violations): Compare sets of lines instead of just
5038         one line for each function. This became less deterministic, but
5039         has fewer false positives.
5040         * symtab.h: Declarations.
5041         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5042         mix an optimized and non-optimized object in the same binary
5043         (odr_violation2.so): Same.
5044         * testsuite/Makefile.in: Regenerate from Makefile.am.
5045         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5046         * testsuite/debug_msg.sh: Update line numbers and add
5047         assertions.
5048         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5049         non-optimized context.
5050         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5051         isn't inlined, and use OdrDerived in an optimized context.
5052         * testsuite/odr_header1.h: Defines OdrDerived, where
5053         optimization will change the
5054         first-instruction-in-the-destructor's file and line number.
5055         * testsuite/odr_header2.h: Defines OdrBase.
5056
5057 2011-03-09  Ian Lance Taylor  <iant@google.com>
5058
5059         * fileread.cc (File_read::clear_views): Don't delete the whole
5060         file view.
5061
5062 2011-03-08  Ian Lance Taylor  <iant@google.com>
5063
5064         PR gold/12525
5065         * fileread.cc: #include <climits>.
5066         (GOLD_IOV_MAX): Define.
5067         (File_read::read_multiple): Limit number of entries by iov_max.
5068         * fileread.h (class File_read): Always set max_readv_entries to
5069         128.
5070
5071 2011-03-07  Ian Lance Taylor  <iant@google.com>
5072
5073         PR gold/12525
5074         * options.h (class General_options): Add -dy and -dn.
5075
5076 2011-03-02  Cary Coutant  <ccoutant@google.com>
5077
5078         * testsuite/script_test_9.t: Add TLS segment.
5079
5080 2011-03-02  Simon Baldwin  <simonb@google.com>
5081
5082         * configure.ac: Add check for gnu_indirect_function support in
5083         the toolchain building binutils.
5084         * configure: Rebuild.
5085
5086 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5087
5088         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5089         plugin only symbols.
5090         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5091         in plugin files as not needed in the symbol table.
5092
5093 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5094
5095         * output.cc (Output_section::add_input_section): Delay fill
5096         generation for section ordering.
5097
5098 2011-02-09  Ian Lance Taylor  <iant@google.com>
5099
5100         PR gold/12316
5101         * object.h (class Sized_relobj): Remove clear_local_symbols.
5102         * reloc.cc (Sized_relobj::do_relocate): Don't call
5103         clear_local_symbols.
5104
5105 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5106
5107         * plugin.cc (is_visible_from_outside): Return true for symbols
5108         in the -u option.
5109
5110 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5111
5112         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5113         filename.
5114
5115 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5116
5117         * icf.h (is_section_foldable_candidate): Change type of parameter
5118         to std::string.
5119         * icf.cc (Icf::find_identical_sections): Change type of local variable
5120         section_name to be std::string.
5121         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5122
5123 2011-01-25  Ian Lance Taylor  <iant@google.com>
5124
5125         * script.cc (script_add_extern): Rewrite to use
5126         add_symbol_reference.
5127
5128 2011-01-25  Doug Kwan  <dougkwan@google.com>
5129
5130         * icf.cc (get_section_contents): Always lock section's object.
5131
5132 2011-01-24  Ian Lance Taylor  <iant@google.com>
5133
5134         * options.h (class General_options): Accept
5135         --no-detect-odr-violations.
5136
5137 2011-01-24  Ian Lance Taylor  <iant@google.com>
5138
5139         * version.cc (version_string): Bump to 1.11.
5140
5141 2011-01-24  Ian Lance Taylor  <iant@google.com>
5142
5143         * plugin.cc (class Plugin_rescan): Define new class.
5144         (Plugin_manager::claim_file): Set any_claimed_.
5145         (Plugin_manager::save_archive): New function.
5146         (Plugin_manager::save_input_group): New function.
5147         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5148         necessary.
5149         (Plugin_manager::new_undefined_symbol): New function.
5150         (Plugin_manager::rescan): New function.
5151         (Plugin_manager::rescannable_defines): New function.
5152         (Plugin_manager::add_input_file): Set any_added_.
5153         * plugin.h (class Plugin_manager): define new fields rescannable_,
5154         undefined_symbols_, any_claimed_, and any_added_.  Declare
5155         Plugin_rescan as friend.  Declare new functions.
5156         (Plugin_manager::Rescannable): Define type.
5157         (Plugin_manager::Rescannable_list): Define type.
5158         (Plugin_manager::Undefined_symbol_list): Define type.
5159         (Plugin_manager::Plugin_manager): Initialize new fields.
5160         * archive.cc (Archive::defines_symbol): New function.
5161         (Add_archive_symbols::run): Pass archive to plugins if any.
5162         * archive.h (class Archive): Declare defines_symbol.
5163         * readsyms.cc (Input_group::~Input_group): New function.
5164         (Finish_group::run): Pass input_group to plugins if any.
5165         * readsyms.h (class Input_group): Declare destructor.
5166         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5167         any.
5168
5169 2011-01-10  Ian Lance Taylor  <iant@google.com>
5170
5171         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5172         section as relro.
5173         (Layout::set_segment_offsets): Reset increase_relro before calling
5174         set_section_addresses a second time.
5175
5176 2011-01-04  Cary Coutant  <ccoutant@google.com>
5177
5178         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5179         sections before NOBITS sections.
5180
5181 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5182
5183         * version.cc (print_version): Update copyright to 2011.
5184
5185 2010-12-23  Cary Coutant  <ccoutant@google.com>
5186
5187         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5188         of OS to this->add.  Add OD parameter to second form of the function.
5189
5190 2010-12-20  Ian Lance Taylor  <iant@google.com>
5191
5192         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5193         second of two consecutive entries with same offset.
5194
5195 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5196
5197         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5198         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5199         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5200         to avoid unneeded links against $(LDADD).
5201         * testsuite/Makefile.in: Regenerate.
5202
5203 2010-12-15  Ian Lance Taylor  <iant@google.com>
5204
5205         PR gold/12324
5206         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5207         for R_X86_64_32 and R_X86_64_PC32.
5208         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5209         ver_matching_def_pic.o.
5210         (ver_matching_def_pic.o): New target.
5211
5212 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5213
5214         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5215         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5216         Move definition before File_read::View member definitions.
5217         (File_read::View::~View): Initialize and hold lock before
5218         updating current_mapped_bytes.
5219
5220 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5221
5222         * dwarf_reader.cc: Remove outdated comment.
5223         * gold-threads.cc: Fix typo in error message.
5224         * archive.cc: Fix typos in comments.
5225         * archive.h: Likewise.
5226         * arm-reloc-property.cc: Likewise.
5227         * arm-reloc-property.h: Likewise.
5228         * arm-reloc.def: Likewise.
5229         * arm.cc: Likewise.
5230         * attributes.h: Likewise.
5231         * cref.cc: Likewise.
5232         * ehframe.cc: Likewise.
5233         * fileread.h: Likewise.
5234         * gold.h: Likewise.
5235         * i386.cc: Likewise.
5236         * icf.cc: Likewise.
5237         * incremental.h: Likewise.
5238         * int_encoding.cc: Likewise.
5239         * layout.h: Likewise.
5240         * main.cc: Likewise.
5241         * merge.h: Likewise.
5242         * object.cc: Likewise.
5243         * object.h: Likewise.
5244         * options.cc: Likewise.
5245         * readsyms.cc: Likewise.
5246         * reduced_debug_output.cc: Likewise.
5247         * reloc.cc: Likewise.
5248         * script-sections.cc: Likewise.
5249         * sparc.cc: Likewise.
5250         * symtab.h: Likewise.
5251         * target-reloc.h: Likewise.
5252         * target.cc: Likewise.
5253         * target.h: Likewise.
5254         * timer.cc: Likewise.
5255         * timer.h: Likewise.
5256         * x86_64.cc: Likewise.
5257
5258 2010-12-09  Cary Coutant  <ccoutant@google.com>
5259
5260         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5261         stack.
5262         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5263         parameter; change all callers.
5264         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5265         * options.h (warn_execstack): New option.
5266
5267 2010-12-07  Doug Kwan  <dougkwan@google.com>
5268
5269         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5270         like function call relocations.
5271
5272 2010-12-07  Ian Lance Taylor  <iant@google.com>
5273
5274         * archive.cc (Archive::get_elf_object_for_member): Permit
5275         punconfigured to be NULL.
5276         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5277         (Archive::include_member): Pass NULL to get_elf_object_for_member
5278         if we searched for the archive and this is the first included
5279         object.
5280
5281 2010-12-01  Ian Lance Taylor  <iant@google.com>
5282
5283         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5284         track_relocs_type_ field.
5285         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5286         Set track_relocs_type_.
5287         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5288         contents when using RELA relocs.
5289         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5290         reloc_map_.
5291         * reloc.cc (Track_relocs::next_addend): New function.
5292         * reloc.h (class Track_relocs): Declare next_addend.
5293
5294 2010-12-01  Ian Lance Taylor  <iant@google.com>
5295
5296         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5297         virtual destructor.
5298
5299 2010-12-01  Ian Lance Taylor  <iant@google.com>
5300
5301         * README: Update compilers known to work and fail.
5302
5303 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5304
5305         * configure.in: For --enable-gold, handle value `default' instead of
5306         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5307         not the default.
5308         * configure: Regenerate.
5309
5310 2010-11-18  Doug Kwan  <dougkwan@google.com>
5311
5312         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5313         and right_alignment to be zero.  Store result alignment only if it is
5314         greater than existing alignment.
5315
5316 2010-11-16  Cary Coutant  <ccoutant@google.com>
5317
5318         PR gold/12220
5319         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5320         Check for ".zdebug_line".
5321
5322 2010-11-16  Doug Kwan  <dougkwan@google.com>
5323             Cary Coutant  <ccoutant@google.com>
5324
5325         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5326         by reference; adjust all callers.
5327         * output.cc (Output_segment::set_section_addresses): Adjust references
5328         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5329         list is empty.
5330         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5331         end at page boundary.
5332
5333 2010-11-16  Cary Coutant  <ccoutant@google.com>
5334
5335         PR gold/12220
5336         * layout.cc (Layout::choose_output_section): Transform names of
5337         compressed sections even when using a script with a SECTIONS clause.
5338         (Layout::output_section_name): Remove code to transform
5339         compressed debug section names.
5340         * output.cc (Output_section::add_input_section): Use uncompressed
5341         section size when tracking input sections.
5342
5343 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5344
5345         * symtab.h (Symbol::NON_PIC_REF): Remove.
5346         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5347         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5348         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5349         (Symbol::use_plt_offset): Take a flags argument and pass it
5350         directly to needs_dynamic_reloc.  Restrict check for undefined
5351         weak symbols to function calls.
5352         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5353         (Target_arm::Scan::global): Use it.
5354         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5355         (Target_arm::Relocate::relocate): Likewise.
5356         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5357         parameter with an r_type parameter.  Use get_reference_flags
5358         to get the flags.
5359         (Target_arm::Relocate::relocate): Update accordingly.
5360         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5361         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5362         (Target_i386::Scan::global): Likewise.
5363         (Target_i386::Relocate::relocate): Likewise.
5364         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5365         parameter with an r_type parameter.  Use get_reference_flags
5366         to get the flags.
5367         (Target_i386::Relocate::relocate): Update accordingly.
5368         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5369         (Target_powerpc::Scan::global): Use it.
5370         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5371         (Target_powerpc::Relocate::relocate): Likewise.
5372         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5373         (Target_sparc::Scan::global): Use it.
5374         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5375         (Target_sparc::Relocate::relocate): Likewise.
5376         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5377         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5378         (Target_x86_64::Scan::global): Likewise.
5379         (Target_x86_64::Relocate::relocate): Likewise.
5380
5381 2010-11-08  Doug Kwan  <dougkwan@google.com>
5382             Cary Coutant  <ccoutant@google.com>
5383
5384         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5385         (Arm_exidx_merge_section::section_contents_): New data member.
5386         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5387         (Arm_input_section::~Arm_input_section): De-allocate memory.
5388         (Arm_input_section::original_contents_): New data member.
5389         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5390         in parameters instead of calling Object::section_contents without
5391         locking.
5392         (Arm_output_section::group_section): New parameter TASK.  Pass it
5393         to callees that need locking objects.
5394         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5395         to lock EXIDX input sections.  Fix a formatting issue.  Call
5396         Arm_exidx_merged_section::build_contents to create merged section
5397         contents.
5398         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5399         to lock object of stub table owner.
5400         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5401         TEXT_SIZE to initialize data member TEXT_SIZE_.
5402         (Arm_exidx_input_section::addralign): Fix typo in comment.
5403         (Arm_exidx_input_section::text_size): New method.
5404         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5405         that require locking objects.  Lock objects before scanning for stubs
5406         and updating local symbols.
5407         (Arm_input_section<big_endian>::init): Copy contents of original
5408         input section.
5409         (Arm_input_section<big_endian>::do_write): Use saved contents of
5410         original input section instead of calling Object::section_contents
5411         without locking.
5412         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5413         size without calling Object::section_size().
5414         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5415         for size.  Allocate a buffer for merged EXIDX entries.
5416         (Arm_exidx_merged_section::build_contents): New method.
5417         (Arm_exidx_merged_section::do_write): Move merge section contents
5418         building code to Arm_exidx_merged_section::build_contetns.  Write
5419         out contetns in buffer instead of building it on the fly.
5420         (Arm_relobj::make_exidx_input_section): Also pass text section size
5421         to Arm_exidx_input_section constructor.
5422         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5423         (Arm_dynobj::do_read_symbols): Fix memory leak.
5424         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5425         * target.h: (class Task): Add forward declaration.
5426         (Target::relax): Add new parameter TASK and pass it to
5427         Target::do_relax().
5428         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5429
5430 2010-11-05  Cary Coutant  <ccoutant@google.com>
5431
5432         PR gold/10708
5433         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5434         object when reading from the file.
5435         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5436         second layout pass.
5437         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5438         when reading section contents.
5439         (get_section_contents): Likewise.
5440         (icf::find_identical_sections): Likewise.
5441         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5442         object when reading from the file.
5443         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5444         the object when doing deferred section layout.
5445
5446 2010-11-03  Nick Clifton  <nickc@redhat.com>
5447
5448         PR gold/12001
5449         * script.h (class Symbol_assignment: name): New member.  Returns
5450         the name of the symbol.
5451         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5452         Returns true if the given symbol name is on the list of
5453         assignments wating to be processed.
5454         * archive.cc (should_incldue_member): If the symbol is undefined,
5455         check to see if it is on the list of symbols pending assignment.
5456
5457 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5458
5459         * script-sections.cc (Script_sections::find_memory_region): Check
5460         for a NULL output section pointer.
5461
5462 2010-10-29  Doug Kwan  <dougkwan@google.com>
5463
5464         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5465         Output_section::add_relaxed_input_section.
5466         * output.cc (Output_section::add_relaxed_input_section): Add new
5467         arguments LAYOUT and NAME.  Set section order index.
5468         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5469         Copy section order index.
5470         * output.h (Output_section::add_relaxed_input_section): Add new
5471         arguments LAYOUT and NAME.
5472
5473 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5474
5475         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5476         NATIVE_OR_CROSS_LINKER.
5477         * testsuite/Makefile.in: Regenerate.
5478
5479 2010-10-20  Doug Kwan  <dougkwan@google.com>
5480
5481         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5482         without SHF_LINK_ORDER flags.
5483         * layout.cc (Layout::choose_output_section): Do not filter
5484         SHF_LINK_ORDER flag in a relocatable link.
5485
5486 2010-10-17  Cary Coutant  <ccoutant@google.com>
5487
5488         * output.h (Output_segment::set_section_addresses): Change function
5489         signature.  Update all callers.
5490         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5491         sections.
5492         (Output_segment::set_section_addresses): Align after last TLS
5493         section.  Add padding before last relro section instead of after.
5494
5495 2010-10-17  Doug Kwan  <dougkwan@google.com>
5496
5497         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5498         GOT output section to be writable.
5499
5500 2010-10-14  Cary Coutant  <ccoutant@google.com>
5501
5502         * debug.h (DEBUG_INCREMENTAL): New flag.
5503         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5504         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5505         mode.
5506         * incremental.cc (report_command_line): Ignore all forms of
5507         --incremental.
5508         * layout.cc (Layout::Layout): Check parameters for incremental link
5509         mode.
5510         * options.cc (General_options::parse_incremental): New function.
5511         (General_options::parse_no_incremental): New function.
5512         (General_options::parse_incremental_full): New function.
5513         (General_options::parse_incremental_update): New function.
5514         (General_options::incremental_mode_): New data member.
5515         (General_options::finalize): Check incremental_mode_.
5516         * options.h (General_options): Update help text for --incremental.
5517         Add --no-incremental, --incremental-full, --incremental-update.
5518         (General_options::Incremental_mode): New enum type.
5519         (General_options::incremental_mode): New function.
5520         (General_options::incremental_mode_): New data member.
5521         * parameters.cc (Parameters::incremental_mode_): New data member.
5522         (Parameters::set_options): Set incremental_mode_.
5523         (Parameters::set_incremental_full): New function.
5524         (Parameters::incremental): New function.
5525         (Parameters::incremental_update): New function.
5526         (set_parameters_incremental_full): New function.
5527         * parameters.h (Parameters::set_incremental_full): New function.
5528         (Parameters::incremental): New function.
5529         (Parameters::incremental_update): New function.
5530         (Parameters::incremental_mode_): New data member.
5531         (set_parameters_incremental_full): New function.
5532         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5533         incremental link mode.
5534         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5535         (Sized_relobj::do_relocate_sections): Likewise.
5536         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5537         option.
5538         * testsuite/Makefile.in: Regenerate.
5539         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5540
5541 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5542
5543         * script-sections.h (class Script_sections): Make
5544         Sections_elements typedef public.
5545         * script-sections.cc (class Sort_output_sections): Add elements_
5546         field.  Add constructor which sets it; change all callers.
5547         (Sort_output_sections::is_before): New function.
5548         (Sort_output_sections::operator()): Call is_before.
5549         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5550         conditional.
5551         * testsuite/script_test_10.sh: New test. Test script section
5552         order.
5553         * testsuite/script_test_10.t: Likewise.
5554         * testsuite/script_test_10.s: Likewise.
5555         * testsuite/Makefile.am: Wrap the cross linker tests and the
5556         common tests into NATIVE_OR_CROSS_LINKER.
5557         (check_SCRIPTS): Add script_test_10.sh.
5558         (check_DATA): Add script_test_10.stdout.
5559         (script_test_10.o, script_test_10): New targets.
5560         (script_test_10.stdout): New target.
5561         * configure, testsuite/Makefile.in: Regenerate.
5562
5563 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5564
5565         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5566         error for the deprecated relocations.
5567         (Target_arm::Scan::global): Likewise.
5568         (Target_arm::Relocate::relocate): Likewise.
5569
5570 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5571
5572         * fileread.cc (Input_file::find_file): Initialize *found_name
5573         and *namep when using the fallback search for case 4.
5574
5575 2010-10-11  Cary Coutant  <ccoutant@google.com>
5576
5577         * options.h (class General_options): Redefine -z lazy as an alias for
5578         the negation of -z now.
5579
5580 2010-10-11  Ian Lance Taylor  <iant@google.com>
5581
5582         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5583         binding.
5584
5585 2010-10-06  Nick Clifton  <nickc@redhat.com>
5586
5587         * script-sections.cc(class Memory_region): Remove
5588         current_lma_offset_ field.  Rename current_vma_offset_ to
5589         current_offset_.  Add last_section_ field.
5590         (Memory_region::get_current_vma_address): Rename to
5591         get_current_address.
5592         (Memory_region::get_current_lma_address): Delete.
5593         (Memory_region::increment_vma_offset): Rename to
5594         increment_offset.
5595         (Memory_region::increment_lma_offset): Delete.
5596         (Memory_region::attributes_compatible): New method.  Returns
5597         true if the provided section is compatible with the region.
5598         (Memory_region::get_last_section): New method.  Returns the last
5599         section to use the region.
5600         (Memory_region::set_last_section): New method.  Stores the last
5601         section to use the region.
5602         (Script_sections::block_in_region): New method.  Returns true if
5603         a block of memory is contained within a region.
5604         (Script_sections::find_memory_region): New method.  Locates a
5605         memory region to be used to set a VMA or LMA address.
5606         (Output_section_definition::set_section_addresses): Add code to
5607         check for addresses set by memory regions.
5608         (Output_segment::set_section_addresses): Remove memory region
5609         walking code.
5610         (Script_sections::create_segment): Add a warning if a header
5611         segment is created outside of any region.
5612         * script-sections.h (class Script_sections): Add prototypes for
5613         find_memory_region and block_in_region methods.
5614         * testsuite/memory_test.s: Use .long instead of .word.
5615         * testsuite/memory_test.t: Add some more output sections.
5616         * testsuite/memory_test.sh: Update expected output.
5617
5618 2010-10-02  Doug Kwan  <dougkwan@google.com>
5619
5620         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5621         defintion to symtab.h
5622         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5623         declaration to defintion.
5624
5625 2010-10-01  Nick Clifton  <nickc@redhat.com>
5626
5627         * expression.cc (eval): Replace dummy argument with NULL.
5628         (eval_maybe_dot): Check for a NULL result section pointer.
5629         (Symbol_expression::value): Likewise.
5630         (Dot_expression::value): Likewise.
5631         (BINARY_EXPRESSION): Likewise.
5632         (Max_expression::value): Likewise.
5633         (Min_expression::value): Likewise.
5634         (Absolute_expression::value): Likewise.
5635         (Addr_expression::value_from_output_section): Likewise.
5636         (Loaddddr_expression::value_from_output_section): Likewise.
5637         (Segment_start_expression::value): Likewise.
5638         * script-sections.cc
5639         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5640         argument with NULL.
5641         (Sections_elememt_dot_assignment::set_section_addresses):
5642         Likewise.
5643         (Output_data_expression::do_write_to_buffer): Likewise.
5644         (Output_section_definition::finalize_symbols): Likewise.
5645         (Output_section_definition::set_section_addresses): Likewise.
5646
5647 2010-09-30  Doug Kwan  <dougkwan@google.com>
5648
5649         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5650
5651 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5652
5653         * target.h (Target::can_icf_inline_merge_sections): New virtual
5654         function.
5655         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5656         virtual function.
5657         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5658         virtual function.
5659         * icf.cc (get_section_contents): Inline merge sections only when
5660         target allows it.
5661
5662 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5663
5664         * configure: Regenerate.
5665
5666 2010-09-17  Ian Lance Taylor  <iant@google.com>
5667
5668         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5669         * testsuite/Makefile.am (memory_test.o): New target.
5670         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5671         memory_test.t.
5672         * testsuite/Makefile.in: Rebuild.
5673
5674 2010-09-17  Doug Kwan  <dougkwan@google.com>
5675
5676         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5677         defintion if relocation uses GOT entries of the symbol.
5678         * testsuite/icf_safe_test.sh: Fix test.
5679         * testsuite/icf_safe_so_test.sh: Fix test.
5680
5681 2010-09-16  Cary Coutant  <ccoutant@google.com>
5682
5683         * script_sections.cc (class Memory_region): Remove "NULL" from
5684         vector initializations.
5685
5686 2010-09-15  Cary Coutant  <ccoutant@google.com>
5687
5688         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5689         Resolve forwarding symbols.
5690
5691 2010-09-15  Doug Kwan  <dougkwan@google.com>
5692
5693         * gold/testsuite/script_test_3.t: Add ARM special sections.
5694         * gold/testsuite/script_test_4.t: Same.
5695         * gold/testsuite/script_test_5.t: Same.
5696         * gold/testsuite/script_test_6.t: Same.
5697         * gold/testsuite/script_test_7.t: Same.
5698         * gold/testsuite/script_test_7.t: Same.
5699         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5700
5701 2010-09-14  Cary Coutant  <ccoutant@google.com>
5702
5703         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5704         (Target_x86_64::Relocate::relocate_tls): Replace check for
5705         saw_tls_block_reloc_ with test for executable section.
5706
5707 2010-09-12  Cary Coutant  <ccoutant@google.com>
5708
5709         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5710         position-independent executables to shared libraries need dynamic
5711         relocations.
5712         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5713         position-independent executables.
5714         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5715         * testsuite/Makefile.in: Regenerate.
5716
5717 2010-09-10  Nick Clifton  <nickc@redhat.com>
5718
5719         PR gold/11997
5720         * testsuite/memory_test.t: Discard any sections that are not
5721         needed.
5722
5723 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5724
5725         PR gold/11996
5726         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5727         "This::" to work around a bug in gcc 4.2.
5728
5729         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5730
5731 2010-09-09  Rafael Espindola  <espindola@google.com>
5732
5733         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5734         sections with different PF_X flags in the same segment.
5735         (Layout::find_first_load_seg): Search all segments to find the first
5736         one.
5737         * options.h (rosegment): New.
5738
5739 2010-09-08  Rafael Espindola  <espindola@google.com>
5740
5741         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5742
5743 2010-09-08  Doug Kwan  <dougkwan@google.com>
5744
5745         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5746         (Arm_relobj::do_relocate_sections): Add new parameter for output
5747         file to match the parent.
5748         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5749         of local symbols instead of input values.  Update code to track
5750         changes in gold::relocate_section.
5751         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5752         (Sized_relobj::compute_final_local_value_internal): New methods.
5753         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5754         body into private version of Sized_relobj::compute_final_local_value.
5755         Call the inline method.
5756         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5757         merged symbol value if there is one.
5758         (Symbol_value::has_output_value): New method defintiion.
5759         (Sized_relobj::Compute_final_local_value_status): New enum type.
5760         (Sized_relobj::compute_final_local_value): New methods.
5761         (Sized_relobj::compute_final_local_value_internal): New methods.
5762         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5763         and arm_cortex_a8.sh.
5764         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5765         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5766         New tests.
5767         * Makefile.in: Regenerate.
5768         * testsuite/arm_bl_out_of_range.s: Update test.
5769         * testsuite/thumb_bl_out_of_range.s: Ditto.
5770         * testsuite/thumb_blx_out_of_range.s: Ditto.
5771         * testsuite/arm_branch_out_of_range.sh: New file.
5772         * testsuite/arm_cortex_a8.sh: Ditto.
5773         * testsuite/arm_cortex_a8_b.s: Ditto.
5774         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5775         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5776         * testsuite/arm_cortex_a8_bl.s: Ditto.
5777         * testsuite/arm_cortex_a8_blx.s: Ditto.
5778         * testsuite/arm_cortex_a8_local.s: Ditto.
5779         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5780         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5781
5782 2010-09-08  Rafael Espindola  <espindola@google.com>
5783
5784         * Makefile.am (memory_test.stdout): Run readelf with -W.
5785         * Makefile.in: Regenerate.
5786         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5787         64 bit output.
5788
5789 2010-09-08  Rafael Espindola  <espindola@google.com>
5790
5791         * script-sections.cc (Script_sections::add_memory_region): Convert
5792         field precision to int.
5793         * script.cc (script_set_section_region, script_set_section_region):
5794         Convert field precision to int.
5795
5796 2010-09-08  Rafael Espindola  <espindola@google.com>
5797
5798         * arm.cc (do_finalize_sections): Create the __exidx_start and
5799         __exdix_end symbols even when the section is missing.
5800
5801 2010-09-08  Nick Clifton  <nickc@redhat.com>
5802
5803         * README: Remove claim that MEMORY is not supported.
5804         * expression.cc (script_exp_function_origin)
5805         (script_exp_function_length): Move from here to ...
5806         * script.cc: ... here.
5807         (script_set_section_region, script_add_memory)
5808         (script_parse_memory_attr, script_include_directive): New
5809         functions.
5810         * script-sections.cc
5811         (class Memory_region): New class.
5812         (class Output_section_definition): Add set_memory_region,
5813         set_section_vma, set_section_lma and get_section_name methods.
5814         (class Script_Sections): Add add_memory_region,
5815         find_memory_region, find_memory_region_origin,
5816         find_memory_region_length and set_memory_region methods.
5817         Have set_section_addresses method walk the list of set memory
5818         regions.
5819         Extend the print methos to display memory regions.
5820         * script-sections.h: Add prototypes for new methods.
5821         Add enum for MEMORY region attributes.
5822         * yyscript.y: Add support for parsing MEMORY regions.
5823         * script-c.h: Add prototypes for new functions.
5824         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5825         * testsuite/Makefile.in: Regenerate.
5826         * testsuite/memory_test.sh: New script.
5827         * testsuite/memory_test.s: New assembler source file.
5828         * testsuite/memory_test.t: New linker script.
5829
5830 2010-08-27  Doug Kwan  <dougkwan@google.com>
5831
5832         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5833         reference override an existing dynamic weak reference.
5834         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5835         * testsuite/Makefile.in: Regenerate.
5836         * testsuite/dyn_weak_ref.sh: New file.
5837         * testsuite/dyn_weak_ref_1.c: Ditto.
5838         * testsuite/dyn_weak_ref_2.c: Ditto.
5839
5840 2010-08-27  Ian Lance Taylor  <iant@google.com>
5841
5842         * incremental.h (class Incremental_input_entry): Add virtual
5843         destructor.
5844
5845 2010-08-27  Ian Lance Taylor  <iant@google.com>
5846
5847         * testsuite/start_lib_test_3.c: Mark t3 as used.
5848
5849 2010-08-27  Nick Clifton  <nickc@redhat.com>
5850
5851         * options.cc (version_script): Fix small typo in previous
5852         whitespace tidyup.
5853
5854 2010-08-25  Nick Clifton  <nickc@redhat.com>
5855
5856         * archive.cc: Formatting fixes: Remove whitespace between
5857         typename and following asterisk.  Remove whitespace between
5858         function name and opening parenthesis.
5859         * archive.h: Likewise.
5860         * arm.cc: Likewise.
5861         * attributes.cc: Likewise.
5862         * attributes.h: Likewise.
5863         * common.cc: Likewise.
5864         * copy-relocs.cc: Likewise.
5865         * dirsearch.h: Likewise.
5866         * dynobj.cc: Likewise.
5867         * ehframe.cc: Likewise.
5868         * ehframe.h: Likewise.
5869         * expression.cc: Likewise.
5870         * fileread.cc: Likewise.
5871         * fileread.h: Likewise.
5872         * gc.h: Likewise.
5873         * gold-threads.cc: Likewise.
5874         * gold.cc: Likewise.
5875         * i386.cc: Likewise.
5876         * icf.h: Likewise.
5877         * incremental-dump.cc: Likewise.
5878         * incremental.cc: Likewise.
5879         * layout.cc: Likewise.
5880         * layout.h: Likewise.
5881         * main.cc: Likewise.
5882         * merge.cc: Likewise.
5883         * merge.h: Likewise.
5884         * object.cc: Likewise.
5885         * object.h: Likewise.
5886         * options.cc: Likewise.
5887         * options.h: Likewise.
5888         * output.cc: Likewise.
5889         * output.h: Likewise.
5890         * plugin.cc: Likewise.
5891         * plugin.h: Likewise.
5892         * powerpc.cc: Likewise.
5893         * reloc.cc: Likewise.
5894         * script-c.h: Likewise.
5895         * script-sections.cc: Likewise.
5896         * script.cc: Likewise.
5897         * stringpool.cc: Likewise.
5898         * symtab.cc: Likewise.
5899         * symtab.h: Likewise.
5900         * target.cc: Likewise.
5901         * timer.cc: Likewise.
5902         * timer.h: Likewise.
5903         * version.cc: Likewise.
5904         * x86_64.cc: Likewise.
5905
5906 2010-08-24  Nick Clifton  <nickc@redhat.com>
5907
5908         PR 11899
5909         * layout.cc (segment_precedes): Sort segments by their physical
5910         addresses, if they have been set.
5911
5912 2010-08-23  Cary Coutant  <ccoutant@google.com>
5913
5914         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5915         symbols data.
5916         (Lib_group::include_member): Unlock object after deleting its
5917         symbols data.
5918         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5919         the bug fixed here.
5920
5921 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5922             Cary Coutant  <ccoutant@google.com>
5923
5924         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5925         constructor, and set_blocker.
5926         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5927         readsyms_blocker_.
5928         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5929         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5930         * testsuite/Makefile.am (start_lib_test): New test case.
5931         * testsuite/Makefile.in: Regenerate.
5932         * testsuite/start_lib_test_main.c: New file.
5933         * testsuite/start_lib_test_1.c: New file.
5934         * testsuite/start_lib_test_2.c: New file.
5935         * testsuite/start_lib_test_3.c: New file.
5936
5937 2010-08-19  Ian Lance Taylor  <iant@google.com>
5938
5939         * Makefile.in: Rebuild with automake 1.11.1.
5940         * aclocal.m4: Likewise.
5941         * testsuite/Makefile.in: Likewise.
5942
5943 2010-08-19  Ian Lance Taylor  <iant@google.com>
5944
5945         PR 10893
5946         * i386.cc (class Output_data_plt_i386): Update declarations.
5947         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5948         local_ifuncs_ fields.
5949         (Target_i386::do_plt_section_for_global): New function.
5950         (Target_i386::do_plt_section_for_local): New function.
5951         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5952         parameter; change all callers.  Initialize global_ifuncs_ and
5953         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5954         __rel_iplt_end.
5955         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5956         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5957         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5958         symbols.
5959         (Target_i386::make_plt_section): New function, broken out of
5960         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5961         (Target_i386::make_plt_entry): Call make_plt_section.
5962         (Target_i386::make_local_ifunc_plt_entry): New function.
5963         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5964         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5965         R_386_IRELATIVE to switch.
5966         (Target_i386::Scan::global): Likewise.
5967         (Target_i386::Relocate::relocate): Likewise.
5968         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5969         switch.
5970         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5971         (Target_x86_64::do_plt_section_for_global): New function.
5972         (Target_x86_64::do_plt_section_for_local): New function.
5973         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5974         parameter; change all callers.  If doing a static link define
5975         __rela_iplt_start and __rela_iplt_end.
5976         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5977         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5978         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5979         to point to .plt.
5980         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5981         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5982         switch.
5983         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5984         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5985         R_X86_64_IRELATIVE to switch.
5986         (Target_x86_64::Scan::global): Likewise.
5987         (Target_x86_64::Relocate::relocate): Likewise.
5988         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5989         switch.
5990         * target.h (class Target): Add plt_section_for_global and
5991         plt_section_for_local functions.  Add do_plt_section_for_global
5992         and do_plt_section_for_local virtual functions.
5993         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5994         clarifying comments.
5995         (Symbol::use_plt_offset): Handle IFUNC symbol.
5996         * object.cc (Sized_relobj::Sized_relobj): Initialize
5997         local_plt_offsets_.
5998         (Sized_relobj::local_has_plt_offset): New function.
5999         (Sized_relobj::local_plt_offset): New function.
6000         (Sized_relobj::set_local_plt_offset): New function.
6001         (Sized_relobj::do_count): Handle IFUNC symbol.
6002         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6003         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6004         is_ifunc_symbol functions.
6005         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6006         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6007         local_plt_offsets_ field.
6008         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6009         * output.h (class Output_section_data): Add non-const
6010         output_section function.
6011         (class Output_data_got): Update declarations.
6012         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6013         Add use_plt_offset parameter to global and local constructors.
6014         Change all callers.  Change local_sym_index_ field to 31 bits.
6015         Change GSYM_CODE and CONSTANT_CODE accordingly.
6016         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6017         doing a static link don't set sh_link field.
6018         (Output_data_got::Got_entry::write): Use PLT offset if
6019         appropriate.
6020         (Output_data_got::add_global_plt): New function.
6021         (Output_data_got::add_local_plt): New function.
6022         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6023         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6024         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6025         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6026         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6027         IFUNC conditional.
6028         * testsuite/ifunc-sel.h: New file.
6029         * testsuite/ifuncmain1.c: New file.
6030         * testsuite/ifuncmain1vis.c: New file.
6031         * testsuite/ifuncmod1.c: New file.
6032         * testsuite/ifuncdep2.c: New file.
6033         * testsuite/ifuncmain2.c: New file.
6034         * testsuite/ifuncmain3.c: New file.
6035         * testsuite/ifuncmod3.c: New file.
6036         * testsuite/ifuncmain4.c: New file.
6037         * testsuite/ifuncmain5.c: New file.
6038         * testsuite/ifuncmod5.c: New file.
6039         * testsuite/ifuncmain6pie.c: New file.
6040         * testsuite/ifuncmod6.c: New file.
6041         * testsuite/ifuncmain7.c: New file.
6042         * configure, testsuite/Makefile.in: Rebuild.
6043
6044 2010-08-18  Ian Lance Taylor  <iant@google.com>
6045
6046         * incremental.cc
6047         (Output_section_incremental_inputs::write_input_files): Add cast
6048         to avoid signed/unsigned comparison warning.
6049         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6050
6051 2010-08-12  Cary Coutant  <ccoutant@google.com>
6052
6053         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6054
6055 2010-08-13  Ian Lance Taylor  <iant@google.com>
6056
6057         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6058
6059 2010-08-12  Cary Coutant  <ccoutant@google.com>
6060             Doug Kwan  <dougkwan@google.com>
6061
6062         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6063         defintion overrides non-weak undef, remember that the original undef
6064         is not weak.
6065         * symtab.cc (Symbol_table::sized_write_global): For undef without
6066         an original weak binding, set binding to global in output.
6067         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6068         * testsuite/Makefile.in: Regenerate.
6069         * testsuite/strong_ref_weak_def.sh: New file.
6070         * testsuite/strong_ref_weak_def_1.c: Ditto.
6071         * testsuite/strong_ref_weak_def_2.c: Ditto.
6072
6073 2010-08-12  Cary Coutant  <ccoutant@google.com>
6074
6075         * testsuite/incremental_test.sh: Rewrite.
6076         * testsuite/incremental_test_1.c: Rewrite.
6077         * testsuite/incremental_test_2.c: Rewrite.
6078
6079 2010-08-12  Cary Coutant  <ccoutant@google.com>
6080
6081         * arm.cc (Target_arm::got_size): Add const.
6082         (Target_arm::got_entry_count): New function.
6083         (Target_arm::plt_entry_count): New function.
6084         (Target_arm::first_plt_entry_offset): New function.
6085         (Target_arm::plt_entry_size): New function.
6086         (Output_data_plt_arm::entry_count): New function.
6087         (Output_data_plt_arm::first_plt_entry_offset): New function.
6088         (Output_data_plt_arm::get_plt_entry_size): New function.
6089         * i386.cc (Target_i386::got_size): Add const.
6090         (Target_i386::got_entry_count): New function.
6091         (Target_i386::plt_entry_count): New function.
6092         (Target_i386::first_plt_entry_offset): New function.
6093         (Target_i386::plt_entry_size): New function.
6094         (Output_data_plt_i386::entry_count): New function.
6095         (Output_data_plt_i386::first_plt_entry_offset): New function.
6096         (Output_data_plt_i386::get_plt_entry_size): New function.
6097         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6098         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6099         * incremental.cc: Include target.h.
6100         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6101         parameter.  Adjust all callers.  Find incremental_got_plt section.
6102         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6103         section.
6104         (Output_section_incremental_inputs::set_final_data_size): Calculate
6105         size of incremental_got_plt section.
6106         (Output_section_incremental_inputs::do_write): Write the
6107         incremental_got_plt section.
6108         (Got_plt_view_info): New struct.
6109         (Local_got_offset_visitor): New class.
6110         (Global_got_offset_visitor): New class.
6111         (Global_symbol_visitor_got_plt): New class.
6112         (Output_section_incremental_inputs::write_got_plt): New function.
6113         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6114         Add parameter.  Adjust all callers.
6115         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6116         (Incremental_inputs::got_plt_section): New function.
6117         (Incremental_inputs::got_plt_section_): New data member.
6118         (Incremental_got_plt_reader): New class.
6119         * layout.cc (Layout::create_incremental_info_sections): Add the
6120         incremental_got_plt section.
6121         * object.h (Got_offset_list::get_list): New function.
6122         (Got offset_list::for_all_got_offsets): New function.
6123         (Sized_relobj::local_got_offset_list): New function.
6124         * powerpc.cc (Target_powerpc::got_size): Add const.
6125         (Target_powerpc::got_entry_count): New function.
6126         (Target_powerpc::plt_entry_count): New function.
6127         (Target_powerpc::first_plt_entry_offset): New function.
6128         (Target_powerpc::plt_entry_size): New function.
6129         (Output_data_plt_powerpc::entry_count): New function.
6130         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6131         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6132         * sparc.cc (Target_sparc::got_size): Add const.
6133         (Target_sparc::got_entry_count): New function.
6134         (Target_sparc::plt_entry_count): New function.
6135         (Target_sparc::first_plt_entry_offset): New function.
6136         (Target_sparc::plt_entry_size): New function.
6137         (Output_data_plt_sparc::entry_count): New function.
6138         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6139         (Output_data_plt_sparc::get_plt_entry_size): New function.
6140         * symtab.h (Symbol::got_offset_list): New function.
6141         (Symbol_table::for_all_symbols): New function.
6142         * target.h (Sized_target::got_entry_count): New function.
6143         (Sized_target::plt_entry_count): New function.
6144         (Sized_target::plt_entry_size): New function.
6145         * x86_64.cc (Target_x86_64::got_size): Add const.
6146         (Target_x86_64::got_entry_count): New function.
6147         (Target_x86_64::plt_entry_count): New function.
6148         (Target_x86_64::first_plt_entry_offset): New function.
6149         (Target_x86_64::plt_entry_size): New function.
6150         (Output_data_plt_x86_64::entry_count): New function.
6151         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6152         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6153
6154 2010-08-12  Cary Coutant  <ccoutant@google.com>
6155
6156         * archive.cc: Include incremental.h.
6157         (Archive::Archive): Initialize incremental_info_.
6158         (Archive::include_member): Record archive members in incremental info.
6159         (Add_archive_symbols::run): Record begin and end of an archive in
6160         incremental info.
6161         (Lib_group::include_member): Record objects in incremental info.
6162         * archive.h (Incremental_archive_entry): Forward declaration.
6163         (Archive::set_incremental_info): New member function.
6164         (Archive::incremental_info): New member function.
6165         (Archive::Unused_symbol_iterator): New class.
6166         (Archive::unused_symbols_begin): New member function.
6167         (Archive::unused_symbols_end): New member function.
6168         (Archive::incremental_info_): New data member.
6169         * incremental-dump.cc (find_input_containing_global): New function.
6170         (dump_incremental_inputs): Dump new incremental info sections.
6171         * incremental.cc: Include symtab.h.
6172         (Output_section_incremental_inputs): New class.
6173         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6174         new incremental info sections.
6175         (Sized_incremental_binary::do_check_inputs): Likewise.
6176         (Incremental_inputs::report_archive): Remove.
6177         (Incremental_inputs::report_archive_begin): New function.
6178         (Incremental_inputs::report_archive_end): New function.
6179         (Incremental_inputs::report_object): New function.
6180         (Incremental_inputs::finalize_inputs): Remove.
6181         (Incremental_inputs::report_input_section): New function.
6182         (Incremental_inputs::report_script): Rewrite.
6183         (Incremental_inputs::finalize): Do nothing but finalize string table.
6184         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6185         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6186         (Incremental_inputs::create_data_sections): New function.
6187         (Incremental_inputs::relocs_entsize): New function.
6188         (Output_section_incremental_inputs::set_final_data_size): New function.
6189         (Output_section_incremental_inputs::do_write): New function.
6190         (Output_section_incremental_inputs::write_header): New function.
6191         (Output_section_incremental_inputs::write_input_files): New function.
6192         (Output_section_incremental_inputs::write_info_blocks): New function.
6193         (Output_section_incremental_inputs::write_symtab): New function.
6194         * incremental.h (Incremental_script_entry): Forward declaration.
6195         (Incremental_object_entry): Forward declaration.
6196         (Incremental_archive_entry): Forward declaration.
6197         (Incremental_inputs): Forward declaration.
6198         (Incremental_inputs_header_data): Remove.
6199         (Incremental_inputs_header): Remove.
6200         (Incremental_inputs_header_write): Remove.
6201         (Incremental_inputs_entry_data): Remove.
6202         (Incremental_inputs_entry): Remove.
6203         (Incremental_inputs_entry_write): Remove.
6204         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6205         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6206         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6207         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6208         Likewise.
6209         (Incremental_input_entry): New class.
6210         (Incremental_script_entry): New class.
6211         (Incremental_object_entry): New class.
6212         (Incremental_archive_entry): New class.
6213         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6214         (Incremental_inputs::report_inputs): Remove.
6215         (Incremental_inputs::report_archive): Remove.
6216         (Incremental_inputs::report_archive_begin): New function.
6217         (Incremental_inputs::report_archive_end): New function.
6218         (Incremental_inputs::report_object): Change prototype.
6219         (Incremental_inputs::report_input_section): New function.
6220         (Incremental_inputs::report_script): Change prototype.
6221         (Incremental_inputs::get_reloc_count): New function.
6222         (Incremental_inputs::set_reloc_count): New function.
6223         (Incremental_inputs::create_data_sections): New function.
6224         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6225         (Incremental_inputs::inputs_section): New function.
6226         (Incremental_inputs::symtab_section): New function.
6227         (Incremental_inputs::relocs_section): New function.
6228         (Incremental_inputs::get_stringpool): Add const.
6229         (Incremental_inputs::command_line): Add const.
6230         (Incremental_inputs::inputs): Remove.
6231         (Incremental_inputs::command_line_key): New function.
6232         (Incremental_inputs::input_file_count): New function.
6233         (Incremental_inputs::input_files): New function.
6234         (Incremental_inputs::relocs_entsize): New function.
6235         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6236         (Incremental_inputs::finalize_inputs): Remove.
6237         (Incremental_inputs::Input_info): Remove.
6238         (Incremental_inputs::lock_): Remove.
6239         (Incremental_inputs::inputs_): Change type.
6240         (Incremental_inputs::inputs_map_): Remove.
6241         (Incremental_inputs::current_object_entry_): New data member.
6242         (Incremental_inputs::inputs_section_): New data member.
6243         (Incremental_inputs::symtab_section_): New data member.
6244         (Incremental_inputs::relocs_section_): New data member.
6245         (Incremental_inputs::reloc_count_): New data member.
6246         (Incremental_inputs_reader): New class.
6247         (Incremental_symtab_reader): New class.
6248         (Incremental_relocs_reader): New class.
6249         * layout.cc (Layout::finalize): Move finalization of incremental info
6250         and creation of incremental info sections to follow finalization of
6251         symbol table.  Set offsets for postprocessing sections.
6252         (Layout::create_incremental_info_sections): Call
6253         Incremental_inputs::create_data_sections.  Add incremental symtab
6254         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6255         sections to layout after input sections.
6256         * layout.h (struct Timespec): Forward declaration.
6257         (Layout::incremental_inputs): Add const.
6258         (Layout::create_incremental_info_sections): Add parameter.
6259         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6260         * object.cc: Include incremental.h.
6261         (Relobj::finalize_incremental_relocs): New function.
6262         (Sized_relobj::do_layout): Record input sections in incremental info.
6263         * object.h (Object::output_section): New function.
6264         (Object::output_section_offset): Moved from Relobj.
6265         (Object::get_incremental_reloc_base): New function.
6266         (Object::get_incremental_reloc_count): New function.
6267         (Object::do_output_section): New function.
6268         (Object::do_output_section_offset): Moved from Relobj.
6269         (Object::do_get_incremental_reloc_base): New function.
6270         (Object::do_get_incremental_reloc_count): New function.
6271         (Object::Object): Initialize new data members.
6272         (Relobj::output_section): Renamed do_output_section and moved to
6273         protected.
6274         (Relobj::output_section_offset): Moved to Object.
6275         (Relobj::do_get_incremental_reloc_base): New function.
6276         (Relobj::do_get_incremental_reloc_count): New function.
6277         (Relobj::allocate_incremental_reloc_counts): New function.
6278         (Relobj::count_incremental_reloc): New function.
6279         (Relobj::finalize_incremental_relocs): New function.
6280         (Relobj::next_incremental_reloc_index): New function.
6281         (Relobj::reloc_counts_): New data member.
6282         (Relobj::reloc_bases_): New data member.
6283         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6284         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6285         (Sized_relobj::incremental_relocs_scan): New function.
6286         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6287         (Sized_relobj::incremental_relocs_write): New function.
6288         (Sized_relobj::incremental_relocs_write_reltype): New function.
6289         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6290         incremental link.
6291         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6292         archives and object files elsewhere.
6293         (Add_symbols::run): Report object files here.
6294         (Finish_group::run): Report end of archive at end of group.
6295         * reloc.cc: Include layout.h, incremental.h.
6296         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6297         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6298         (Sized_relobj::incremental_relocs_scan): New function.
6299         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6300         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6301         (Sized_relobj::incremental_relocs_write): New function.
6302         (Sized_relobj::incremental_relocs_write_reltype): New function.
6303         * script.cc (read_input_script): Rewrite test for incremental link.
6304         Change call to Incremental_inputs::report_script.
6305         * symtab.h (Symbol_table::first_global_index): New function.
6306         (Symbol_table::output_count): New function.
6307
6308 2010-08-12  Doug Kwan  <dougkwan@google.com>
6309
6310         * arm.cc (Target_arm::merge_object_attributes): Check command line
6311         options --no-wchar-size-warning and --no-enum-size-warning.
6312         * options.h (General_options): Add ld-compatible options
6313         --no-enum-size-warning and --no-wchar-size-warning.
6314
6315 2010-08-04  Ian Lance Taylor  <iant@google.com>
6316
6317         * x86_64.cc (Target_x86_64::Scan::local): Use
6318         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6319         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6320         (Target_x86_64::Scan::global): Likewise.
6321         (Target_x86_64::Relocate::relocate): Likewise.
6322         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6323         Likewise.
6324
6325 2010-08-03  Cary Coutant  <ccoutant@google.com>
6326
6327         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6328         to reserve space in merged_strings vector. Keep total input size
6329         for stats.
6330         (Output_merge_string::do_print_merge_stats): Print total input size.
6331         * merge.h (Output_merge_string): Add input_size_ field.
6332         * stringpool.cc (Stringpool_template::string_length): Move
6333         implementations out of Stringpool_template class and place in
6334         stringpool.h.
6335         * stringpool.h (string_length): Move out of Stringpool_template.
6336
6337 2010-08-03  Ian Lance Taylor  <iant@google.com>
6338
6339         PR 11712
6340         * layout.cc (relaxation_loop_body): If address of load segment is
6341         set, adjust address to include headers if possible.
6342
6343 2010-08-03  Ian Lance Taylor  <iant@google.com>
6344
6345         * version.cc (version_string): Bump to 1.10.
6346
6347 2010-08-03  Ian Lance Taylor  <iant@google.com>
6348
6349         PR 11805
6350         * layout.h (enum Output_section_order): Define.
6351         (class Layout): Update declarations.
6352         * layout.cc (Layout::get_output_section): Add order parameter.
6353         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6354         is_first_non_relro parameters.  Change all callers.
6355         (Layout::choose_output_section): Likewise.
6356         (Layout::add_output_section_data): Likewise.
6357         (Layout::make_output_section): Likewise.  Set order.
6358         (Layout::default_section_order): New function.
6359         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6360         * output.cc (Output_section::Output_section): Initialize order_.
6361         Don't initialize deleted fields.
6362         (Output_segment::Output_segment): Don't initialize deleted
6363         fields.
6364         (Output_segment::add_output_section_to_load): New function
6365         replacing add_output_section.  Change all callers to call this or
6366         add_output_section_to_nonload.
6367         (Output_segment::add_output_section_to_nonload): New function.
6368         (Output_segment::remove_output_section): Rewrite.
6369         (Output_segment::add_initial_output_data): Likewise.
6370         (Output_segment::has_any_data_sections): Likewise.
6371         (Output_segment::is_first_section_relro): Likewise.
6372         (Output_segment::maximum_alignment): Likewise.
6373         (Output_segment::has_dynamic_reloc): New function replacing
6374         dynamic_reloc_count.  Change all callers.
6375         (Output_segment::has_dynamic_reloc_list): New function replacing
6376         dynamic_reloc_count_list.  Change all callers.
6377         (Output_segment::set_section_addresses): Rewrite.
6378         (Output_segment::set_offset): Rewrite.
6379         (Output_segment::find_first_and_last_list): Remove.
6380         (Output_segment::set_tls_offsets): Rewrite.
6381         (Output_segment::first_section_load_address): Likewise.
6382         (Output_segment::output_section_count): Likewise.
6383         (Output_segment::section_with_lowest_load_address): Likewise.
6384         (Output_segment::write_section_headers): Likewise.
6385         (Output_segment::print_sections_to_map): Likewise.
6386         * output.h (class Output_data): Remove dynamic_reloc_count_
6387         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6388         (Output_data::add_dynamic_reloc): Rewrite.
6389         (Output_data::has_dynamic_reloc): New function.
6390         (Output_data::dynamic_reloc_count): Remove.
6391         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6392         is_last_relro_, is_first_non_relro_, is_interp_,
6393         is_dynamic_linker_section_ fields.  Add order and set_order
6394         functions.  Remove is_relro_local, set_is_relro_local,
6395         is_last_relro, set_is_last_relro, is_first_non_relro,
6396         set_is_first_non_relro functions, is_interp, set_is_interp,
6397         is_dynamic_linker_section, and set_is_dynamic_linker_section
6398         functions.
6399         (class Output_segment): Change Output_data_list from std::list to
6400         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6401         output_bss_ fields.  Update declarations.
6402
6403 2010-08-02  Ian Lance Taylor  <iant@google.com>
6404
6405         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6406         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6407         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6408
6409 2010-08-02  Ian Lance Taylor  <iant@google.com>
6410
6411         PR 11855
6412         * script.cc (Script_options::Script_options): Initialize
6413         symbol_definitions_ and symbol_references_.
6414         (Script_options::add_symbol_assignment): Update
6415         symbol_definitions_ and symbol_references_.
6416         (Script_options::add_symbol_reference): New function.
6417         (script_symbol): New function.
6418         * script.h (class Script_options): Add symbol_definitions_ and
6419         symbol_references_ fields.
6420         (Script_options::referenced_const_iterator): New type.
6421         (Script_options::referenced_begin): New function.
6422         (Script_options::referenced_end): New function.
6423         (Script_options::is_referenced): New function.
6424         (Script_options::any_unreferenced): New function.
6425         * script-c.h (script_symbol): Declare.
6426         * yyscript.y (exp): Call script_symbol.
6427         * symtab.cc: Include "script.h".
6428         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6429         Change all callers.  Check symbols referenced by scripts.
6430         (Symbol_table::add_undefined_symbols_from_command_line): Add
6431         layout parameter.  Change all callers.
6432         (Symbol_table::do_add_undefined_symbols_from_command_line):
6433         Likewise.  Break out loop body.  Check symbols referenced by
6434         scripts.
6435         (Symbol_table::add_undefined_symbol_from_command_line): New
6436         function broken out of
6437         do_add_undefined_symbols_from_command_line.
6438         * symtab.h (class Symbol_table): Update declarations.
6439         * archive.cc: Include "layout.h".
6440         (Archive::should_include_member): Add layout parameter.  Change
6441         all callers.  Check for symbol mentioned in expression.
6442         * archive.h (class Archive): Update declaration.
6443         * object.cc (Sized_relobj::do_should_include_member): Add layout
6444         parameter.
6445         * object.h (Object::should_include_member): Add layout parameter.
6446         Change all callers.
6447         (Object::do_should_include_member): Add layout parameter.
6448         (class Sized_relobj): Update declaration.
6449         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6450         parameter.
6451         * dynobj.h (class Sized_dynobj): Update declaration.
6452         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6453         layout parameter.
6454         * plugin.h (class Sized_pluginobj): Update declaration.
6455
6456 2010-08-02  Ian Lance Taylor  <iant@google.com>
6457
6458         PR 11866
6459         * output.cc (Output_segment::set_offset): Search for the first and
6460         last sections rather than assuming that the list is in order.
6461         (Output_segment::find_first_and_last_list): New function.
6462         * output.h (class Output_segment): Update declarations.
6463         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6464         (relro_strip_test_SOURCES): New variable.
6465         (relro_strip_test_DEPENDENCIES): New variable.
6466         (relro_strip_test_LDFLAGS): New variable.
6467         (relro_strip_test_LDADD): New variable.
6468         (relro_strip_test.so): New target.
6469
6470 2010-08-02  Ian Lance Taylor  <iant@google.com>
6471
6472         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6473         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6474         (Target_i386::got_tlsdesc_section): New function.
6475         (Target_i386::got_section): Create space for GOT entries for
6476         TLSDESC relocations.
6477         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6478         R_386_TLS_GOTDESC.
6479         (Target_i386::Scan::global): Likewise.
6480         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6481         using TLSDESC GOT.
6482         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6483         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6484         (Target_x86_64::got_tlsdesc_section): New function.
6485         (Target_x86_64::got_section): Create space for GOT entries for
6486         TLSDESC relocations.
6487         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6488         R_386_TLS_GOTDESC.
6489         (Target_x86_64::Scan::global): Likewise.
6490         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6491         using TLSDESC GOT.
6492
6493 2010-08-02  Ian Lance Taylor  <iant@google.com>
6494
6495         * testsuite/final_layout.sh: Use dc to convert from hex to
6496         decimal.
6497
6498 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6499
6500         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6501         paramter to the call to gold::gc_process_relocs.
6502         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6503         paramter to the call to gold::gc_process_relocs.
6504         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6505         parameter to the call to gold::gc_process_relocs.
6506         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6507         template parameter to the call to gold::gc_process_relocs.
6508         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6509         paramter to the call to gold::gc_process_relocs.
6510         * gc.h (get_embedded_addend_size): New function.
6511         (gc_process_relocs): Save the size of the reloc for use by ICF.
6512         * icf.cc (get_section_contents): Get the addend from the text section
6513         for SHT_REL relocation sections.
6514         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6515         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6516         * int_encoding.h (read_from_pointer): New overloaded function.
6517         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6518         * testsuite/icf_sht_rel_addend_test.sh: New file.
6519         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6520         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6521
6522 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6523
6524         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6525         * Makefile.in: Regenerate.
6526         * testsuite/Makefile.in: Regenerate.
6527
6528 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6529
6530         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6531         * gold/testsuite/debug_msg.cc: Likewise.
6532         * gold/testsuite/odr_violation1.cc
6533         * gold/testsuite/odr_violation2.cc
6534
6535 2010-07-21  Cary Coutant  <ccoutant@google.com>
6536
6537         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6538         string, and length fields.
6539         (Output_merge_string::Merged_strings_list): New type.
6540         (Output_merge_string::Merged_strings_lists): New typedef.
6541         (Output_merge_string): Replace merged_strings_ with
6542         merged_strings_lists_.
6543         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6544         Merged_strings_list per input object and section.  Don't store pointer
6545         to the string.  Don't store length with each merged string entry.
6546         (Output_merge_string::finalize_merged_data): Loop over list of merged
6547         strings lists.  Recompute length of each merged string.
6548
6549 2010-07-15  Cary Coutant  <ccoutant@google.com>
6550
6551         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6552         here.
6553
6554 2010-07-14  Ian Lance Taylor  <iant@google.com>
6555
6556         * descriptors.cc (Descriptors::open): Report correct name in error
6557         message.
6558
6559 2010-07-13  Doug Kwan  <dougkwan@google.com>
6560
6561         * arm.cc (Arm_input_section::Arm_input_section): For a
6562         SHT_ARM_EXIDX section, always keeps the input sections.
6563         (Arm_input_section::set_exidx_section_link): New method.
6564         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6565         has_errors_ to false.
6566         (Arm_exidx_input_section::has_errors,
6567         Arm_exidx_input_section::set_has_errors): New methods.
6568         (Arm_exidx_input_section::has_errors_): New data member.
6569         (Arm_relobj::get_exidx_shndx_list): New method.
6570         (Arm_output_section::append_text_sections_to_list): Do not skip
6571         section without SHF_EXECINSTR.
6572         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6573         errors.
6574         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6575         section header.  Make error messages more verbose.  Check for
6576         a non-executable section linked to an EXIDX section.
6577         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6578         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6579         check that there is no deferred EXIDX section if we exit early.
6580         Instead of not making an EXIDX section in case of an error, make one
6581         and set the has_errors flag of it.
6582         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6583         in a relocatable link.
6584         (Target_arm::do_relax): Look for the EXIDX output section instead of
6585         assuming that it is called .ARM.exidx.
6586         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6587         section list.  Do not check for SHF_EXECINSTR section flags but
6588         skip any input section with errors.
6589         * output.cc (Output_section::Output_section): Initialize
6590         always_keeps_input_sections_ to false.
6591         (Output_section::add_input_section): Check for
6592         always_keeps_input_sections_.
6593         *  output.h (Output_section::always_keeps_input_sections,
6594         Output_section::set_always_keeps_input_sections): New methods.
6595         (Output_section::always_keeps_input_sections): New data member.
6596
6597 2010-07-13  Rafael Espindola  <espindola@google.com>
6598
6599         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6600         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6601
6602 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6603             Ian Lance Taylor  <iant@google.com>
6604
6605         * output.h (Output_section_lookup_maps::add_merge_section):
6606         Correct check of whether value was inserted.
6607         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6608         (Output_section_lookup_maps::add_relaxed_input_section):
6609         Likewise.
6610         * arm.cc (Target_arm::got_section): Remove used local os.
6611         * i386.cc (Target_i386::got_section): Likewise.
6612         * x86_64.cc (Target_x86_64::got_section): Likewise.
6613         * sparc.cc (Target_sparc::got_section): Likewise.
6614         (Target_sparc::relocate): Remove unused local have_got_offset.
6615         * powerpc.cc (Target_powerpc::relocate): Likewise.
6616
6617 2010-07-13  Ian Lance Taylor  <iant@google.com>
6618
6619         * compressed_output.cc (zlib_decompress): Fix signature in
6620         !HAVE_ZLIB_H case.
6621
6622         * archive.cc (Archive::include_member): Unlock an external member
6623         of a thin archive.  Don't bother to delete an object we know is
6624         NULL.
6625
6626 2010-07-12  Cary Coutant  <ccoutant@google.com>
6627
6628         * compressed_output.cc (zlib_decompress): New function.
6629         (get_uncompressed_size): New function.
6630         (decompress_input_section): New function.
6631         * compressed_output.h (get_uncompressed_size): New function.
6632         (decompress_input_section): New function.
6633         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6634         Handle compressed debug sections.
6635         * layout.cc (is_compressed_debug_section): New function.
6636         (Layout::output_section_name): Map compressed section names to
6637         canonical names.
6638         * layout.h (is_compressed_debug_section): New function.
6639         (is_debug_info_section): Recognize compressed debug sections.
6640         * merge.cc: Include compressed_output.h.
6641         (Output_merge_data::do_add_input_section): Handle compressed
6642         debug sections.
6643         (Output_merge_string::do_add_input_section): Handle compressed
6644         debug sections.
6645         * object.cc: Include compressed_output.h.
6646         (Sized_relobj::Sized_relobj): Initialize new data members.
6647         (build_compressed_section_map): New function.
6648         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6649         * object.h (Object::section_is_compressed): New method.
6650         (Object::do_section_is_compressed): New method.
6651         (Sized_relobj::Compressed_section_map): New type.
6652         (Sized_relobj::do_section_is_compressed): New method.
6653         (Sized_relobj::compressed_sections_): New data member.
6654         * output.cc (Output_section::add_input_section): Handle compressed
6655         debug sections.
6656         * reloc.cc: Include compressed_output.h.
6657         (Sized_relobj::write_sections): Handle compressed debug sections.
6658
6659 2010-07-08  Cary Coutant  <ccoutant@google.com>
6660
6661         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6662         weak when resolving to a dynamic def.
6663         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6664         for weak undef/dynamic def cases. Adjust callers.
6665         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6666         undef_binding_weak_.
6667         (Symbol_table::sized_write_globals): Adjust symbol binding.
6668         (Symbol_table::sized_write_symbol): Add binding parameter.
6669         * symtab.h (Symbol::set_undef_binding): New method.
6670         (Symbol::is_undef_binding_weak): New method.
6671         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6672         (Symbol_table::should_override): Add new parameter.
6673         (Symbol_table::sized_write_symbol): Add new parameter.
6674
6675         * testsuite/weak_undef_file1.cc: Add new test case.
6676         * testsuite/weak_undef_file2.cc: Fix header comment.
6677         * testsuite/weak_undef_test.cc: Add new test case.
6678
6679 2010-06-29  Doug Kwan  <dougkwan@google.com>
6680
6681         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6682         Initialize USE_SYMBOL_.
6683         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6684         definition.
6685         (Arm_reloc_property::uses_symbol_): New data member declaration.
6686         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6687         uses symbol value and symbol is undefined but not weakly undefined.
6688
6689 2010-06-28  Rafael Espindola  <espindola@google.com>
6690
6691         * plugin.cc (Plugin::load): Use dlerror.
6692
6693 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6694
6695         * symtab.cc (detect_odr_violations): When reporting an ODR
6696         violation, report an object where the symbol is defined.
6697
6698 2010-06-25  Doug Kwan  <dougkwan@google.com>
6699
6700         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6701         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6702         definition.
6703         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6704         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6705         target hook to detect function points.
6706         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6707         * icf.h (Icf::check_section_for_function_pointers): Change type of
6708         parameter SECTION_NAME to const reference to std::string.  Use
6709         target hook to determine if section may have unsafe pointers.
6710         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6711         method definition.
6712
6713 2010-06-21  Rafael Espindola  <espindola@google.com>
6714
6715         * fileread.cc (Input_file::find_fie): New
6716         (Input_file::open): Use Input_file::find_fie.
6717         * fileread.h (Input_file::find_fie): New
6718         * plugin.cc (set_extra_library_path): New.
6719         (Plugin::load): Add set_extra_library_path to the transfer vector.
6720         (Plugin_manager::set_extra_library_path): New.
6721         (Plugin_manager::add_input_file): Use the extra search path if set.
6722         (set_extra_library_path(): New.
6723         * plugin.h (Plugin_manager): Add set_extra_library_path and
6724         extra_search_path_.
6725
6726 2010-06-19  Cary Coutant  <ccoutant@google.com>
6727
6728         * layout.cc (gdb_sections): Add .debug_types.
6729         (lines_only_debug_sections): Likewise.
6730
6731 2010-06-18  Rafael Espindola  <espindola@google.com>
6732
6733         * plugin.cc (add_input_file,add_input_library)
6734         (Plugin_manager::add_input_file): Make filename arguments const.
6735         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6736         const.
6737
6738 2010-06-16  Doug Kwan  <dougkwan@google.com>
6739
6740         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6741         .ARM.attributes section if we have not merged any input
6742         attributes sections.
6743
6744 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6745
6746         * arm.cc: Allow combining objects with no EABI version
6747         information.
6748
6749 2010-06-15  Rafael Espindola  <espindola@google.com>
6750
6751         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6752
6753 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6754
6755         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6756         (struct iovec): Correct !HAVE_READV definition.
6757
6758 2010-06-10  Cary Coutant  <ccoutant@google.com>
6759
6760         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6761         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6762         reloc sections.
6763         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6764
6765         PR 11683
6766         * symtab.h (Symbol::is_placeholder): New member function.
6767         * target-reloc.h (relocate_section): Check for placeholder symbols.
6768
6769         * testsuite/Makefile.am (plugin_test_8): New test.
6770         (plugin_test_9): New test.
6771         * testsuite/Makefile.in: Regenerate.
6772
6773 2010-06-09  Nick Clifton  <nickc@redhat.com>
6774
6775         * yyscript.y (input_list_element): Allow strings prefixed with
6776         the '-' character.  Treat these as libraries.
6777         * script.cc (script_add_library): New function.  Adds a library
6778         specified by "-l<name>" found in an input script.
6779         * script-c.h: Add prototype for script_add_library.
6780
6781 2010-06-07  Doug Kwan  <dougkwan@google.com>
6782
6783         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6784         Restrict stub-group size to be within long conditional branch
6785         range when working around cortex-A8 erratum.
6786
6787 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6788
6789         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6790         #ifdef typo.
6791
6792 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6793
6794         PR gold/11658
6795         * output.cc
6796         (Output_section::Input_section_sort_entry::compare_section_ordering):
6797         Change to return non-zero correctly.
6798         (Output_section::Input_section_sort_section_order_index_compare
6799         ::operator()): Change to fix ambiguity in comparisons.
6800
6801 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6802
6803         * gold.h (is_wildcard_string): New function.
6804         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6805         (Layout::layout_eh_frame): Ditto.
6806         (Layout::find_section_order_index): New method.
6807         (Layout::read_layout_from_file): New method.
6808         * layout.h (Layout::find_section_order_index): New method.
6809         (Layout::read_layout_from_file): New method.
6810         (Layout::input_section_position_): New private member.
6811         (Layout::input_section_glob_): New private member.
6812         * main.cc (main): Call read_layout_from_file here.
6813         * options.h (--section-ordering-file): New option.
6814         * output.cc (Output_section::input_section_order_specified_): New
6815         member.
6816         (Output_section::Output_section): Initialize new member.
6817         (Output_section::add_input_section): Add new parameter.
6818         Keep input sections when --section-ordering-file is used.
6819         (Output_section::set_final_data_size): Sort input sections when
6820         section ordering file is specified.
6821         (Output_section::Input_section_sort_entry): Add new parameter.
6822         Check sorting type.
6823         (Output_section::Input_section_sort_entry::compare_section_ordering):
6824         New method.
6825         (Output_section::Input_section_sort_compare::operator()): Change to
6826         consider section_order_index.
6827         (Output_section::Input_section_sort_init_fini_compare::operator()):
6828         Change to consider section_order_index.
6829         (Output_section::Input_section_sort_section_order_index_compare
6830         ::operator()): New method.
6831         (Output_section::sort_attached_input_sections): Change to sort
6832         according to section order when specified.
6833         (Output_section::add_input_section<32, true>): Add new parameter.
6834         (Output_section::add_input_section<64, true>): Add new parameter.
6835         (Output_section::add_input_section<32, false>): Add new parameter.
6836         (Output_section::add_input_section<64, false>): Add new parameter.
6837         * output.h (Output_section::add_input_section): Add new parameter.
6838         (Output_section::input_section_order_specified): New
6839         method.
6840         (Output_section::set_input_section_order_specified): New method.
6841         (Input_section::Input_section): Initialize section_order_index_.
6842         (Input_section::section_order_index): New method.
6843         (Input_section::set_section_order_index): New method.
6844         (Input_section::section_order_index_): New member.
6845         (Input_section::Input_section_sort_section_order_index_compare): New
6846         struct.
6847         (Output_section::input_section_order_specified_): New member.
6848         * script-sections.cc (is_wildcard_string): Delete and move modified
6849         method to gold.h.
6850         (Output_section_element_input::Output_section_element_input): Modify
6851         call to is_wildcard_string.
6852         (Output_section_element_input::Input_section_pattern
6853         ::Input_section_pattern): Ditto.
6854         (Output_section_element_input::Output_section_element_input): Ditto.
6855         * testsuite/Makefile.am (final_layout): New test case.
6856         * testsuite/Makefile.in: Regenerate.
6857         * testsuite/final_layout.cc: New file.
6858         * testsuite/final_layout.sh: New file.
6859
6860 2010-06-01  Rafael Espindola  <espindola@google.com>
6861
6862         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6863
6864 2010-06-01  Rafael Espindola  <espindola@google.com>
6865
6866         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6867         visibility of symbols.
6868
6869 2010-05-27  Doug Kwan  <dougkwan@google.com>
6870
6871         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6872         from start of output section instead of address for a local symbol
6873         in a merged or relaxed section when doing a relocatable link.
6874
6875 2010-05-26  Rafael Espindola  <espindola@google.com>
6876
6877         PR 11604
6878         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6879         adding sections the garbage collector removed.
6880         * gold/testsuite/Makefile.am: Add test.
6881         * gold/testsuite/Makefile.in: Regenerate.
6882         * gold/testsuite/plugin_test_7.sh: New.
6883         * gold/testsuite/plugin_test_7_1.c: New.
6884         * gold/testsuite/plugin_test_7_2.c: New.
6885
6886 2010-05-26  Rafael Espindola  <espindola@google.com>
6887
6888         * script-sections.cc (Output_section_definition::set_section_addresses):
6889         Check for --section-start.
6890
6891 2010-05-26  Doug Kwan  <dougkwan@google.com>
6892
6893         * arm.cc (Arm_scan_relocatable_relocs): New class.
6894         (Target_arm::relocate_special_relocatable): New method.
6895         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6896         (Arm_relocate_functions::thumb_branch_common): Same.
6897         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6898         instead of Default_scan_relocatable_relocs.
6899         * target-reloc.h (relocate_for_relocatable): Let target handle
6900         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6901         * target.h (Sized_target::relocate_special_relocatable): New method.
6902
6903 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6904
6905         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6906
6907 2010-05-23  Doug Kwan  <dougkwan@google.com>
6908
6909         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6910         instead of a cast.
6911         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6912         with a direct branch, not a conditional branch, to a stub.
6913         * merge.cc (Output_merge_base::record_input_section): New method
6914         defintion.
6915         (Output_merge_data::do_add_input_section): Record input section if
6916         keeps-input-sections flag is set.
6917         (Output_merge_string::do_add_input_section): Ditto.
6918         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6919         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6920         INPUT_SECTIONS_.
6921         (Output_merge_base::keeps_input_sections,
6922         Output_merge_base::set_keeps_input_sections,
6923         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6924         method definitions.
6925         (Output_merge_base::Input_sections): New type declaration.
6926         (Output_merge_base::input_sections_begin,
6927         Output_merge_base::input_sections_end,
6928         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6929         (Output_merge_base::bool keeps_input_sections_,
6930         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6931         Output_merge_base::input_sections_): New data members.
6932         (Output_merge_data::do_set_keeps_input_sections): New method
6933         defintion.
6934         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6935         * output.cc (Output_section::Input_section::relobj): Move method
6936         defintion from class declaration to here and handle merge sections.
6937         (Output_section::Input_section::shndx): Ditto.
6938         (Output_section::Output_section): Remove initializations of removed
6939         data members and initialize new data member LOOKUP_MAPS_.
6940         (Output_section::add_input_section): Set keeps-input-sections flag
6941         for a newly created merge output section as appropriate.  Adjust code
6942         to use Output_section_lookup_maps class.
6943         (Output_section::add_relaxed_input_section): Adjst code for lookup
6944         maps code refactoring.
6945         (Output_section::add_merge_input_section): Add a new parameter
6946         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6947         class.  If adding input section to a newly created merge output
6948         section fails, remove the new merge section.
6949         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6950         Adjust code for use of the Output_section_lookup_maps class.
6951         (Output_section::find_merge_section): Ditto.
6952         (Output_section::build_lookup_maps): New method defintion.
6953         (Output_section::find_relaxed_input_section): Adjust code to use
6954         Output_section_lookup_maps class.
6955         (Output_section::get_input_sections): Export merge sections.  Adjust
6956         code to use Output_section_lookup_maps class.
6957         (Output_section:::add_script_input_section): Adjust code to use
6958         Output_section_lookup_maps class.  Update lookup maps for merge
6959         sections also.
6960         (Output_section::discard_states): Use Output_section_lookup_maps.
6961         (Output_section::restore_states): Same.
6962         * output.h (Merge_section_properties): Move class defintion out of
6963         Output_section.
6964         (Output_section_lookup_maps): New class.
6965         (Output_section::Input_section::is_merge_section): New method
6966         defintion.
6967         (Output_section::Input_section::relobj): Move defintion out of class
6968         defintion.  Declare method only.
6969         (Output_section::Input_section::shndx): Ditto.
6970         (Output_section::Input_section::output_merge_base): New method defintion.
6971         (Output_section::Input_section::u2_.pomb): New union field.
6972         (Output_section::Merge_section_by_properties_map,
6973         Output_section::Output_section_data_by_input_section_map,
6974         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6975         Remove types.
6976         (Output_section::add_merge_input_section): Add new parameter
6977         KEEPS_INPUT_SECTIONS.
6978         (Output_section::build_lookup_maps): New method declaration.
6979         (Output_section::merge_section_map_,
6980         Output_section::merge_section_by_properties_map_,
6981         Output_section::relaxed_input_section_map_,
6982         Output_section::is_relaxed_input_section_map_valid_): Remove data
6983         members.
6984         (Output_section::lookup_maps_): New data member.
6985
6986 2010-05-21  Doug Kwan  <dougkwan@google.com>
6987
6988         PR gold/11619
6989         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6990         avoid a compilation error.
6991
6992 2010-05-19  Rafael Espindola  <espindola@google.com>
6993
6994         * script-sections.cc (Output_section_definition::allocate_to_segment):
6995         Update the phdrs_list even when the output section is NULL.
6996         * testsuite/Makefile.am: Add test.
6997         * testsuite/Makefile.in: Regenerate.
6998         * testsuite/script_test_9.cc: New.
6999         * testsuite/script_test_9.sh: New.
7000         * testsuite/script_test_9.t: New.
7001
7002 2010-05-19  Doug Kwan  <dougkwan@google.com>
7003
7004         * arm.cc (Arm_input_section::original_size): New method.
7005         (Arm_input_section::do_addralign): Add a cast.
7006         (Arm_input_section::do_output_offset): Remove static cast.
7007         (Arm_input_section::original_addralign,
7008          Arm_input_section::original_size_): Change type to uint32_t.
7009         (Arm_input_section::init): Add safe casts for section alignment
7010         and size.
7011         (Arm_input_section::set_final_data_size): Do not set address and
7012         offset of stub table.
7013         (Arm_output_section::fix_exidx_coverage): Change use of of
7014         Output_section::Simple_input_section to that of
7015         Output_section::Input_section.
7016         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7017         except for the first pass.
7018         * output.cc (Output_section::get_input_sections): Change type of
7019         input_sections to std::list<Input_section>.
7020         (Output_section::add_script_input_section): Rename from
7021         Output_section::add_simple_input_section.  Change type of SIS
7022         parameter from Simple_input_section to Input_section.
7023         * output.h (Output_section::Simple_input_section): Remove class.
7024         (Output_section::Input_section): Change class visibility to public.
7025         (Output_section::Input_section::addralign): Use stored alignments
7026         for special input sections if set.
7027         (Output_section::Input_section::set_addralign): New method.
7028         (Output_section::get_input_sections): Change parameter type from
7029         list of Simple_input_section to list of Input_section.
7030         (Output_section::add_script_input_section): Rename from
7031         Output_section::add_simple_input_section. Change first parameter's
7032         type from Simple_input_section to Input_section and remove the
7033         second and third parameters.
7034         * script-sections.cc (Input_section::Input_section_list): Change
7035         type to list of Output_section::Input_section/
7036         (Input_section_info::Input_section_info): Change parameter type of
7037         INPUT_SECTION to Output_section::Input_section.
7038         (Input_section_info::input_section): Change return type.
7039         (Input_section_info::input_section_): Change type to
7040         Output_section::Input_section.
7041         (Output_section_element_input::set_section_addresses): Adjust code
7042         to use Output_section::Input_section instead of
7043         Output_section::Simple_input_section.  Adjust code for renaming
7044         of Output_section::add_simple_input_section.
7045         (Orphan_output_section::set_section_addresses): Ditto.
7046
7047 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7048
7049         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7050         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7051
7052 2010-05-18  Rafael Espindola  <espindola@google.com>
7053
7054         * options.cc (General_options::finalize): Handle -nostdlib.
7055         * options.h (nostdlib): New option.
7056         * script.cc (script_add_search_dir): Handle -nostdlib.
7057
7058 2010-05-12  Doug Kwan  <dougkwan@google.com>
7059
7060         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7061         attributes section only if there no attributes section after merging.
7062         (Target_arm::merge_object_attributes): Move value of
7063         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7064         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7065         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7066         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7067         and arm_attr_merge_7.stdout.
7068         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7069         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7070         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7071         arm_attr_merge_7b.o): New rules.
7072         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7073         arm_attr_merge_7
7074         * testsuite/Makefile.in: Regenerate.
7075         * testsuite/arm_attr_merge.sh: New file.
7076         * testsuite/arm_attr_merge_[67][ab].s: Same.
7077
7078 2010-05-05  Nick Clifton  <nickc@redhat.com>
7079
7080         * po/es.po: Updated Spanish translation.
7081
7082 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7083
7084         * Makefile.am (install-exec-local): Properly install gold as
7085         default cross linker.
7086         * Makefile.in: Regenerated.
7087
7088 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7089             Nick Clifton  <nickc@redhat.com>
7090
7091         * configure.ac (install_as_default): Define and set to false
7092         unless --enable-gold or --enable-gold=both/gold has been
7093         specified.
7094         * configure: Regenerate.
7095
7096         * Makefile.am (install-exec-local): Install the executable as
7097         'ld.gold'.  If install_as_default is true then also install it as
7098         'ld'.
7099         * Makefile.in: Regenerated.
7100
7101 2010-04-24  Ian Lance Taylor  <iant@google.com>
7102
7103         * layout.cc (Layout::layout_reloc): In relocatable link don't
7104         combine reloc sections for grouped sections.
7105
7106 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7107
7108         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7109         sections that are not ordinary to icf.
7110         * icf.cc (get_section_contents): Handle relocation pointing to section
7111         with no object or shndx information.
7112         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7113         * testsuite/Makefile.in: Regenerate.
7114         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7115         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7116
7117 2010-04-22  Ian Lance Taylor  <iant@google.com>
7118
7119         * expression.cc (Expression::Expression_eval_info): Add
7120         result_alignment_pointer field.
7121         (Expression::eval_with_dot): Add result_alignment_pointer
7122         parameter.  Change all callers.
7123         (Expression::eval_maybe_dot): Likewise.
7124         (class Binary_expression): Add alignment_pointer parameter to
7125         left_value and right_value.  Change all callers.
7126         (BINARY_EXPRESSION): Set result alignment.
7127         (class Trinary_expression): Add alignment_pointer parameter to
7128         arg2_value and arg3_value.  Change all callers.
7129         (Trinary_cond::value): Set result alignment.
7130         (Max_expression::value, Min_expression::value): Likewise.
7131         (Align_expression::value): Likewise.
7132         * script-sections.cc (class Sections_element): Add dot_alignment
7133         parameter to set_section_addresses virtual function.  Update
7134         instantiations.
7135         (class Output_section_element): Likewise.
7136         (Script_sections::create_segments): Add dot_alignment parameter.
7137         Change all callers.
7138         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7139         (Script_sections::set_phdrs_clause_addresses): Likewise.
7140         * script-sections.h: Update declarations.
7141         * script.h: Update declarations.
7142         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7143         min_p_align.
7144         * testsuite/script_test_3.t: Set large alignment.
7145         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7146         segment has expected alignment.
7147
7148 2010-04-22  Nick Clifton  <nickc@redhat.com>
7149
7150         * po/gold.pot: Updated by the Translation project.
7151         * po/vi.po: Updated Vietnamese translation.
7152
7153 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7154
7155         * testsuite/Makefile.am (check_PROGRAMS): Add
7156         icf_virtual_function_folding_test.
7157         * testsuite/Makefile.in: Regenerated.
7158
7159 2010-04-15  Andrew Haley  <aph@redhat.com>
7160
7161         * options.h (merge_exidx_entries): New option.
7162         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7163         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7164         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7165         (Target_arm::merge_exidx_entries): New function.
7166         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7167         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7168         to Arm_exidx_fixup constructor.
7169         Add new arg, merge_exidx_entries.
7170         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7171         Arm_output_section::fix_exidx_coverage.
7172
7173 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7174
7175         * icf.cc (get_section_contents): Check for preemptible functions.
7176         Ignore addend when appropriate.
7177         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7178         section folded.
7179         (add_from_relobj): Check for section folded.
7180         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7181         * symtab.h (should_add_dynsym_entry): Add new parameter.
7182         * target-reloc.h (scan_relocs): Check for section folded.
7183         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7184         Check reloc types for function pointers in shared objects.
7185         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7186         case.
7187         (icf_preemptible_functions_test): New test case.
7188         (icf_string_merge_test): New test case.
7189         * testsuite.Makefile.in: Regenerate.
7190         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7191         bar_glob.  Refactor code.
7192         * testsuite/icf_preemptible_functions_test.cc: New file.
7193         * testsuite/icf_preemptible_functions_test.sh: New file.
7194         * testsuite/icf_string_merge_test.cc: New file.
7195         * testsuite/icf_string_merge_test.sh: New file.
7196         * testsuite/icf_virtual_function_folding_test.cc: New file.
7197         * testsuite/icf_virtual_function_folding_test.sh: New file.
7198
7199 2010-04-14  Doug Kwan  <dougkwan@google.com>
7200
7201         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7202         for local symbol recounting if we remove a section due to ICF.
7203         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7204         there are no regular objects in input.
7205
7206 2010-04-13  Doug Kwan  <dougkwan@google.com>
7207
7208         * arm.cc (Arm_input_section::set_final_data_size): Compute
7209         accurate final data size instead of using current data size.
7210
7211 2010-04-09  Doug Kwan  <dougkwan@google.com>
7212
7213         * layout.cc (Layout::choose_output_section): Handle script section
7214         types.
7215         (Layout::make_output_section_for_script): Add section type parameter.
7216         Handle script section types.
7217         * layout.h (Layout::make_output_section_for_script): Add section
7218         type parameter.
7219         * output.cc (Output_section::Output_section): Initialize data member
7220         is_noload_.
7221         (Output_section::do_reset_address_and_file_offset): Do not set address
7222         to 0 if section is a NOLOAD section.
7223         * output.h (Output_section::is_noload): New method.
7224         (Output_section::set_is_noload): Ditto.
7225         (Output_section::is_noload_): New data member.
7226         * script-c.h (Script_section_type): New enum type.
7227         (struct Parser_output_section_header): Add new file section_type.
7228         * script-sections.cc (Sections_element::output_section_name): Add
7229         parameter for returning script section type.
7230         (Output_section_definition::output_section_name): Ditto.
7231         (Output_section_definition::section_type)P; New method.
7232         (Output_section_definiton::script_section_type_name): Ditto.
7233         (Output_section_definition::script_section_type_): New data member.
7234         (Output_section_definition::Output_section_definition): Initialize
7235         data member Output_section_definition::script_section_type_.
7236         (Output_section_definition::create_sections): Pass script section type
7237         to Layout::make_output_section_for_script.
7238         (Output_section_definition::output_section_name): Return script
7239         section type to caller.
7240         (Output_section_definition::set_section_address): Do not advance
7241         dot value and load address if section type is NOLOAD.  Set address
7242         of NOLOAD sections regardless of section flags.
7243         (Output_section_definition::print): Print section type if it is
7244         not SCRIPT_SECTION_TYPE_NONE.
7245         (Output_section_definition::section_type): New method.
7246         (Output_section_definition::script_section_type_name): Ditto.
7247         (Script_sections::output_section_name): Add new parameter
7248         PSECTION_TYPE for returning script section type.  Pass it to
7249         section elements.  Handle discard sections.
7250         (Sort_output_sections::operator()): Handle NOLOAD sections.
7251         * script-sections.h (Script_sections::Section_type): New enum type.
7252         (Script_sections::output_section_name): Add a new parameter for
7253         returning script section type.
7254         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7255         INFO and NOLOAD.
7256         * yyscript.y (union): Add new field SECTION_TYPE.
7257         (COPY, DSECT, INFO, NOLOAD): New tokens.
7258         (opt_address_and_section_type): Change type to output_section_header.
7259         (section_type): New non-terminal
7260         (section_header): Handle section type.
7261         (opt_address_and_section_type): Return section type value.
7262
7263 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7264
7265         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7266         * testsuite/plugin_common_test_2.c (foo): Likewise.
7267
7268 2010-04-08  Doug Kwan  <dougkwan@google.com>
7269
7270         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7271         Output_merge_data.
7272         * output.cc (Output_section::add_merge_input_section): Simplify
7273         code and return status of Output_merge_base::add_input_section.
7274         Update merge section map only if Output_merge_base::add_input_section
7275         returns true.
7276
7277 2010-04-07  Doug Kwan  <dougkwan@google.com>
7278
7279         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7280         if section is marked as containing instructions but has no mapping
7281         symbols.
7282         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7283         correct section index.
7284         (Arm_relobj::find_linked_text_section): Ditto.
7285
7286 2010-04-07  Cary Coutant  <ccoutant@google.com>
7287
7288         * archive.cc (include_member): Destroy Read_symbols_data object before
7289         releasing file.
7290         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7291         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7292         (Read_symbols_data::~Read_symbols_data) New destructor.
7293         (Section_relocs::Section_relocs) New constructor.
7294         (Section_relocs::~Section_relocs) New destructor.
7295         (Read_relocs_data::Read_relocs_data) New constructor.
7296         (Read_relocs_data::~Read_relocs_data) New destructor.
7297         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7298         pointers to NULL after deleting.
7299
7300 2010-04-07  Doug Kwan  <dougkwan@google.com>
7301
7302         * arm.cc: Replace "endianity" with "endianness" in comments.
7303         (Arm_exidx_cantunwind): Ditto.
7304         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7305         (Arm_relobj::merge_flags_and_attributes): New method.
7306         (Arm_relobj::merge_flags_and_attributes_): New data member.
7307         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7308         (Arm_relobj::scan_sections_for_stubs): Ditto.
7309         (Arm_relobj::do_read_symbols): Check to see if we really want to
7310         merge processor-specific flags and attributes.  Exit early if
7311         an object is empty except for section names and the undefined symbol.
7312         (Target_arm::do_finalize_sections): Move check for ELF format to
7313         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7314         attributes from a regular object only when we have determined that
7315         it is aapropriate.  Do not create an .ARM.attributes section in
7316         output if there is no regular input object.
7317         (Target_arm::merge_processor_specific_flags): Check
7318         --warn-mismatch before printing any error.
7319         (Target_arm::merge_object_attributes): Ditto.
7320         * gold.cc (queue_middle_tasks): Handle the case in which there is
7321         no regular object in input.
7322         * options.cc (General_options::parse_EB): New method.
7323         (General_options::parse_EL): Same.
7324         (General_options::General_options): Initialize endianness_.
7325         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7326         New options.
7327         (General_options::Endianness): New enum.
7328         (General_options::endianness): New method.
7329         (General_options::endianness_): New data member.
7330         * parameters.cc (Parameters::set_options): Check target endianness.
7331         (Parameters::set_target_once): Ditto.
7332         (Parameters::check_target_endianness): New method.
7333         (parameters_force_valid_target): If either -EL or -EB is specified,
7334         use it to define endianness of default target.
7335         * parameters.h (Parameters::check_target_endianness): New method
7336         declaration.
7337         * target.h (class Target): Change "endianity" to "endianness"
7338         in comments.
7339
7340 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7341
7342         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7343         * configure: Regenerate.
7344         * Makefile.in: Regenerate.
7345         * testsuite/Makefile.in: Regenerate.
7346
7347 2010-04-06  Cary Coutant  <ccoutant@google.com>
7348
7349         gcc PR lto/42757
7350         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7351         prevailing definitions of common symbols.
7352         * testsuite/plugin_test_6.sh: New test case.
7353         * testsuite/plugin_common_test_1.c: New test case.
7354         * testsuite/plugin_common_test_2.c: New test case.
7355         * testsuite/Makefile.am (plugin_test_6): New test case.
7356         * testsuite/Makefile.in: Regenerate.
7357
7358 2010-04-06  Nick Clifton  <nickc@redhat.com>
7359
7360         * po/vi.po: New Vietnamese translation.
7361
7362 2010-03-30  Doug Kwan  <dougkwan@google.com>
7363
7364         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7365
7366 2010-03-25  Doug Kwan  <dougkwan@google.com>
7367
7368         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7369         to avoid a conversion warning on a 32-bit host.
7370
7371 2010-03-24  Ian Lance Taylor  <iant@google.com>
7372
7373         * testsuite/script_test_3.t: Add a TLS segment.
7374         * testsuite/Makefile.am (check_PROGRAMS): Add
7375         tls_phdrs_script_test.
7376         (tls_phdrs_script_test_SOURCES): Define.
7377         (tls_phdrs_script_test_DEPENDENCIES): Define.
7378         (tls_phdrs_script_test_LDFLAGS): Define.
7379         (tls_phdrs_script_test_LDADD): Define.
7380         * testsuite/Makefile.in: Rebuild.
7381
7382 2010-03-23  Cary Coutant  <ccoutant@google.com>
7383
7384         * fileread.cc (find_or_make_view): Fix comment.
7385
7386 2010-03-23  Ian Lance Taylor  <iant@google.com>
7387
7388         * script-sections.cc (class Orphan_section_placement): Define
7389         PLACE_TLS and PLACE_TLS_BSS.
7390         (Orphan_section_placement::Orphan_section_placement): Initialize
7391         new places.
7392         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7393         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7394         (tls_script_test_SOURCES): Define.
7395         (tls_script_test_DEPENDENCIES): Define.
7396         (tls_script_test_LDFLAGS): Define.
7397         (tls_script_test_LDADD): Define.
7398         * testsuite/Makefile.in: Rebuild.
7399
7400 2010-03-22  Doug Kwan  <dougkwan@google.com>
7401
7402         * arm.cc (Arm_relocate_functions::abs8,
7403         Arm_relocate_functions::abs16): Use correct check for overflow
7404         specified in the ARM ELF specs.
7405         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7406         target of a BLX instruction specially.
7407         (Reloc_stub::stub_type_for_reloc): Ditto.
7408         (Relocate::relocate): Use symbolic names instead of numeric relocation
7409         codes to report error.
7410         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7411         workaround.
7412         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7413         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7414         thumb2_blx_out_of_range.stdout
7415         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7416         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7417         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7418         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7419         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7420         thumb2_blx_in_range, thumb2_blx_in_range.o,
7421         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7422         thumb2_blx_out_of_range.o): New rules.
7423         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7424         thumb2_blx_in_range and thumb2_blx_out_of_range.
7425         * testsuite/Makefile.in: Regenerate.
7426         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7427         * testsuite/thumb_blx_in_range.s: New file.
7428         * testsuite/thumb_blx_out_of_range.s: New file.
7429
7430 2010-03-22  Rafael Espindola  <espindola@google.com>
7431
7432         * archive.cc (Should_include): Move to archive.h.
7433         (should_include_member): Make it a member of Archive.
7434         (Lib_group): New.
7435         (Add_lib_group_symbols): New.
7436         * archive.h: Include options.h.
7437         (Archive_member): Moved from Archive.
7438         (Should_include): Moved from archive.cc.
7439         (Lib_group): New.
7440         (Add_lib_group_symbols): New.
7441         * dynobj.cc (do_should_include_member): New.
7442         * dynobj.h (do_should_include_member): New.
7443         * gold.cc (queue_initial_tasks): Update call to queue.
7444         * main.cc (main): Print lib group stats.
7445         * object.cc (do_should_include_member): New.
7446         * object.h: Include archive.h.
7447         (Object::should_include_member): New.
7448         (Object::do_should_include_member): New.
7449         (Sized_relobj::do_should_include_member): New.
7450         * options.cc (General_options::parse_start_lib): New.
7451         (General_options::parse_end_lib): New.
7452         (Input_arguments::add_file): Handle lib groups.
7453         (Input_arguments::start_group): Check we are not in a lib.
7454         (Input_arguments::start_lib): New.
7455         (Input_arguments::end_lib): New.
7456         * options.h (General_options): Add start_lib and end_lib.
7457         (Input_argument::lib_): New.
7458         (Input_argument::lib): New.
7459         (Input_argument::is_lib): New.
7460         (Input_file_lib): New.
7461         (Input_arguments::in_lib_): New.
7462         (Input_arguments::in_lib): New.
7463         (Input_arguments::start_lib): New.
7464         (Input_arguments::end_lib_): New.
7465         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7466         in unused members as preempted.
7467         (Sized_pluginobj::do_should_include_member): New.
7468         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7469         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7470         return the blocker.
7471         (Read_symbols::do_whole_lib_group): New.
7472         (Read_symbols::do_lib_group): New.
7473         (Read_symbols::do_read_symbols): Handle lib groups.
7474         (Read_symbols::get_name): Handle lib groups.
7475         * readsyms.h (Read_symbols): Add an archive member pointer.
7476         (Read_symbols::do_whole_lib_group): New.
7477         (Read_symbols::do_lib_group): New.
7478         (Read_symbols::member_): New.
7479         * script.cc (read_input_script): Update call to queue_soon.
7480
7481 2010-03-19  Doug Kwan  <dougkwan@google.com>
7482
7483         * arm.cc (Stub_table::Stub_table): Initialize new data members
7484         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7485         (Stub_table::add_reloc_stub): Assign stub offset and update
7486         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7487         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7488         New data members.
7489         (Stub_table::update_data_size_and_addralign): Use
7490         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7491         instead of going over all reloc stubs.
7492         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7493         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7494         Stringpool_template::offset_ to size of Stringpool_char.
7495         (Stringpool_template::new_key_offset): Remove code to initialize
7496         Stringpool_template::offset_.
7497         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7498         Stringpool_template::offset_ to zero.
7499
7500 2010-03-15  Doug Kwan  <dougkwan@google.com>
7501
7502         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7503         offset_.
7504         (Stringpool_template::new_key_offset): New method.
7505         (Stringpool_template::add_string): Assign offsets when adding new
7506         strings.
7507         (Stringpool_template::set_string_offsets): Do not set string offsets
7508         when not optimizing.
7509         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7510         member size_.
7511         (Chunked_vector::clear): Clear size_.
7512         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7513         (Chunked_vector::size): Return size_.
7514         (Chunked_vector::push_back): Use size_ to find insert position.
7515         (Chunked_vector::size_): New data member.
7516         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7517         (Stringpool_template::new_key_offset): New method declaration.
7518         (Stringpool_template::offset_): New data member.
7519
7520 2010-03-15   Rafael Espindola  <espindola@google.com>
7521
7522         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7523         Add_symbols' constructor.
7524         * readsyms.h (Add_symbols): Remove the input_group member.
7525
7526 2010-03-10  Ian Lance Taylor  <iant@google.com>
7527
7528         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7529         target to ask whether a reference to a symbol requires a stack
7530         split.
7531         * target.h (Target::is_call_to_non_split): New function.
7532         (Target::do_is_call_to_non_split): Declare virtual function.
7533         * target.cc: Include "symtab.h".
7534         (Target::do_is_call_to_non_split): New function.
7535         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7536
7537 2010-03-10  Cary Coutant  <ccoutant@google.com>
7538
7539         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7540         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7541         (File_read::open[2]): Add whole_file_view_ to list of views.
7542         (File_read::make_view): Remove test of whole_file_view_.
7543         (File_read::find_or_make_view): Create whole_file_view_ if
7544         necessary.
7545         (File_read::clear_views): Replace bool parameter with enum;
7546         adjust all callers.  Don't delete views with permanent data;
7547         do delete cached views and views from archives if
7548         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7549         if clearing the corresponding view.
7550         * fileread.h (File_read::Clear_views_mode): New enum.
7551         (File_read::View::is_permanent_view): New method.
7552         (File_read::clear_views): Replace bool parameter
7553         with enum; adjust all callers.
7554         * options.h (General_options): Change keep_files_mapped option;
7555         add map_whole_files.
7556         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7557         releasing the file.
7558         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7559         the file.
7560
7561 2010-03-10  David S. Miller  <davem@davemloft.net>
7562
7563         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7564
7565 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7566
7567         * icf.cc (get_section_contents): Add '@' marker after processing the
7568         merge reloc.
7569
7570 2010-03-08  Doug Kwan  <dougkwan@google.com>
7571
7572         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7573         due to a conversion warning.
7574         (Arm_relobj::update_output_local_symbol_count): Check for local
7575         symbol with unset output index.
7576
7577 2010-03-05  Ian Lance Taylor  <iant@google.com>
7578
7579         * options.h (class General_options): Add --spare-dynamic-tags.
7580         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7581         --spare-dynamic-tags.
7582
7583 2010-03-05  Ian Lance Taylor  <iant@google.com>
7584
7585         * incremental.cc: Include "libiberty.h".
7586
7587 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7588
7589         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7590         function, is_info_ member.
7591         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7592         (Versions::Versions): Update caller.
7593         (Versions::define_base_version): Likewise.
7594         (Versions::add_def): Likewise.
7595
7596 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7597
7598         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7599         (Scan::possible_function_pointer_reloc): New function.
7600         (Scan::local_reloc_may_be_function_pointer): Change to call
7601         possible_function_pointer_reloc.
7602         (Scan::global_reloc_may_be_function_pointer): Ditto.
7603         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7604         relocations in ".data.rel.ro._ZTV" section.
7605         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7606         * testsuite/icf_safe_so_test.cc: Ditto.
7607         * testsuite/icf_safe_test.cc: Ditto.
7608         * testsuite/icf_safe_test.sh: Ditto.
7609
7610 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7611             Ian Lance Taylor  <iant@google.com>
7612
7613         * target-reloc.h (relocate_section): Check the symbol table index
7614         for -1U before setting the local symbol index.
7615         (scan_relocatable_relocs): If copying the relocation, record that
7616         the local symbol is required.
7617         * object.h (Symbol_value::is_output_symtab_index_set): New
7618         function.
7619         (Symbol_value::may_be_discarded_from_output_symtab): New
7620         function.
7621         (Symbol_value::has_output_symtab_entry): New function.
7622         (Symbol_value::needs_output_symtab_entry): Remove.
7623         (Symbol_value::output_symtab_index): Make sure the symbol index is
7624         set.
7625         (Symbol_value::set_output_symtab_index): Make sure the symbol
7626         index is not set.  Make sure the new index is valid.
7627         (Symbol_value::set_must_have_output_symtab_entry): New function.
7628         (Symbol_value::has_output_dynsym_entry): New function.
7629         (Symbol_value::set_output_dynsym_index): Make sure the new index
7630         is valid.
7631         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7632         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7633         local symbol if permitted.
7634         (Sized_relobj::do_finalize_local_symbols): Call
7635         is_output_symtab_index_set rather than needs_output_symtab_entry.
7636         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7637         rather than needs_output_symtab_entry.  Call
7638         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7639         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7640         is_output_symtab_index_set rather than needs_output_symtab_entry.
7641         * testsuite/discard_locals_relocatable_test.c: New file.
7642         * testsuite/discard_locals_test.sh: Test -r.
7643         * testsuite/Makefile.am (check_DATA): Add
7644         discard_locals_relocatable_test1.syms,
7645         discard_local_relocatable_test2.syms.
7646         (MOSTLYCLEANFILES): Likewise.  Also add
7647         discard_locals_relocatable_test1.lout and
7648         discard_locals_relocatable_test2.out.
7649         (discard_locals_relocatable_test1.syms): New target.
7650         (discard_locals_relocatable_test.o): New target.
7651         (discard_locals_relocatable_test1.out): New target.
7652         (discard_locals_relocatable_test2.syms): New target.
7653         (discard_locals_relocatable_test2.out): New target.
7654         (various): Add missing ../ld-new dependencies.
7655         * testsuite/Makefile.in: Rebuild.
7656
7657 2010-03-03  Nick Clifton  <nickc@redhat.com>
7658
7659         * po/fi.po: New Finnish translation.
7660
7661 2010-03-01  Doug Kwan  <dougkwan@google.com>
7662
7663         * layout.cc (Layout::Layout): Force section types of .init_array*,
7664         .preinit_array* and .fini_array* sections.
7665         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7666         Fix check of return value of std::string::find.().
7667         (Output_section::Input_section_sort_compare::operator()): Remove
7668         comment about .init_array.
7669         (Output_section::Input_section_sort_init_fini_compare::operator()):
7670         New method.
7671         (Output_section::sort_attached_input_sections): Handle .init_array
7672         and .fini_array specially.
7673         * output.h (Output_section::Inut_section_sort_compare): Update
7674         comment.
7675         (Output_section::Input_section_sort_init_fini_compare): New struct.
7676
7677 2010-02-26  Doug Kwan  <dougkwan@google.com>
7678
7679         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7680         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7681         * testsuite/debug_msg.sh: Avoid matching source line number for
7682         use of global variable undef_int.
7683
7684 2010-02-26  Doug Kwan  <dougkwan@google.com>
7685
7686         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7687         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7688         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7689         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7690         * options.cc (General_options::General_options): Initialize member
7691         fix_v4bx_.
7692         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7693         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7694         and rm_no_fix_v4bx.stdout
7695         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7696         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7697         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7698         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7699         and arm_no_fix_v4bx.
7700         * Makefile.in: Regenerate.
7701         * testsuite/arm_fix_v4bx.s: New file.
7702         * testsuite/arm_fix_v4bx.sh: Ditto.
7703
7704 2010-02-24  Doug Kwan  <dougkwan@google.com>
7705
7706         * arm.cc (Target_arm::got_section): Make the .got section the first
7707         non RELRO section in the data segment.
7708         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7709         suffixes of section names.
7710
7711 2010-02-24  Doug Kwan  <dougkwan@google.com>
7712
7713         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7714         flags and attributes merging if an input file is a binary file.
7715         * fileread.cc (Input_file::open): Record format of original file.
7716         * fileread.h (Input_file::Format): New enum type.
7717         (Input_file::Input_file): Initialize data member format_.
7718         (Input_file::format): New method definition.
7719         (Input_file::format_):: New data member.
7720
7721 2010-02-24  Doug Kwan  <dougkwan@google.com>
7722
7723         * arm.cc (Arm_output_data_got): New class.
7724         (ARM_TCB_SIZE): New constant
7725         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7726         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7727         If user uses a script with a SECTIONS clause, issue only a warning
7728         for a misplaced EXIDX input section.  Otherwise, issue an error.
7729         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7730         garbage collection.
7731         (Target_arm::got_mode_index_entry): Handle static linking.
7732         (Target_arm::Scan::local): Ditto.
7733         (Target_arm::Scan::global): Ditto.
7734         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7735         all incorrectly implemented relocations.
7736         (Target_arm::fix_exidx_coverage): Pass layout to
7737         Arm_output_section::fix_exidx_coverage.
7738         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7739         from ".ARM.exidx." and ".ARM.extab.".
7740
7741 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7742
7743         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7744         section if it does not already exist.
7745         * attributes.cc (Attributes_section_data::Attributes_section_data):
7746         Don't crash if size is zero.
7747
7748 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7749             Ian Lance Taylor  <iant@google.com>
7750
7751         * gold.cc (queue_middle_tasks): If no input files were opened,
7752         exit.
7753         * workqueue.h (Task_function::Task_function): Assert that there is
7754         a blocker.
7755
7756 2010-02-22  Doug Kwan  <dougkwan@google.com>
7757
7758         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7759         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7760         types to avoid warnings due to different uint64_t implementations
7761         on different hosts.
7762
7763 2010-02-21  Doug Kwan  <dougkwan@google.com>
7764
7765         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7766         handling of the maximum backward branch offset.
7767         (Arm_relocate_functions::thumb_branch_common): Ditto.
7768         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7769         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7770         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7771         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7772         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7773         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7774         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7775         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7776         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7777         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7778         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7779         thumb2_bl_out_of_range.o): New rules.
7780         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7781         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7782         thumb2_bl_out_of_range
7783         * testsuite/Makefile.in: Regenerate.
7784         * testsuite/arm_bl_in_range.s: New file.
7785         * testsuite/arm_bl_out_of_range.s: Ditto.
7786         * testsuite/arm_branch_in_range.sh: Ditto.
7787         * testsuite/arm_branch_range.t: Ditto.
7788         * testsuite/thumb2_branch_range.t: Ditto.
7789         * testsuite/thumb_bl_in_range.s: Ditto.
7790         * testsuite/thumb_bl_out_of_range.s: Ditto.
7791         * testsuite/thumb_branch_range.t: Ditto.
7792
7793 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7794
7795         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7796         Add reloc offset information.
7797         * icf.cc (get_section_contents): Change iterators to point to the new
7798         vectors. Add reloc offset information to the contents.
7799         * icf.h (Icf::Sections_reachable_info): New typedef.
7800         (Icf::Sections_reachable_list): New typedef.
7801         (Icf::Offset_info): New typedef.
7802         (Icf::Reloc_info): New struct typedef.
7803         (Icf::Reloc_info_list): New typedef.
7804         (Icf::symbol_reloc_list): Delete method.
7805         (Icf::addend_reloc_list): Delete method.
7806         (Icf::section_reloc_list): Delete method.
7807         (Icf::reloc_info_list): New method.
7808         (Icf::reloc_info_list_): New member.
7809
7810 2010-02-19  Doug Kwan  <dougkwan@google.com>
7811
7812         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7813         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7814         * arm.cc (Arm_relocation_functions): New forward declaration.
7815         (Target_arm::Target_arm): Initialize new data members
7816         got_mod_index_offset_ and tls_base_symbol_defined_.
7817         (Target_arm::Relocate::relocate_tls): New method.
7818         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7819          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7820         New methods.
7821         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7822         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7823         (Target_arm::got_mod_index_offset_,
7824         Target_arm::tls_base_symbol_defined_): New data members.
7825         (Target_arm::Scan::local, Target::Scan::global,
7826         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7827         relocations.
7828
7829 2010-02-18  Doug Kwan  <dougkwan@google.com>
7830
7831         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7832         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7833         text section as a parameter becuase some broken tools may not set
7834         the link in section header.
7835         (Target_arm::has_got_section): New method.
7836         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7837         without any mapping symbol as data only.  Remove warning.
7838         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7839         link in its section header, try to discover the link by inspecting the
7840         REL31 relocation at the beginning of the section.
7841         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7842         in error message.
7843         (Target_arm::Scan::global): Treat any reference to the symbol
7844         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7845
7846 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7847
7848         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7849         (Scan::global_reloc_may_be_function_pointer): New function.
7850         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7851         (Scan::global_reloc_may_be_function_pointer): New function.
7852         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7853         (Scan::global_reloc_may_be_function_pointer): New function.
7854         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7855         (Scan::global_reloc_may_be_function_pointer): New function.
7856         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7857         (Scan::global_reloc_may_be_function_pointer): New function.
7858         (Scan::possible_function_pointer_reloc): New function.
7859         (Target_x86_64::can_check_for_function_pointers): New function.
7860         * gc.h (gc_process_relocs): Scan relocation types to determine if
7861         function pointers were taken for targets that support it.
7862         * icf.cc (Icf::find_identical_sections): Include functions for
7863         folding in safe ICF whose pointer is not taken.
7864         * icf.h (Secn_fptr_taken_set): New typedef.
7865         (fptr_section_id_): New member.
7866         (section_has_function_pointers): New function.
7867         (set_section_has_function_pointers): New function.
7868         (check_section_for_function_pointers): New function.
7869         * options.h: Fix comment for safe ICF option.
7870         * target.h (can_check_for_function_pointers): New function.
7871         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7872         Modify icf_safe_test for X86-64.
7873         * testsuite/Makefile.in: Regenerate.
7874         * testsuite/icf_safe_so_test.cc: New file.
7875         * testsuite/icf_safe_so_test.sh: New file.
7876         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7877         (main): Change to take pointer to function kept_func_3.
7878         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7879         folding is done correctly for X86-64.
7880
7881 2010-02-12  David S. Miller  <davem@davemloft.net>
7882
7883         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7884         is_symbolless parameter.
7885         (Output_reloc<SHT_REL>::is_symbolless): New.
7886         (Output_reloc<SHT_REL>::is_symbolless_): New.
7887         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7888         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7889         (Output_reloc<SHT_RELA>::is_symbolless): New.
7890         (Output_data_reloc::add_global): Handle is_symbolless.
7891         (Output_data_reloc::add_global_relative): Likewise.
7892         (Output_data_reloc::add_local): Likewise.
7893         (Output_data_reloc::add_local_relative): Likewise.
7894         (Output_data_reloc::add_symbolless_global_addend): New.
7895         (Output_data_reloc::add_symbolless_local_addend): New.
7896         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7897         is_symbolless.
7898         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7899         instead of ->is_relative_
7900         (Output_reloc::write): Likewise.
7901         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7902         (Output_reloc::write_rel): Simplify.
7903
7904         * sparc.cc (Target_sparc::Scan::local): Use
7905         ->add_symbolless_local_addend as needed.
7906         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7907         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7908         based upon relocation offset.
7909
7910 2010-02-11  Doug Kwan  <dougkwan@google.com>
7911
7912         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7913         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7914         beginning of function.
7915         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7916         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7917         parameter is_32bit in calls to should_apply_static_reloc.
7918         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7919         (check_DATA): Add arm_abs_global.stdout.
7920         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7921         arm_abs_global.stdout): New rules.
7922         (MOSTLLYCLEANFILES): Add arm_abs_global
7923         * Makefile.in: Regenerate.
7924         * testsuite/arm_abs_global.s: New file.
7925         * testsuite/arm_abs_global.sh: Ditto.
7926         * testsuite/arm_abs_lib.s: Ditto.
7927
7928 2010-02-11  Ian Lance Taylor  <iant@google.com>
7929
7930         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7931         Read_relocs task.
7932         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7933         Allocate_commons_task first.
7934         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7935         task, rather than symtab_lock_.
7936         (Gc_process_relocs::~Gc_process_relocs): New function.
7937         (Gc_process_relocs::is_runnable): Check this_blocker_.
7938         (Gc_process_relocs::locks): Use next_blocker_ rather than
7939         blocker_.
7940         (Scan_relocs::~Scan_relocs): New function.
7941         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7942         symtab_lock_.
7943         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7944         next_blocker_.
7945         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7946         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7947         constructor accordingly.
7948         (class Gc_process_relocs): Likewise.
7949         (class Scan_relocs): Likewise.
7950         * common.h (class Allocate_commons_task): Remove symtab_lock_
7951         field, and corresponding constructor parameter.
7952         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7953         symtab_lock_.
7954         (Allocate_commons_task::locks): Likewise.
7955
7956 2010-02-11  Ian Lance Taylor  <iant@google.com>
7957
7958         * gold-threads.h (class Once): Define.
7959         (class Initialize_lock): Rewrite as child of Once.
7960         * gold-threads.cc (class Once_initialize): Define.
7961         (once_pointer_control): New static variable.
7962         (once_pointer, once_arg): New static variables.
7963         (c_run_once): New static function.
7964         (Once::Once, Once::run_once, Once::internal_run): New functions.
7965         (class Initialize_lock_once): Remove.
7966         (initialize_lock_control): Remove.
7967         (initialize_lock_pointer): Remove.
7968         (initialize_lock_once): Remove.
7969         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7970         (Initialize_lock::initialize): Rewrite.
7971         (Initialize_lock::do_run_once): New function.
7972         * archive.cc (Archive::interpret_header): Only clear name if it is
7973         not already empty.
7974         * fileread.cc: Include "gold-threads.h"
7975         (file_counts_lock): New static variable.
7976         (file_counts_initialize_lock): Likewise.
7977         (File_read::release): Only increment counts when using --stats.
7978         Use a lock around the increment.
7979         * parameters.cc (class Set_parameters_target_once): Define.
7980         (set_parameters_target_once): New static variable.
7981         (Parameters::Parameters): Move here from parameters.h.
7982         (Parameters::set_target): Rewrite.
7983         (Parameters::set_target_once): New function.
7984         (Parameters::clear_target): Move here and rewrite.
7985         * parameters.h (class Parameters): Update declarations.  Add
7986         set_parameters_target_once_ field.
7987         (Parameters::Parameters): Move to parameters.cc.
7988         (Parameters::clear_target): Likewise.
7989         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7990         task.
7991         (Start_group::~Start_group): New function.
7992         (Start_group::is_runnable): New function.
7993         (Start_group::locks, Start_group::run): New functions.
7994         (Finish_group::run): Change saw_undefined to size_t.
7995         * readsyms.h (class Start_group): Define.
7996         (class Finish_group): Change saw_undefined_ field to size_t.
7997         (Finish_group::Finish_group): Remove saw_undefined and
7998         this_blocker parameters.  Change all callers.
7999         (Finish_group::set_saw_undefined): New function.
8000         (Finish_group::set_blocker): New function.
8001         * symtab.h (class Symbol_table): Change saw_undefined to return
8002         size_t.  Change saw_undefined_ field to size_t.
8003         * target-select.cc (Set_target_once::do_run_once): New function.
8004         (Target_selector::Target_selector): Initialize set_target_once_
8005         field.  Don't initialize lock_ and initialize_lock_ fields.
8006         (Target_selector::instantiate_target): Rewrite.
8007         (Target_selector::set_target): New function.
8008         * target-select.h (class Set_target_once): Define.
8009         (class Target_selector): Update declarations.  Make
8010         Set_target_once a friend.  Remove lock_ and initialize_lock_
8011         fields.  Add set_target_once_ field.
8012
8013 2010-02-10  Ian Lance Taylor  <iant@google.com>
8014
8015         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8016         queueing any tasks.
8017         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8018         (queue_middle_tasks): Add all blockers before queueing any tasks.
8019         (queue_final_tasks): Likewise.
8020         * token.h (Task_token::add_blockers): New function.
8021         * object.h (Input_objects::number_of_relobjs): New function.
8022
8023 2010-02-10  Ian Lance Taylor  <iant@google.com>
8024
8025         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8026         shared, not if not position independent.
8027         * x86_64.cc (Relocate::relocate_tls): Likewise.
8028         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8029         (tls_pie_pic_test): New target.
8030         * testsuite/Makefile.in: Rebuild.
8031
8032         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8033         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8034         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8035         * testsuite/Makefile.in: Rebuild.
8036
8037 2010-02-09  David S. Miller  <davem@davemloft.net>
8038
8039         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8040         R_SPARC_RELATIVE using ->add_local_relative().
8041         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8042
8043         * output.h (Output_data_dynamic::add_section_size): New method
8044         that takes two Output_data objects.
8045         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8046         entry param.  Handle it in initializers.
8047         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8048         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8049         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8050         arg.
8051         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8052         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8053         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8054         for dynrel_includes_plt.
8055         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8056         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8057         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8058         before .rela.plt
8059         (Target_sparc::do_finalize_sections): Update to pass true for
8060         dynrel_includes_plt.
8061         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8062         output before .rela.plt
8063         (Target_powerpc::do_finalize_sections): Update to pass true for
8064         dynrel_includes_plt when 32-bit.
8065
8066 2010-02-08  Doug Kwan  <dougkwan@google.com>
8067
8068         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8069         method.
8070         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8071         Arm_relobj::scan_section_for_cortex_a8_stubs,
8072         Arm_relobj::do_relocation_section): Instead of calling
8073         Output_section::output_address, use faster
8074         Arm_relobj::simple_input_section_output_address.
8075
8076 2010-02-08  David S. Miller  <davem@davemloft.net>
8077
8078         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8079         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8080         relocation helper function.
8081
8082         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8083         just like R_SPARC_GOT{10,13,22}.
8084         (Target_sparc::Scan::local): Likewise.
8085         (Target_sparc::Relocate:relocate): Likewise.
8086
8087 2010-02-06  Ian Lance Taylor  <iant@google.com>
8088
8089         * configure.ac: Rewrite targetobjs duplicate removal code to use
8090         only shell constructs.
8091         * configure: Rebuild.
8092
8093 2010-02-05  Doug Kwan  <dougkwan@google.com>
8094
8095         PR 11247
8096         * arm.cc (Arm_relobj::section_is_scannable): New method.
8097         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8098         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8099
8100 2010-02-04  Doug Kwan  <dougkwan@google.com>
8101
8102         PR 11247
8103         * arm-reloc-property.cc (cstdio): Include.
8104         * configure.ac (targetobjs): Remove duplicates.
8105         * configure: Regenerate.
8106         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8107         big and little endian version for a given address size.
8108
8109 2010-02-03  Doug Kwan  <dougkwan@google.com>
8110
8111         * arm-reloc-property.cc
8112         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8113         definition.
8114         * arm-reloc-property.h
8115         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8116         New method definition.
8117         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8118         declaration.
8119         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8120         overflow to N.
8121         (GOT_PREL): Change implemented to Y.
8122         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8123         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8124         (Arm_relocate_functions::movw_abs_nc): Remove method.
8125         (Arm_relocate_functions::movt_abs): Ditto.
8126         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8127         (Arm_relocate_functions::thm_movt_abs): Ditto.
8128         (Arm_relocate_functions::movw_rel_nc): Ditto.
8129         (Arm_relocate_functions::movw_rel): Ditto.
8130         (Arm_relocate_functions::movt_rel): Ditto.
8131         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8132         (Arm_relocate_functions:thm_movw_rel): Ditto.
8133         (Arm_relocate_functions:thm_movt_rel): Ditto.
8134         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8135         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8136         New method definitions.
8137         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8138         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8139         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8140         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8141         (Target_arm::Relocate::relocate): Check for non-static or
8142         unimplemented relocation code and exit early.  Change calls to
8143         Target_arm::reloc_uses_thumb_bit and
8144         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8145         instead.  Refactor code to handle similar relocations to increase
8146         code sharing.  Remove check for unsupported relocation code in switch
8147         statement.
8148         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8149         relocation property table to find out size.  Change error message to
8150         print out the name of a relocation code instead of the numeric value.
8151         (Target_arm::scan_reloc_for_stub): Use relocation property table
8152         instead of calling Target_arm::reloc_uses_thumb_bit().
8153
8154 2010-02-02  Doug Kwan  <dougkwan@google.com>
8155
8156         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8157         types of relaxed input section.
8158
8159 2010-02-02  Doug Kwan  <dougkwan@google.com>
8160
8161         * Makefile.am (HFILES): Add arm-reloc-property.h.
8162         (DEFFILES): New.
8163         (TARGETSOURCES): Add arm-reloc-property.cc
8164         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8165         (libgold_a_SOURCES): $(DEFFILES)
8166         * Makefile.in: Regenerate.
8167         * arm-reloc-property.cc: New file.
8168         * arm-reloc-property.h: New file.
8169         * arm-reloc.def: New file.
8170         * arm.cc: Update comments.
8171         (arm-reloc-property.h): New included header.
8172         (arm_reloc_property_table): New global variable.
8173         (Target_arm::do_select_as_default_target): New method definition.
8174         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8175         arm-reloc-property to targ_extra_obj.
8176         * parameters.cc (set_parameters_target): Call
8177         Target::select_as_default_target().
8178         * target.h (Target::select_as_default_target): New method definition.
8179         (Target::do_select_as_default_target): Same.
8180
8181 2010-02-01  Doug Kwan  <dougkwan@google.com>
8182
8183         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8184         first_output_text_section_.
8185         (Arm_exidx_fixup::first_output_text_section): New method definition.
8186         (Arm_exidx_fixup::first_output_text_section_): New data member.
8187         (Arm_exidx_fixup::process_exidx_section): Record the first text
8188         output section seen.
8189         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8190         and entsize in output section header.
8191
8192 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8193
8194         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8195         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8196         (Arm_relocate_functions::thm_alu11): New Method.
8197         (Arm_relocate_functions::thm_pc8): New Method.
8198         (Arm_relocate_functions::thm_pc12): New Method.
8199         (Target_arm::Scan::local): Handle the relocations.
8200         (Target_arm::Scan::global): Likewise.
8201         (Target_arm::Relocate::relocate): Likewise.
8202         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8203
8204 2010-01-29  Doug Kwan  <dougkwan@google.com>
8205
8206         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8207         of relocation types as ld.
8208
8209 2010-01-29  Doug Kwan  <dougkwan@google.com>
8210
8211         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8212         to public.
8213         (Arm_relocate_functions::thumb_branch_common): Ditto.
8214         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8215         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8216         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8217         Arm_relocate_functions::jump24): Remove.
8218         (Target_arm::Relocate::relocate): Adjust code to call
8219         Arm_relocation_functions::arm_branch_common and
8220         Arm_relocation_functions::thumb_branch_common instead of their removed
8221         wrappers.  Merge switch-cases together to reduce source code size.
8222
8223 2010-01-29  Doug Kwan  <dougkwan@google.com>
8224
8225         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8226         output_local_symbol_count_needs_update_.
8227         (Arm_relobj::output_local_symbol_count_needs_update,
8228          Arm_relobj::set_output_local_symbol_count_needs_update,
8229          Arm_relobj::update_output_local_symbol_count): New methods.
8230         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8231         member.
8232         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8233         of pointed function as in a R_ARM_PREL31 relocation.
8234         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8235         for output local symbol count updating.
8236         (Target_arm::do_relax): Update output local symbol counts in objects
8237         if necessary.
8238         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8239
8240 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8241
8242         * arm.cc: Added support for the ARM relocations:
8243         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8244         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8245         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8246         movw_prel_nc).
8247         (Arm_relocate_functions::movw_rel): New method.
8248         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8249         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8250         thm_movw_prel_nc).
8251         (Arm_relocate_functions::thm_movw_rel): New method.
8252         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8253         thm_movt_prel).
8254         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8255         relocations.
8256         (Target_arm::Scan::global): Likewise.
8257         (Target_arm::Relocate::relocate): Likewise.
8258         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8259         Likewise.
8260
8261 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8262
8263         * arm.cc: Added support for ARM group relocations.
8264         (Target_arm::reloc_needs_sym_origin): New method.
8265         (Arm_relocate_functions::calc_grp_kn): New method.
8266         (Arm_relocate_functions::calc_grp_residual): New method.
8267         (Arm_relocate_functions::calc_grp_gn): New method.
8268         (Arm_relocate_functions::arm_grp_alu): New Method.
8269         (Arm_relocate_functions::arm_grp_ldr): New Method.
8270         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8271         (Arm_relocate_functions::arm_grp_ldc): New Method.
8272         (Target_arm::Scan::local): Handle the ARM group relocations.
8273         (Target_arm::Scan::global): Likewise.
8274         (Target_arm::Relocate::relocate): Likewise.
8275         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8276         Likewise.
8277
8278 2010-01-26  Doug Kwan  <dougkwan@google.com>
8279
8280         * arm.cc (set): Include.
8281         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8282         pointer type.
8283         (Arm_output_section::Text_section_list): New type.
8284         (Arm_output_section::append_text_sections_to_list): New method.
8285         (Arm_output_section::fix_exidx_coverage): Ditto.
8286         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8287         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8288         Relobj::set_section_offset() instead of
8289         Sized_relobj::invalidate_section_offset().
8290         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8291         parameter for section headers. Ignore relocation sections for
8292         unallocated sections and EXIDX sections.
8293         (Target_arm::fix_exidx_coverage): New method.
8294         (Target_arm::output_section_address_less_than): New type.
8295         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8296         linked text section instead of the EXIDX section.
8297         (Arm_output_section::create_stub_group): Add an assertion to check
8298         that this is not an EXIDX output section.
8299         (Arm_output_section::append_text_sections_to_list): New method.
8300         (Arm_output_section::fix_exidx_coverage): Ditto.
8301         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8302         Arm_relobj::section_needs_reloc_stub_scanning.
8303         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8304         first pass.
8305         (Target_arm::fix_exidx_coverage): New method.
8306         * object.h (Relobj::set_output_section): New method.
8307         (Sized_relobj::invalidate_section_offset): Remove method.
8308         (Sized_relobj::do_invalidate_section_offset): Remove method.
8309         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8310
8311 2010-01-25  Doug Kwan  <dougkwan@google.com>
8312
8313         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8314         Fix warning due to signed and unsigned comparison on a 32-bit host.
8315
8316 2010-01-22  Doug Kwan  <dougkwan@google.com>
8317
8318         * arm.cc (Target_arm::do_relax): Record an output section for section
8319         offset adjustment it contains any stub table that has changed.
8320         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8321         offsets in an output section if necessary.
8322         * output.cc (Output_section::Output_section): Initialize
8323         section_offsets_need_adjustments_.
8324         (Output_section::add_input_section_for_script): Renamed to
8325         Output_section::add_simple_input_section.
8326         (Output_section::save_states): Add a comment.
8327         (Output_section::discard_states): New method defintion.
8328         (Output_section::adjust_section_offsets): Same.
8329         * output.h (Output_section::add_input_section_for_script): Renamed to
8330         Output_section::add_simple_input_section.
8331         (Output_section::discard_states): New method declaration.
8332         (Output_section::adjust_section_offsets): Same.
8333         (Output_section::section_offsets_need_adjustment,
8334         Output_section::set_section_offsets_need_adjustment): New method
8335         definitions.
8336         (Output_section::section_offsets_need_adjustment_): New data member.
8337         * script-sections.cc
8338         (Output_section_element_input::set_section_address): Adjust code for
8339         renaming of Output_section::add_input_section_for_script.
8340         (Orphan_output_section::set_section_address): Same.
8341
8342 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8343
8344         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8345         Fix_v4bx enum values .
8346         * gold/options.h (General_options): New option definitions.
8347         (General_options::fix_v4bx): New method.
8348         (General_options::Fix_v4bx): New enum.
8349         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8350         (General_options::parse_fix_v4bx_interworking): New method.
8351
8352 2010-01-22  Doug Kwan  <dougkwan@google.com>
8353
8354         * arm.cc (Arm_exidx_fixup): New class.
8355
8356 2010-01-21  Doug Kwan  <dougkwan@google.com>
8357
8358         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8359         classes.
8360         (Arm_exidx_section_offset_map): New type.
8361
8362 2010-01-21  Doug Kwan  <dougkwan@google.com>
8363
8364         * arm.cc (Arm_exidx_input_section): New class.
8365         (Arm_relobj::exidx_input_section_by_link,
8366         Arm_relobj::exidx_input_section_by_shndx,
8367         Arm_relobj::make_exidx_input_section): New methods.
8368         (read_arm_attributes_section): Remove.
8369         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8370         information about them.
8371         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8372         to here.
8373
8374 2010-01-20  Doug Kwan  <dougkwan@google.com>
8375
8376         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8377         Input_section_specifier to Section_id.
8378         (Target_arm::new_arm_input_section: Adjust code for change of key
8379         type.
8380         (Target_arm::find_arm_input_section): Ditto.
8381         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8382         (Section_id): Remove.
8383         (Garbage_collection::Section_id_hash): Remove.
8384         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8385         (Section_id): Remove.
8386         (Icf::Section_id_hash): Remove.
8387         * object.h (Section_id, Const_section_id, Section_id_hash,
8388         Const_section_id_hash): New type definitions.
8389         * output.cc (Output_section::add_relaxed_input_section): Change to
8390         use Const_section_id instead of Input_section_specifier as key type.
8391         (Output_section::add_merge_input_section): Ditto.
8392         (Output_section::build_relaxation_map): Change to use Section_id
8393         instead of Input_section_specifier as key type.
8394         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8395         Ditto.
8396         (Output_section::convert_input_sections_to_relaxed_sections): Change
8397         to use Const_section_id instead of Input_section_specifier as key type.
8398         (Output_section::find_merge_section): Ditto.
8399         (Output_section::find_relaxed_input_section): Ditto.
8400         * output.h (Input_section_specifier): Remove class.
8401         (Output_section::Output_section_data_by_input_section_map): Change
8402         key type to Const_section_id.
8403         (Output_section::Output_relaxed_input_section_by_input_section_map):
8404         Ditto.
8405         (Output_section::Relaxation_map): Change key type to Section_id.
8406
8407 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8408
8409         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8410         (class Arm_v4bx_stub): New class.
8411         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8412         (Stub_factory::make_arm_v4bx_stub): New method.
8413         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8414         (Stub_table::empty): Handle v4bx stubs.
8415         (Stub_table::add_arm_v4bx_stub): New method.
8416         (Stub_table::find_arm_v4bx_stub): New method.
8417         (Arm_relocate_functions::v4bx): New method.
8418         (Target_arm::fix_v4bx): New method.
8419         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8420         (Stub_table::relocate_stubs): Likewise.
8421         (Stub_table::do_write): Likewise.
8422         (Stub_table::update_data_size_and_addralign): Likewise.
8423         (Stub_table::finalize_stubs):  Likewise.
8424         (Target_arm::Scan::local): Likewise.
8425         (Target_arm::Scan::global): Likewise.
8426         (Target_arm::do_finalize_sections): Likewise.
8427         (Target_arm::Relocate::relocate): Likewise.
8428         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8429         Likewise.
8430         (Target_arm::scan_reloc_for_stub): Likewise.
8431         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8432
8433 2010-01-19  Ian Lance Taylor  <iant@google.com>
8434
8435         * output.cc (Output_section_headers::do_sized_write): Write large
8436         segment count to sh_info field.
8437         (Output_file_header::do_sized_write): For large segment count,
8438         write PN_XNUM to e_phnum field.
8439
8440 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8441
8442         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8443         (Arm_relocate_functions::thm_jump8): New function.
8444         (Arm_relocate_functions::thm_jump11): New function.
8445         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8446         R_ARM_THM_JUMP11.
8447         (Target_arm::Scan::global): Likewise.
8448         (Target_arm::Relocate::relocate): Likewise.
8449         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8450         Likewise.
8451
8452 2010-01-14  Doug Kwan  <dougkwan@google.com>
8453
8454         * arm.cc (map, utility): Include headers.
8455         (Target_arm::apply_cortex_a8_workaround): New method.
8456         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8457         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8458         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8459         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8460         the --[no-]fix-cortex-a8 command line options.
8461         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8462         (Target_arm::relocate_stub): Use addend in instruction template.
8463         * options.h (DEFINE_bool): Set the user-set flag.
8464         (General_options): Add --[no-]-fix-cortex options.
8465         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8466         : Update fast look-up map after conversion.
8467
8468 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8469
8470         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8471         in the first pass of do_layout.
8472
8473 2010-01-13  Doug Kwan  <dougkwan@google.com>
8474
8475         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8476         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8477         apparent compiler problem of not folding static constant integral
8478         data members of elfcpp::Elf_sizes<32>.
8479
8480 2010-01-13  Doug Kwan  <dougkwan@google.com>
8481
8482         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8483         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8484         Arm_relobj::scan_section_for_cortex_a8_erratum,
8485         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8486         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8487         sections to scan for relocation stubs into a new method
8488         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8489         relocation and Cortex-A8 stub scanning.
8490         (Target_arm::do_relax): Force stubs to be after stubbed sections
8491         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8492         the beginning of a new relaxation pass.  Update a comment.
8493         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8494
8495 2010-01-12  Ian Lance Taylor  <iant@google.com>
8496
8497         * target-reloc.h (visibility_error): New inline function.
8498         (relocate_section): Call visibility_error.
8499         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8500         (MOSTLYCLEANFILES): Likewise.
8501         (protected_4_pic.o, protected_3.err): New targets.
8502         * testsuite/protected_4.cc: New file.
8503
8504 2010-01-12  Doug Kwan  <dougkwan@google.com>
8505
8506         * arm.cc (Cortex_a8_reloc): New class.
8507         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8508         and cortex_a8_relocs_info_.
8509         (Target_arm::fix_cortex_a8): New method definition.
8510         (Target_arm::Cortex_a8_relocs_info): New type.
8511         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8512         New data member declarations.
8513         (Target_arm::scan_reloc_for_stub): Record information about
8514         relocations for THUMB branches that might be exempted from the
8515         Cortex-A8 workaround.
8516         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8517         at the beginning of a relaxation pass.
8518
8519 2010-01-12  Doug Kwan  <dougkwan@google.com>
8520
8521         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8522         (Arm_relobj::Mapping_symbol_position,
8523          Arm_reloj::Mapping_symbol_position_less,
8524          Arm_relobj::Mapping_symbols_info): New types.
8525         (Target_arm::is_mapping_symbol_name): New method definition.
8526         (Arm_relobj::do_count_local_symbols): Save information about mapping
8527         symbols.
8528
8529 2010-01-11  Doug Kwan  <dougkwan@google.com>
8530
8531         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8532         Arm_relocate_functions::thumb32_branch_upper,
8533         Arm_relocate_functions::thumb32_branch_lower,
8534         Arm_relocate_functions::thumb32_cond_branch_offset,
8535         Arm_relocate_functions::thumb32_cond_branch_upper,
8536         Arm_relocate_functions::thumb32_cond_branch_lower,
8537         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8538         branch offset encoding.
8539         (Arm_relocate_functions::thumb_branch_common): Use new branch
8540         offset encoding methods to avoid code duplication.
8541         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8542         (Stub_addend_reader::operator()): Use new branch encoding method
8543         to avoid code duplication.
8544
8545 2010-01-11  Doug Kwan  <dougkwan@google.com>
8546
8547         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8548         (Target_arm::do_finalize_sections): Define special EXIDX section
8549         symbols only if referenced.
8550         * gc.h (Garbage_collection::add_reference): New method.
8551         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8552         code duplication.
8553
8554 2010-01-11  Ian Lance Taylor  <iant@google.com>
8555
8556         * script.cc (Version_script_info::build_expression_list_lookup):
8557         Change complaing about duplicate wildcard match from error to
8558         warning.
8559
8560         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8561         of 2009-12-30.
8562         (Version_script_info::Version_script_info): Initialize globs_,
8563         default_version_, default_is_global_, and exact_.  Don't
8564         initialize globals_ or locals_.
8565         (Version_script_info::build_lookup_tables): Build local symbols
8566         first.
8567         (Version_script_info::unquote): New function.
8568         (Version_script_info::add_exact_match): New function.
8569         (Version_script_info::build_expression_list_lookup): Remove lookup
8570         parameter.  Add is_global parameter.  Change all callers.  Handle
8571         wildcard pattern specially.  Unquote pattern.  Call
8572         add_exact_match.
8573         (Version_script_info::get_name_to_match): New function.
8574         (Version_script_info::get_symbol_version): New function.
8575         (Version_script_info::get_symbol_version_helper): Remove.
8576         (Version_script_info::check_unmatched_names): Call unquote.
8577         * script.h (class Version_script_info): Change get_symbol_version
8578         to be non-inline and add is_global parameter; change all callers.
8579         Rewrite symbol_is_local.  Update declarations.  Define struct
8580         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8581         Remove globals_ and locals_ members.  Add exact_, globs_,
8582         default_version_, is_global_.
8583         (Version_script_info::Glob): Remove pattern, add expression and
8584         is_global.  Update constructor.  Change all callers.
8585         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8586         default version.
8587         (Versions::symbol_section_contents): If a symbol is undefined, or
8588         defined in a dynamic object, set the version index to
8589         VER_NDX_LOCAL.
8590         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8591         symbol_is_local.
8592         (Symbol_table::add_from_pluginobj): Likewise.
8593         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8594
8595 2010-01-11  Doug Kwan  <dougkwan@google.com>
8596
8597         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8598         (incremental_dump_LDADD): Add linking option for libintl.
8599         * Makefile.in: Regenerate.
8600
8601 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8602
8603         PR gold/11144
8604         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8605         instead of -Ds.
8606         * testsuite/Makefile.in: Regenerated.
8607
8608 2010-01-10  Doug Kwan  <dougkwan@google.com>
8609
8610         * options.h (DEFINE_var): Use parentheses around argument varname__
8611         in macro body to avoid any unintended subsequent substitutions.
8612
8613 2010-01-10  Ian Lance Taylor  <iant@google.com>
8614
8615         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8616         candidates before doing symbol resolution.
8617
8618         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8619         ODR candidates if only one is weak.
8620
8621 2010-01-08  Ian Lance Taylor  <iant@google.com>
8622
8623         * script.cc (Version_script_info::build_expression_list_lookup):
8624         Don't warn about ambiguous version, just record the ambiguity.
8625         (Version_script_info::get_symbol_version_helper): Give error if
8626         version is ambiguous.
8627
8628 2010-01-08  Doug Kwan  <dougkwan@google.com>
8629
8630         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8631         prev_data_size_ and prev_addralign_.  Remove initializer for
8632         deleted data member has_been_changed_.
8633         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8634         to determine if the table is empty.
8635         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8636         Remove.
8637         (Stub_table::add_reloc_stub): Define method in class definition
8638         instead of just declaring it there.
8639         (Stub_table::add_cortex_a8_stub): New method definition.
8640         (Stub_table::update_data_size_and_addralign): Ditto.
8641         (Stub_table::finalize_stubs): Ditto.
8642         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8643         (Stub_table::do_addralign_): Return address alignment in the
8644         (Stub_table::do_reset_address_and_file_offset): Define method in
8645         class definition instead of declaring it there.  Set current data
8646         size to be the data size of the previous pass.
8647         (Stub_table::set_final_data_size): Use current data size as the
8648         final data size.
8649         (Stub_table::relocate_stub): Change parameter type of stub from
8650         Reloc_stub pointer to Stub pointer.
8651         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8652         (Stub_table::Cortex_a8_stub_list): New typedef.
8653         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8654          Stub_table::prev_addralign_): New data member.
8655         (Arm_relobj::Arm_relobj): Initialize data member
8656         section_has_cortex_a8_workaround_.
8657         (Arm_relobj::section_has_cortex_a8_workaround,
8658          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8659          definitions.
8660         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8661         declarations.
8662         (Target_arm::relocate_stub): Change parameter type of stub from
8663         Reloc_stub pointer to Stub pointer.
8664         (Insn_template::size, Insn_template::alignment): Handle
8665         THUMB16_SPECIAL_TYPE.
8666         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8667          Stub_table::update_data_size_and_addralign,
8668          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8669         definitions.
8670         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8671         (Stub_table::do_write): Ditto.
8672         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8673
8674 2010-01-08  Ian Lance Taylor  <iant@google.com>
8675
8676         PR 11108
8677         * symtab.h (class Symbol): Remove fields is_target_special_ and
8678         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8679         (Symbol::is_defined_in_discarded_section): New function.
8680         (Symbol::set_is_defined_in_discarded_section): New function.
8681         (Symbol::has_plt_offset): Rewrite.
8682         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8683         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8684         Don't initialize is_target_special_ or has_plt_offset_.
8685         Initialize is_defined_in_discarded_section_.
8686         (Symbol_table::add_from_relobj): If appropriate, set
8687         is_defined_in_discarded_section.
8688         * resolve.cc (Symbol::override_base_with_special): Don't test
8689         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8690         * target-reloc.h (relocate_section): Do special handling for
8691         symbols defined in discarded sections for global symbols as well
8692         as local symbols.
8693
8694 2010-01-08  Ian Lance Taylor  <iant@google.com>
8695
8696         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8697         the SHT_SYMTAB case.
8698
8699 2010-01-08  Ian Lance Taylor  <iant@google.com>
8700
8701         * object.cc (Sized_relobj::do_layout): Don't get confused if
8702         layout_eh_frame returns NULL.
8703
8704 2010-01-08  Ian Lance Taylor  <iant@google.com>
8705
8706         PR 11084
8707         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8708         dynamic symbol table, use the normal symbol table.
8709         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8710         symbol table.
8711
8712 2010-01-08  Ian Lance Taylor  <iant@google.com>
8713
8714         PR 11072
8715         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8716         sections.
8717
8718 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8719
8720         * version.cc (print_version): Change to "Copyright 2010".
8721
8722 2010-01-08  Ian Lance Taylor  <iant@google.com>
8723
8724         PR 10287
8725         PR 11063
8726         * i386.cc (class Target_i386): Change return type of plt_section
8727         to be non-const.
8728         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8729         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8730         tls_desc_rel_ field.
8731         (Output_data_plt_i386::rel_tls_desc): New function.
8732         (Target_i386::rel_tls_desc_section): New function.
8733         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8734         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8735         R_386_TLS_DESC reloc in rel_tls_desc_section.
8736         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8737         Define struct Tlsdesc_info.
8738         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8739         (Target_x86_64::do_reloc_symbol_index): New function.
8740         (Target_x86_64::add_tlsdesc_info): New function.
8741         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8742         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8743         tlsdesc_rel_ field.
8744         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8745         all callers.
8746         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8747         (Target_x86_64::rela_tlsdesc_section): New function.
8748         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8749         handling.
8750         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8751         (Target_x86_64::do_reloc_addend): New function.
8752         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8753         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8754         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8755         (Output_reloc::type): New function.
8756         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8757         (Output_reloc::is_target_specific): New function.
8758         (Output_reloc::target_arg): New function.
8759         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8760         absolute relocs and target specific relocs.
8761         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8762         add_target_specific.
8763         (class Output_data_reloc) [SHT_RELA]: Likewise.
8764         * output.cc (Output_reloc::Output_reloc): Add four new versions
8765         for absolute relocs and target specific relocs.
8766         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8767         (Output_reloc::get_symbol_index): Likewise.
8768         (Output_reloc::local_section_offset): Check that local_sym_index_
8769         is not TARGET_CODE or 0.
8770         (Output_reloc::symbol_value): Likewise.
8771         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8772         reloc.
8773         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8774         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8775         functions.
8776         * layout.cc (add_target_dynamic_tags): Use output section for
8777         DT_PLTRELSZ and DT_JMPREL.
8778
8779 2010-01-07  Ian Lance Taylor  <iant@google.com>
8780
8781         PR 11061
8782         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8783         function.
8784         (class Output_data_reloc_generic): Define.
8785         (class Output_data_reloc_base): Change base class to
8786         Output_data_reloc_generic.  Change add() method to call
8787         bump_relative_reloc_count for a relative reloc.  Remove
8788         sort_relocs_ field.
8789         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8790         to sort_relocs().
8791         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8792         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8793         appropriate.
8794         * layout.h (class Layout): Update declaration.
8795
8796 2010-01-07  Ian Lance Taylor  <iant@google.com>
8797
8798         * output.h (class Output_data): Add const version of
8799         output_section and do_output_section.
8800         (class Output_section_data): Add const version of
8801         do_output_section.
8802         (class Output_section): Likewise.
8803         * layout.cc (Layout::add_target_dynamic_tags): New function.
8804         * layout.h (class Layout): Update declarations.
8805         * arm.cc (Target_arm::do_finalize_sections): Use
8806         add_target_dynamic_tags.
8807         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8808         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8809         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8810         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8811
8812 2010-01-07  Ian Lance Taylor  <iant@google.com>
8813
8814         PR 11042
8815         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8816         object as needed.
8817
8818 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8819             Ian Lance Taylor  <iant@google.com>
8820
8821         PR 11019
8822         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8823         Xindex::read_symtab_xindex.
8824
8825 2010-01-07  Doug Kwan  <dougkwan@google.com>
8826
8827         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8828         (Insn_template::thumb16_bcond_insn): New method declaration.
8829         (Insn_template): Fix spelling.
8830         (Stub::thumb16_special): New method declaration.
8831         (Stub::do_write): Define virtual method which was previously pure
8832         virtual.
8833         (Stub::do_thumb16_special): New method declaration.
8834         (Stub::do_fixed_endian_write): New template member.
8835         (Reloc_stub::do_write): Remove.
8836         (Reloc_stub::do_fixed_endian_write): Remove.
8837         (Cortex_a8_stub): New class definition.
8838         (Stub_factory::make_cortex_a8_stub): New method definition.
8839         (Stub_factory::Stub_factory): Add missing static storage class
8840         qualifier for elf32_arm_stub_a8_veneer_blx.
8841
8842 2010-01-07  Ian Lance Taylor  <iant@google.com>
8843
8844         PR 10980
8845         * options.h (class General_options): Add --warn-unresolved-symbols
8846         and --error-unresolved-symbols.
8847         * errors.cc (Errors::undefined_symbol): Implement
8848         --warn-unresolved-symbols.
8849
8850         * options.h (class General_options): Add -z text and -z textoff.
8851         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8852
8853 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8854
8855         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8856         (Garbage_collection::cident_sections): New function.
8857         (Garbage_collection::add_cident_section): New function.
8858         (Garbage_collection::cident_sections_): New member.
8859         (gc_process_relocs): Add references to sections whose names are C
8860         identifiers.
8861         * gold.h (cident_section_start_prefix): New constant.
8862         (cident_section_stop_prefix): New constant.
8863         (is_cident): New function.
8864         * layout.cc (Layout::define_section_symbols): Replace string constants
8865         with the newly defined constants.
8866         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8867         C identifiers.
8868         * testsuite/Makefile.am: Add gc_orphan_section_test.
8869         * testsuite/Makefile.in: Regenerate.
8870         * testsuite/gc_orphan_section_test.cc: New file.
8871         * testsuite/gc_orphan_section_test.sh: New file.
8872
8873 2010-01-06  Ian Lance Taylor  <iant@google.com>
8874
8875         PR 10980
8876         * options.h (class General_options): Add --warn-shared-textrel.
8877         * layout.cc (Layout::finish_dynamic_section): Implement
8878         --warn-shared-textrel.
8879
8880         PR 10980
8881         * options.h (class General_options): Add --warn-multiple-gp.
8882
8883 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8884
8885         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8886         $(THREADSLIB) and $(LIBDL).
8887         * Makefile.in: Rebuild.
8888
8889 2010-01-06  Ian Lance Taylor  <iant@google.com>
8890
8891         PR 10980
8892         * options.cc (General_options::parse_section_start): New function.
8893         (General_options::section_start): New function.
8894         (General_options::General_options): Initialize all members.
8895         * options.h: Include <map>
8896         (class General_options): Add --section-start.  Add section_starts_
8897         member.
8898         * layout.cc (Layout::attach_allocated_section_to_segment): If
8899         --section-start was used, set the address of the segment.  Remove
8900         local sort_sections.
8901         (Layout::relaxation_loop_body): If the address of the load segment
8902         has been set by --section-start, don't use it.
8903         * output.h (Output_segment::update_flags_for_output_section): New
8904         function.
8905         * output.cc (Output_segment::add_output_section): Call
8906         update_flags_for_output_section.
8907
8908 2010-01-05  Ian Lance Taylor  <iant@google.com>
8909
8910         PR 10980
8911         * options.h (class General_options): Add --undefined-version.
8912         * script.cc (struct Version_expression): Add was_matched_by_symbol
8913         field.
8914         (Version_script_info::matched_symbol): New function.
8915         (Version_script_info::get_symbol_version_helper): Call
8916         matched_symbol.
8917         (Version_script_info::check_unmatched_names): New function.
8918         * script.h (class Version_script_info): Update declarations.
8919         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8920
8921         * options.h (class General_options): Use DEFINE_bool_alias for
8922         allow_multiple_definition.
8923         * resolve.cc (Symbol_table::should_override): Don't test
8924         allow_multiple_definition.
8925
8926         PR 10980
8927         * options.h (class General_options): Add --cref.
8928         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8929         until after printing cref table.
8930         * cref.cc: Include "symtab.h".
8931         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8932         (Cref_table_compare::operator()): New function.
8933         (Cref_inputs::gather_cref): New function.
8934         (filecol): New static const.
8935         (Cref_inputs::print_cref): New function.
8936         (Cref::print_cref): New function.
8937         * cref.h: Include <cstdio>.
8938         (class Cref): Update declarations.
8939         * mapfile.h (Mapfile::file): New function.
8940         * object.h (class Object): Define Symbols.  Declare virtual
8941         do_get_global_symbols.
8942         (Object::get_global_symbols): New function.
8943         * object.cc (Input_objects::add_object): Pass object to cref_ if
8944         --cref.
8945         (Input_objects::archive_start): Likewise.
8946         (Input_objects::archive_stop): Likewise.
8947         (Input_objects::print_cref): New function.
8948         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8949         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8950         --cref.
8951         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8952         function.
8953         * plugin.h (class Sized_pluginobj): Update declarations.
8954
8955 2010-01-05  Ian Lance Taylor  <iant@google.com>
8956
8957         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8958         to is_default_version.  Rename insdef to insdefault.
8959         (Symbol_table::add_from_relobj): Rename def to is_default_version
8960         and local to is_forced_local.
8961         (Symbol_table::add_from_pluginobj): Likewise.
8962         (Symbol_table::add_from_dynobj): Likewise.
8963         (Symbol_table::define_special_symbol): Rename insdef to
8964         insdefault.
8965
8966 2010-01-04  Ian Lance Taylor  <iant@google.com>
8967
8968         PR 10980
8969         * options.h (class General_options): Add
8970         --allow-multiple-definition and -z muldefs.
8971         * resolve.cc (Symbol_table::should_override): Don't warn about a
8972         multiple symbol definition if --allow-multiple-definition or -z
8973         muldefs.
8974
8975         PR 10980
8976         * options.h (class General_options): Add --add-needed and
8977         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8978         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8979         error if --copy-dt-needed-entries aka --add-needed is used and
8980         would cause a change in behaviour.
8981
8982         PR 10980
8983         * options.h (class General_options): Add -G as a short version of
8984         --shared.  Add no-op options -assert, -g, and -i.
8985
8986 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8987
8988         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8989         check for .text or .gnu.linkonce.t sections.
8990         * icf.cc (Icf::find_identical_sections): Ditto.
8991         Change the detection for mangled function name within the section
8992         name.
8993         * icf.h (is_section_foldable_candidate): New function.
8994
8995 2009-12-30  Ian Lance Taylor  <iant@google.com>
8996
8997         PR 10980
8998         * options.h (class General_options): Permit two dashes with
8999         --retain-symbols-file.
9000
9001 2009-12-30  Ian Lance Taylor  <iant@google.com>
9002
9003         PR 10979
9004         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9005         don't put the file header and segment headers in the text
9006         segment.
9007
9008         PR 10979
9009         * common.cc (Sort_commons::operator()): Stabilize sort when both
9010         entries are NULL.
9011         (Symbol_table::do_allocate_commons_list): When allocating common
9012         symbols, skip a symbol which is no longer common.
9013         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9014         an object before checking its type.
9015         * testsuite/common_test_2.c: New file.
9016         * testsuite/common_test_3.c: New file.
9017         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9018         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9019         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9020         (common_test_2_pic.o, common_test_2.so): New targets.
9021         (common_test_3_pic.o, common_test_3.so): New targets.
9022         * testsuite/Makefile.in: Rebuild.
9023
9024         PR 10979
9025         * script.cc (read_input_script): If we see a new SECTIONS clause,
9026         and we have added an input section, give an error.
9027         * layout.h (class Layout): Add have_added_input_section function.
9028         Add have_added_input_section_ field.
9029         * layout.cc (Layout::Layout): Initialize
9030         have_added_input_section_.
9031         (Layout::layout): Set have_added_input_section_.
9032         (Layout::layout_eh_frame): Likewise.
9033
9034 2009-12-30  Ian Lance Taylor  <iant@google.com>
9035
9036         PR 10931
9037         * options.h (class General_options): Add --sort-common option.
9038         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9039         * common.cc (Sort_common): Add sort_order parameter to
9040         constructor.  Add sort_order_ field.
9041         (Sort_commons::operator): Check sort_order_.
9042         (Symbol_table::allocate_commons): Determine the sort order.
9043         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9044         Change all callers.
9045         (Symbol_table::do_allocate_commons_list): Likewise.
9046
9047 2009-12-30  Ian Lance Taylor  <iant@google.com>
9048
9049         PR 10916
9050         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9051         symbols from this object, don't change the visibility of an
9052         undefined symbol.
9053         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9054
9055 2009-12-30  Ian Lance Taylor  <iant@google.com>
9056
9057         PR 10861
9058         * script.h (class Version_script_info): Define Language enum.
9059         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9060         new fields globals_, locals_, and is_finalized_.
9061         * script.cc: Various formatting fixes.
9062         (class Parser_closure): Change language_stack_ from a vector of
9063         std::string to one of Version_script_info::Language.  Adjust all
9064         uses accordingly.
9065         (class Lazy_demangler): Remove.
9066         (struct Version_expression): Change language from std::string to
9067         Version_script_info::Language.
9068         (Version_script_info::Version_script_info): New function.
9069         (Version_script_info::~Version_script_info): Don't call clear.
9070         (Version_script_info::finalize): New function.
9071         (Version_script_info::build_lookup_tables): New function.
9072         (Version_script_info::build_expression_list_lookup): New
9073         function.
9074         (Version_script_info::get_symbol_version_helper): Rewrite to use
9075         lookup tables.
9076         (Version_script_info::print_expression_list): Adjust to use
9077         Version_script_info::Language.
9078         (script_push_lex_into_version_mode): Check that the version script
9079         has not been finalized.
9080         (version_script_push_lang): Change language string to
9081         Version_script_info::Language.
9082         * options.cc (Command_line::version_script): New function.
9083         * options.h (class General_options): Add finalize_dynamic_list
9084         function.  Change version_script from declaration to definition.
9085         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9086         * testsuite/version_script.map: Remove duplicate def of foo.
9087         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9088         version_script.map.
9089         * testsuite/Makefile.in: Rebuild.
9090
9091 2009-12-30  Ian Lance Taylor  <iant@google.com>
9092
9093         PR 10843
9094         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9095         if the input symbol index is 0, make the output symbol index 0.
9096
9097 2009-12-30  Ian Lance Taylor  <iant@google.com>
9098
9099         PR 10670
9100         * options.h (class General_options): Add -x/--discard-all.
9101         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9102         --discard-all.  If the local symbol needs a dynamic entry, check
9103         that before handling --discard-locals.
9104
9105 2009-12-30  Ian Lance Taylor  <iant@google.com>
9106
9107         PR 10450
9108         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9109         flags to PF_R.
9110         (Output_segment::add_output_section): Don't change the flags if
9111         the type is PT_TLS.
9112
9113         PR 10450
9114         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9115         GNU hash table if they need a dynamic value.  Otherwise, don't add
9116         them if they are defined in a dynamic object or are forced local.
9117
9118 2009-12-29  Ian Lance Taylor  <iant@google.com>
9119
9120         PR 10450
9121         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9122         .gnu.hash table for a 32-bit target.
9123
9124         PR 10450
9125         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9126         regular and a dynamic object only needs a dynamic symbol table
9127         entry if it is externally visible.
9128
9129         PR 10450
9130         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9131         constructor.  Add global_offset_table_ field.
9132         (Target_i386::got_section): Set global_offset_table_.
9133         (Target_i386::do_finalize_sections): Set global_offset_table_
9134         size.
9135         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9136         in constructor.  Add global_offset_table_ field.
9137         (Target_x86_64::got_section): Set global_offset_table_.
9138         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9139         size.
9140
9141         * layout.cc (Layout::Layout): Initialize increase_relro_.
9142         (Layout::get_output_section): Add is_relro, is_last_relro, and
9143         is_first_non_relro parameters.  Change all callers.
9144         (Layout::choose_output_section): Likewise.
9145         (Layout::add_output_section_data): Likewise.
9146         (Layout::make_output_section): Likewise.
9147         (Layout::set_segment_offsets): Clear increase_relro when using a
9148         linker script.
9149         * layout.h (class Layout): Add increase_relro method.  Add
9150         increase_relro_ field.  Update declarations.
9151         * output.cc (Output_section::Output_section): Initialize
9152         is_last_relro_ and is_first_non_relro_.
9153         (Output_segment::add_output_section): Group relro sections is
9154         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9155         (Output_segment::maximum_alignment): Remove relro handling.
9156         (Output_segment::set_section_addresses): Add increase_relro
9157         parameter.  Change all callers.  Add initial alignment to align
9158         relro sections on separate page.  Remove old relro handling.
9159         (Output_segment::set_section_list_addresses): Remove in_relro
9160         parameter.  Change all callers.
9161         (Output_segment::set_offset): Add increase parameter.  Change all
9162         callers.  Remove old relro handling.
9163         * output.h (class Output_section): Add new methods: is_last_relro,
9164         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9165         Add is_last_relro_ and is_first_non_relro_ fields.
9166         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9167         Create separate .got.plt section.  Call increase_relro.
9168         * x86_64.cc (Target_x86_64::got_section): Likewise.
9169         * testsuite/relro_script_test.t: Add .got.plt.
9170
9171         PR 10450
9172         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9173         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9174         (Layout::finalize): Call set_dynamic_symbol_size.
9175         (Layout::set_dynamic_symbol_size): New function.
9176         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9177         set_dynamic_symbol_size.
9178
9179         PR 10450
9180         * output.h (class Output_section): Add is_entsize_zero_ field.
9181         * output.cc (Output_section::Output_section): Initialize
9182         is_entsize_zero_.
9183         (Output_section::set_entsize): If two different entsizes are
9184         requested, force it to zero.
9185         (Output_section::add_input_section): Set flags for .debug_str
9186         before updating section flags.  Set entsize.
9187         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9188         and SHF_STRING if all input sections have those flags.
9189
9190 2009-12-29   Rafael Espindola  <espindola@google.com>
9191
9192         * main.cc (main): Fix the sys time reporting.
9193         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9194         reporting.
9195
9196 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9197
9198         * options.cc (General_options::parse_version): Allow -v to exit
9199         without an error if there is nothing to link.
9200
9201 2009-12-29  Ian Lance Taylor  <iant@google.com>
9202
9203         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9204         using a version of gcc before 4.1.
9205         * configure: Rebuild.
9206
9207 2009-12-28  Chris Demetriou  <cgd@google.com>
9208
9209         * attributes.cc (Output_attributes_section_data::do_write): Use
9210         std::vector::front rather than std::vector::data.
9211
9212 2009-12-28  Ian Lance Taylor  <iant@google.com>
9213
9214         * symtab.h (class Symbol_table): Add enum Defined.
9215         * resolve.cc (Symbol_table::should_override): Add defined
9216         parameter.  Change all callers.  Test whether object is NULL
9217         before calling a method on it.
9218         (Symbol_table::report_resolve_problem): Add defined parameter.
9219         Change all callers.
9220         (Symbol_table::should_override_with_special): Likewise.
9221         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9222         parameter.  Change all callers.
9223         (Symbol_table::do_define_in_output_data): Likewise.
9224         (Symbol_table::define_in_output_segment): Likewise.
9225         (Symbol_table::do_define_in_output_segment): Likewise.
9226         (Symbol_table::define_as_constant): Likewise.
9227         (Symbol_table::do_define_as_constant): Likewise.
9228         * script.h (class Symbol_assignment): Add is_defsym parameter to
9229         constructor; change all callers.
9230         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9231         parameter.  Change all callers.  Add is_defsym_ field.
9232         (class Parser_closure): Add parsing_defsym parameter to
9233         constructor; change all callers.  Add parsing_defsym accessor
9234         function.  Add parsing_defsym_ field.
9235
9236 2009-12-28  Ian Lance Taylor  <iant@google.com>
9237
9238         * gold.cc (queue_middle_tasks): Fix formatting.
9239         * object.cc (Relobj::is_section_name_included): Likewise.
9240
9241 2009-12-23  Ian Lance Taylor  <iant@google.com>
9242
9243         * i386.cc (Target_i386::do_calls_non_split): Recognize
9244         -fsplit-stack prologue for a function with a static chain.
9245         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9246         -fsplit-stack prologue when using %r11.
9247
9248 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9249
9250         * options.cc (General_options::parse_version): Make -v continue and do
9251         the link like GNU ld does.
9252
9253 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9254
9255         * Makefile.am (CCFILES): Add timer.cc.
9256         (HFILES): Add timer.h.
9257         * configure.ac: Check for sysconf and times.
9258         * main.cc: include timer.h.
9259         (main): Use Timer instead of get_run_time.
9260         * timer.cc: New.
9261         * timer.h: New.
9262         * workqueue.cc: include timer.h.
9263         (Workqueue::find_and_run_task):
9264         Report user, sys and wall time.
9265         * Makefile.in: Regenerate.
9266         * config.in: Regenerate.
9267         * configure: Regenerate.
9268
9269 2009-12-16  Doug Kwan  <dougkwan@google.com>
9270
9271         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9272         sections.
9273         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9274         relaxed input sections.
9275         * output.cc (Output_section::find_relaxed_input_section): Change
9276         return type to Output_relaxed_input_section pointer.  Adjust code
9277         for new type of relaxed_input_section_map_.
9278         * output.h (Output_section::find_relaxed_input_section): Change
9279         return type to Output_relaxed_input_section pointer.
9280         (Output_section::Output_relaxed_input_section_by_input_section_map):
9281         New type.
9282         (Output_section::relaxed_input_section_map_): Change type to
9283         Output_section::Output_relaxed_input_section_by_input_section_map.
9284         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9285         input section.
9286
9287 2009-12-15  Ian Lance Taylor  <iant@google.com>
9288
9289         * layout.cc (Layout::create_shstrtab): Only write out after input
9290         sections if we are compressing debug sections.
9291
9292 2009-12-15  Ian Lance Taylor  <iant@google.com>
9293
9294         * archive.cc (Archive::add_symbols): Only look up a symbol without
9295         a version if there is, in fact, a version.
9296
9297 2009-12-14  Ian Lance Taylor  <iant@google.com>
9298
9299         Revert -Wshadow changes, all changes from:
9300         2009-12-11  Doug Kwan  <dougkwan@google.com>
9301         2009-12-11  Nick Clifton  <nickc@redhat.com>
9302         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9303
9304 2009-12-11  Doug Kwan  <dougkwan@google.com>
9305
9306         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9307         due to -Wshadow.
9308         * attributes.cc (Object_attribute::size): Ditto.
9309         (Attributes_section_data::size): Ditto.
9310         (Attributes_section_data::Attributes_section_data): Ditto.
9311         (Output_attributes_section_data::do_write): Ditto.
9312         * attributes.h (Object_attribute::set_type): Ditto.
9313         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9314
9315 2009-12-11  Nick Clifton  <nickc@redhat.com>
9316
9317         * archive.cc: Fix shadowed variable warnings.
9318         * arm.cc: Likewise.
9319         * compressed_output.cc: Likewise.
9320         * compressed_output.h: Likewise.
9321         * configure: Likewise.
9322         * dwarf_reader.cc: Likewise.
9323         * dynobj.cc: Likewise.
9324         * dynobj.h: Likewise.
9325         * ehframe.cc: Likewise.
9326         * ehframe.h: Likewise.
9327         * errors.cc: Likewise.
9328         * expression.cc: Likewise.
9329         * fileread.cc: Likewise.
9330         * fileread.h: Likewise.
9331         * freebsd.h: Likewise.
9332         * i386.cc: Likewise.
9333         * icf.cc: Likewise.
9334         * incremental.h: Likewise.
9335         * layout.cc: Likewise.
9336         * layout.h: Likewise.
9337         * mapfile.cc: Likewise.
9338         * merge.cc: Likewise.
9339         * merge.h: Likewise.
9340         * object.cc: Likewise.
9341         * object.h: Likewise.
9342         * options.h: Likewise.
9343         * output.cc: Likewise.
9344         * output.h: Likewise.
9345         * parameters.cc: Likewise.
9346         * plugin.cc: Likewise.
9347         * powerpc.cc: Likewise.
9348         * reduced_debug_output.cc: Likewise.
9349         * reduced_debug_output.h: Likewise.
9350         * reloc.cc: Likewise.
9351         * reloc.h: Likewise.
9352         * resolve.cc: Likewise.
9353         * script-sections.cc: Likewise.
9354         * script.cc: Likewise.
9355         * script.h: Likewise.
9356         * sparc.cc: Likewise.
9357         * symtab.cc: Likewise.
9358         * symtab.h: Likewise.
9359         * target-select.cc: Likewise.
9360         * target-select.h: Likewise.
9361         * token.h: Likewise.
9362         * workqueue.cc: Likewise.
9363         * workqueue.h: Likewise.
9364         * x86_64.cc: Likewise.
9365
9366 2009-12-10  Doug Kwan  <dougkwan@google.com>
9367
9368         * arm.cc (attributes.h): New include.
9369         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9370         (Arm_relobj::~Arm_relobj): Delete object pointed by
9371         attributes_section_data_.
9372         (Arm_relobj::attributes_section_data): New method definition.
9373         (Arm_relobj::attributes_section_data_): New data member declaration.
9374         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9375         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9376         attributes_section_data_.
9377         (Arm_dynobj::attributes_section_data): New method definition.
9378         (Arm_dynobj::attributes_section_data_): New data member declaration.
9379         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9380         initialization value of may_use_blx_ to false.
9381         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9382         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9383         object attributes to compute results instead of hard-coding.
9384         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9385         Target_arm::get_secondary_compatible_arch,
9386         Target_arm::set_secondary_compatible_arch
9387         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9388         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9389         New method declarations.
9390         (Target_arm::get_aeabi_object_attribute): New method definition.
9391         (Target_arm::attributes_section_data_): New data member declaration.
9392         (read_arm_attributes_section): New template definition.
9393         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9394         (Arm_dynobj::do_read_symbols): Ditto.
9395         (Target_arm::do_finalize_sections): Merge attributes sections from
9396         input.  Check for BLX use after attributes section merging.
9397         Fix __exidx_start and __exidx_end visibility.  Create an
9398         .ARM.attributes section if necessary.
9399         (Target_arm::get_secondary_compatible_arch,
9400         Target_arm::set_secondary_compatible_arch,
9401         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9402         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9403         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9404         New method definitions.
9405
9406 2009-12-09  Ian Lance Taylor  <iant@google.com>
9407
9408         * plugin.cc (Plugin::load): Don't cast from void* to a function
9409         pointer.
9410
9411 2009-12-09  Ian Lance Taylor  <iant@google.com>
9412
9413         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9414         information fields.
9415
9416 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9417
9418         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9419         Replace two_file_shared_1.so with two_file_shared_2.so.
9420         * testsuite/Makefile.in: Regenerated.
9421
9422 2009-12-08  Doug Kwan  <dougkwan@google.com>
9423
9424         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9425         (HFILES): Add attributes.h and int_encoding.h.
9426         * Makefile.in: Regenerate.
9427         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9428         function definitions to int_encoding.cc
9429         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9430         prototypes to int_encoding.h
9431         * reduced_debug_output.cc (int_encoding.h): New include.
9432         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9433         function definitions to int_encoding.cc
9434         (insert_into_vector, read_from_pointer): Move template definitions to
9435         int_encoding.h
9436         * attributes.cc: New file.
9437         * attributes.h: New file.
9438         * int_encoding.cc: New file.
9439         * int_encoding.h: New file.
9440
9441 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9442
9443         PR gold/11055
9444         * incremental-dump.cc (dump_incremental_inputs): New.
9445         (main): Use dump_incremental_inputs.
9446
9447 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9448
9449         PR gold/10893
9450         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9451         checking elfcpp::STT_FUNC.
9452         (Target_i386::Relocate::relocate): Likewise.
9453         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9454
9455         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9456         symbols from shared libraries into normal FUNC symbols.
9457
9458         * symtab.h (Symbol): Add is_func and use it.
9459
9460 2009-12-05  Doug Kwan  <dougkwan@google.com>
9461
9462         * arm.cc (Target_arm::arm_info): Initialize new fields
9463         attributes_section and attributes_vendor.
9464         * i386.cc (Target_i386::i386_info): Same.
9465         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9466         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9467         fields attributes_section and attributes_vendor.
9468         * sparc.cc (Target_sparc::sparc_info): Same.
9469         * target.h (Target::attributes_section, Target::attributes_vendor,
9470         Target::is_attributes_section, Target::attribute_arg_type,
9471         Target::attributes_order): New method definitions.
9472         (Target::Target_info::attributes_section,
9473         Target::Target_info::attributes_vendor): New fields.
9474         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9475         virtual method definitions.
9476         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9477         attributes_section and attributes_vendor.
9478         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9479
9480 2009-12-05  Doug Kwan  <dougkwan@google.com>
9481
9482         * arm.cc: Update comments about interworking and stub generation.
9483         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9484         considered as non-PIC.
9485         (Arm_relocate_functions::base_abs): Fix formatting.
9486         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9487         of function to use GOT entry address instead of offset.
9488         (Target_arm::Scan::global): Issue an error if a symbol would need a
9489         PLT does not get one because it is untyped.  Remove code to create
9490         dynamic symbols for relative branches.
9491         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9492         takes unsigned integer instead of boolean.
9493
9494 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9495
9496         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9497         (two_file_test_LDADD): Likewise.
9498         (common_test_1_LDADD): Likewise.
9499         (exception_test_LDADD) Likewise.
9500         (weak_test_LDADD): Likewise.
9501         (many_sections_test_LDADD): Likewise.
9502         (initpri1_LDADD): Likewise.
9503         (script_test_1_LDADD): Likewise.
9504         (script_test_2_LDADD): Likewise.
9505         (justsyms_LDADD): Likewise.
9506         (binary_test_LDADD): Likewise.
9507         (large_LDADD): Likewise.
9508         * testsuite/Makefile.in: Regenerated.
9509
9510 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9511
9512         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9513         (Symbol_table::override_with_special): Likewise.
9514         (Symbol_table::add_from_object): Likewise.
9515
9516 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9517
9518         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9519         Don't set the data_offset twice.
9520
9521 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9522
9523         * testsuite/Makefile.in: Regenerate.
9524
9525 2009-12-03  Doug Kwan  <dougkwan@google.com>
9526
9527         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9528         (Target_arm::do_finalize_sections): Add parameter for symbol table
9529         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9530         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9531         parameter for symbol table pointer.
9532         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9533         an additional parameter for a pointer to symbol table.
9534         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9535         parameter for a symbol table pointer.
9536         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9537         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9538         Ditto.
9539         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9540         parameter for a symbol table pointer.
9541
9542 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9543
9544         * incremental.cc (Incremental_inputs_header)
9545         (Incremental_inputs_header_write, Incremental_inputs_entry)
9546         (Incremental_inputs_entry_write): Move ...
9547         * incremental.h (Incremental_inputs_header)
9548         (Incremental_inputs_header_write, Incremental_inputs_entry)
9549         (Incremental_inputs_entry_write): here.
9550
9551 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9552
9553         * incremental.cc (make_sized_incremental_binary): Set the target.
9554         Error if it is incompatible.
9555         * output.h (Output_file): Add filename method.
9556
9557 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9558
9559         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9560         from the get_* methods.
9561
9562 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9563
9564         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9565         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9566         Write 0 for the data_offset of scripts.
9567
9568 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9569
9570         * testsuite/Makefile.am: Add the incremental_test.sh test.
9571         * testsuite/incremental_test.sh: New.
9572         * testsuite/incremental_test_1.c: New.
9573         * testsuite/incremental_test_2.c: New.
9574
9575 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9576
9577         * incremental-dump.cc (main): Fix typos.
9578
9579 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9580
9581         PR gold/11025
9582         * incremental-dump.cc (main): Use llu to print 64 bit values.
9583
9584 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9585             H.J. Lu  <hongjiu.lu@intel.com>
9586
9587         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9588         $(LIBDL).
9589         (incremental_dump_LDADD): Likewise.
9590         * Makefile.in: Regenerated.
9591
9592 2009-11-25  Doug Kwan  <dougkwan@google.com>
9593
9594         Revert:
9595
9596         2009-11-25  Doug Kwan  <dougkwan@google.com>
9597
9598                 * arm.cc (Target_arm::Target_arm): Move method definition
9599                 outside of class definition.  Add code to handle
9600                 --target1-rel, --target1-abs and --target2= options.
9601                 (Target_arm::get_reloc_reloc_type): Change method to be
9602                 non-static and const.
9603                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9604                 New data member declaration.
9605                 (Target_arm::Scan::local, Target_arm::Scan::global,
9606                 Target_arm::Relocate::relocate,
9607                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9608                 Adjust call to Target_arm::get_real_reloc_type.
9609                 (Target_arm::get_real_reloc_type): Use command line options
9610                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9611                 * options.h (--target1-rel, --target1-abs, --target2): New
9612                 ARM-only options.
9613
9614 2009-11-25  Doug Kwan  <dougkwan@google.com>
9615
9616         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9617         class definition.  Add code to handle --target1-rel, --target1-abs
9618         and --target2= options.
9619         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9620         and const.
9621         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9622         member declaration.
9623         (Target_arm::Scan::local, Target_arm::Scan::global,
9624         Target_arm::Relocate::relocate,
9625         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9626         call to Target_arm::get_real_reloc_type.
9627         (Target_arm::get_real_reloc_type): Use command line options to
9628         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9629         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9630         options.
9631
9632 2009-11-25  Doug Kwan  <dougkwan@google.com>
9633
9634         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9635         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9636         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9637         formatting.
9638         (Arm_relocate_functions::thm_call): Replace body with a call to
9639         Arm_relocate_functions::thumb_branch_common.
9640         (Arm_relocate_functions::thm_jump24,
9641         Arm_relocate_functions::thm_xpc22): New method definitions.
9642         (Arm_relocate_functions::thumb_branch_common): New method definition.
9643         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9644         operator.
9645         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9646         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9647
9648 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9649
9650         * Makefile.am: Build incremental-dump
9651         * Makefile.in: Regenerate.
9652         * incremental-dump.cc: New.
9653         * incremental.cc (Incremental_inputs_header_data,
9654         Incremental_inputs_entry_data): Move to incremental.h
9655         * incremental.h: (Incremental_inputs_header_data,
9656         Incremental_inputs_entry_data): Move from incremental.cc
9657
9658 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9659
9660         * incremental.cc (Incremental_inputs_header,
9661         Incremental_inputs_header_write, Incremental_inputs_entry,
9662         Incremental_inputs_entry_write): Add a typedef with the data type.
9663
9664 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9665
9666         * incremental.cc (Incremental_inputs_header,
9667         Incremental_inputs_header_write, Incremental_inputs_entry,
9668         Incremental_inputs_entry_write): Update comment about which
9669         type has the filed descriptions.
9670
9671 2009-11-15  Doug Kwan  <dougkwan@google.com>
9672
9673         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9674         (Arm_relocate_functions::arm_branch_common): Change method defintion
9675         in class definition to a method declaration and update list of formal
9676         parameters.
9677         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9678         Arm_relocation_functions::jump24): Adjust call to
9679         Arm_relocate_functions::arm_branch_common.  Update list of formal
9680         parameters.
9681         (Arm_relocate_functions::xpc25): New method definition.
9682         (Arm_relocate_functions::arm_branch_common): Move method defintion
9683         out from class definition.  Use stubs for mode-switching and extending
9684         branch ranges.
9685         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9686         specially.  Change code to enable use of stubs in ARM branches.
9687
9688 2009-11-10  Doug Kwan  <dougkwan@google.com>
9689
9690         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9691         in method declaration.
9692         (Target_arm::relocate_stub): New method declaration.
9693         (Target_arm::default_target): Change to return a pointer instead of
9694         a const reference.
9695         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9696         Target_arm::default_target.
9697         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9698         method definition.
9699         (Target_arm::relocate_section): Adjust view.
9700         (Target_arm::relocate_stub): New method definition.
9701
9702 2009-11-10  Doug Kwan  <dougkwan@google.com>
9703
9704         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9705         a format warning.
9706         * incremental.cc (open_incremental_binary): Initialized local
9707         variables to avoid warnings.
9708         * object.cc (make_elf_object): Ditto.
9709         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9710         a format warning.
9711
9712 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9713
9714         PR gold/10930
9715         * testsuite/plugin_test.c: Include "config.h".
9716
9717 2009-11-09  Doug Kwan  <dougkwan@google.com>
9718
9719         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9720         (arm_symbol_value): Remove.
9721         (Arm_relocate_functions::arm_branch_common,
9722         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9723         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9724         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9725         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9726         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9727         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9728         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9729         Arm_relocate_functions::thm_mobw_abs_nc,
9730         Arm_relocate_functions::thm_mov_abs,
9731         Arm_relocate_functions::movw_prel_nc,
9732         Arm_relocate_functions::thm_movt_abs,
9733         Arm_relocate_functions::movt_prel,
9734         Arm_relocate_functions::thm_movw_prel_nc,
9735         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9736         (Target_arm::Relocate::relocate): Only decompose address into two
9737         parts if relocation type uses the thumb-bit and pass the actual
9738         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9739         calls to methods in Arm_relocate_functions for this change.
9740
9741 2009-11-08  Ian Lance Taylor  <iant@google.com>
9742
9743         PR 10925
9744         * reloc.cc: Instantiate
9745         Sized_relobj::initialize_input_to_output_maps and
9746         Sized_relobj:free_input_to_output_maps.
9747
9748 2009-11-06  Ian Lance Taylor  <iant@google.com>
9749
9750         PR 10876
9751         * defstd.cc (in_segment): Set only_if_ref true for "end".
9752
9753 2009-11-06  Doug Kwan  <dougkwan@google.com>
9754
9755         * arm.cc (class Reloc_stub): Correct a comment.
9756         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9757         (Target_arm::scan_section_for_stubs): New method declaration.
9758         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9759         Change methods from private to protected.
9760         (Target_arm::do_may_relax): New method definition.
9761         (Target_arm::do_relax, Target_arm::group_sections,
9762         Target_arm::scan_reloc_for_stub,
9763         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9764         (Target_arm::arm_input_section_map_): New data member declaration.
9765         (Target_arm::scan_reloc_for_stub,
9766         Target_arm::scan_reloc_section_for_stubs,
9767         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9768         Target_arm::do_relax): New method definitions.
9769
9770 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9771
9772         * configure.ac: Check for (struct stat)::st_mtim
9773         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9774         * config.in: Regenerate.
9775         * configure: Regenerate.
9776
9777 2009-11-05  Ian Lance Taylor  <iant@google.com>
9778
9779         PR 10910
9780         * output.cc (Output_segment::add_output_section): Add missing
9781         return statement.
9782
9783 2009-11-04  Ian Lance Taylor  <iant@google.com>
9784
9785         PR 10880
9786         * object.h (class Object): Add is_needed and set_is_needed
9787         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9788         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9789         defined in a dynamic object and referenced by a regular object,
9790         set is_needed for the dynamic object.
9791         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9792         if the file is marked with as_needed and it is not needed.
9793
9794 2009-11-04  Ian Lance Taylor  <iant@google.com>
9795
9796         PR 10887
9797         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9798         tags if data is discarded by linker script.
9799         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9800         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9801         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9802         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9803
9804 2009-11-04  Ian Lance Taylor  <iant@google.com>
9805
9806         * layout.cc (Layout::get_output_section): Add is_interp and
9807         is_dynamic_linker_section parameters.  Change all callers.
9808         (Layout::choose_output_section): Likewise.
9809         (Layout::make_output_section): Likewise.
9810         (Layout::add_output_section_data): Add is_dynamic_linker_section
9811         parameter.  Change all callers.
9812         * layout.h (class Layout): Update declarations.
9813         * output.h (class Output_section): Add is_interp, set_is_interp,
9814         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9815         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9816         generate_code_fills_at_write_ to a bitfield.
9817         * output.cc (Output_section::Output_sections): Initialize new
9818         fields.
9819         (Output_segment::add_output_section): Add do_sort parameter.
9820         Change all callers.
9821
9822 2009-11-03  Ian Lance Taylor  <iant@google.com>
9823
9824         PR 10860
9825         * options.h (class General_options): Add --warn-common.
9826         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9827         merging two common symbols.
9828         (Symbol_table::should_override): Handle --warn-common when merging
9829         a common symbol with a defined symbol.  Use report_resolve_problem
9830         for multiple definitions.
9831         (Symbol_table::report_resolve_problem): New function.
9832         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9833
9834 2009-11-03  Doug Kwan  <dougkwan@google.com>
9835
9836         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9837         stub_factory_.
9838         (Target_arm::stub_factory): New method definition.
9839         (Target_arm::new_arm_input_section,
9840         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9841         Target_arm::reloc_uses_thumb_bit): New method declarations.
9842         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9843         New type definitions.
9844         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9845         member declarations.
9846         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9847         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9848         New method definitions.
9849
9850 2009-11-03  Ian Lance Taylor  <iant@google.com>
9851
9852         * options.h (class General_options): Add --warn_constructors.
9853
9854 2009-11-03  Ian Lance Taylor  <iant@google.com>
9855
9856         PR 10893
9857         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9858         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9859
9860 2009-11-03  Ian Lance Taylor  <iant@google.com>
9861
9862         PR 10895
9863         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9864         --msgid-bugs-address.
9865         (install-pdf): New target.
9866         (install-data_yes): Look up one directory to find mkinstalldirs.
9867
9868 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9869
9870         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9871         tree.
9872
9873 2009-10-30  Doug Kwan  <dougkwan@google.com>
9874
9875         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9876
9877 2009-10-30  Doug Kwan  <dougkwan@google.com>
9878
9879         * arm.cc (Stub_addend_reader): New struct template definition
9880         and partial specializations.
9881         (Stub_addend_reader::operator()): New method definition for a
9882         partially specialized template.
9883
9884 2009-10-30  Doug Kwan  <dougkwan@google.com>
9885
9886         * arm.cc (Arm_relobj::processor_specific_flags): New method
9887         definition.
9888         (Arm_relobj::do_read_symbols): New method declaration.
9889         (Arm_relobj::processor_specific_flags_): New data member declaration.
9890         (Arm_dynobj): New class definition.
9891         (Target_arm::do_finalize_sections): Add input_objects parameter.
9892         (Target_arm::do_adjust_elf_header): New method declaration.
9893         (Target_arm::are_eabi_versions_compatible,
9894         (Target_arm::merge_processor_specific_flags): New method declaration.
9895         (Target_arm::do_make_elf_object): New overloaded method definitions
9896         and declaration.
9897         (Arm_relobj::do_read_symbols): New method definition.
9898         (Arm_dynobj::do_read_symbols): Ditto.
9899         (Target_arm::do_finalize_sections): Add input_objects parameters.
9900         Merge processor-specific flags from all input objects.
9901         (Target_arm::are_eabi_versions_compatible,
9902         Target_arm::merge_processor_specific_flags,
9903         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9904         New method definitions.
9905         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9906         Input_objects pointer type parameter.
9907         * layout.cc (Layout::finalize): Pass input objects to target's.
9908         finalize_sections function.
9909         * output.cc (Output_file_header::do_sized_write): Set ELF file
9910         header's processor-specific flags.
9911         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9912         Input_objects pointer type parameter.
9913         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9914         * target.h (Input_objects): New forward class declaration.
9915         (Target::processor_specific_flags,
9916         Target::are_processor_specific_flags_sect): New method definitions.
9917         (Target::finalize_sections): Add input_objects parameter.
9918         (Target::Target): Initialize processor_specific_flags_ and
9919         are_processor_specific_flags_set_.
9920         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9921         parameter.
9922         (Target::set_processor_specific_flags): New method definition.
9923         (Target::processor_specific_flags_,
9924         Target::are_processor_specific_flags_set_): New data member
9925         declarations.
9926         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9927         Input_objects pointer type parameter.
9928
9929 2009-10-30  Doug Kwan  <dougkwan@google.com>
9930
9931         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9932
9933 2009-10-28  Ian Lance Taylor  <iant@google.com>
9934
9935         * object.h (class Relobj): Drop options parameter from
9936         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9937         do_scan_relocs, do_relocate.  Change all callers.
9938         (class Sized_relobj): Drop options parameters from
9939         do_gc_process_relocs, do_scan_relocs, do_relocate,
9940         do_relocate_sections, relocate_sections, emit_relocs_scan,
9941         emit_relocs_scan_reltype.  Change all callers.
9942         (struct Relocate_info): Remove options field and all references to
9943         it.
9944         * reloc.h (class Read_relocs): Remove options constructor
9945         parameter and options_ field.  Change all callers.
9946         (class Gc_process_relocs, class Scan_relocs): Likewise.
9947         (class Relocate_task): Likewise.
9948         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9949         all callers.
9950         (scan_relocatable_relocs): Likewise.
9951         * target.h (class Sized_target): Remove options parameter from
9952         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9953         all callers.
9954         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9955         callers.
9956         * arm.cc: Update functions to remove options parameters.
9957         * i386.cc: Likewise.
9958         * powerpc.cc: Likewise.
9959         * sparc.cc: Likewise.
9960         * x86_64.cc: Likewise.
9961         * testsuite/testfile.cc: Likewise.
9962
9963 2009-10-28  Doug Kwan  <dougkwan@google.com>
9964
9965         * arm.cc (Arm_relobj): New class definition.
9966         (Arm_relobj::scan_sections_for_stubs,
9967         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9968         New method definitions.
9969
9970 2009-10-28  Cary Coutant  <ccoutant@google.com>
9971
9972         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9973         (Plugin::cleanup_done_): New member.
9974         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9975         (Plugin_manager::cleanup_done_): Remove.
9976         (Plugin_manager::add_input_file): Edit error message.
9977         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9978         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9979
9980 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9981
9982         * fileread.cc: (File_read::View::~View): Use the new
9983         data_ownership_ filed.
9984         (File_read::~File_read): Dispose the new whole_file_view_.
9985         (File_read::open): Mmap the whole file if needed.
9986         (File_read::open): Use whole_file_view_ instead of contents_.
9987         (File_read::find_view): Use whole_file_view_ if applicable.
9988         (File_read::do_read): Use whole_file_view_ instead of contents_.
9989         (File_read::make_view): Use whole_file_view_ instead of contents_,
9990         update File_read::View::View call.
9991         (File_read::find_or_make_view): Update File_read::View::View
9992         call.
9993         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9994         remove contents_
9995         (File_read::View::Data_ownership): New enum.
9996         (File_read::View::View): Replace bool mapped_ with Data_ownership
9997         argument.
9998         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9999         (File_read::View::data_ownership_): New field.
10000         (File_read::contents_): Remove (replaced by whole_file_view_).
10001         (File_read::whole_file_view_): New field.
10002         * options.h (class General_options): Add --keep-files-mapped.
10003
10004 2009-10-27  Cary Coutant  <ccoutant@google.com>
10005
10006         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10007         * testsuite/Makefile.am (plugin_test_5): New test case.
10008         * testsuite/Makefile.in: Regenerate.
10009
10010 2009-10-25  Doug Kwan  <dougkwan@google.com>
10011
10012         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10013         from private to protected to allow access by child class.
10014         (Sized_relobj::do_relocate_sections): New method declaration.
10015         (Sized_relobj::relocate_sections): Virtualize.
10016         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10017         Sized_relobj::relocate_sections.  Instantiate template explicitly
10018         for different target sizes and endianity.
10019
10020 2009-10-24  Doug Kwan  <dougkwan@google.com>
10021
10022         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10023         (Arm_input_section::as_arm_input_section): New method.
10024         (Arm_output_section): New class definition.
10025         (Arm_output_section::create_stub_group,
10026         Arm_output_section::group_sections): New method definitions.
10027
10028 2009-10-22  Doug Kwan  <dougkwan@google.com>
10029
10030         * arm.cc (Arm_input_section): New class definition.
10031         (Arm_input_section::init, Arm_input_section:do_write,
10032         Arm_input_section::set_final_data_size,
10033         Arm_input_section::do_reset_address_and_file_offset): New method
10034         definitions.
10035
10036 2009-10-21  Doug Kwan  <dougkwan@google.com>
10037
10038         * arm.cc (Stub_table, Arm_input_section): New forward class
10039         declarations.
10040         (Stub_table): New class defintion.
10041         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10042         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10043         New method definition.
10044
10045 2009-10-21  Doug Kwan  <dougkwan@google.com>
10046
10047         * arm.cc: Update copyright comments.
10048         (Target_arm): New forward class template declaration.
10049         (Arm_address): New type.
10050         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10051         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10052         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10053         constants.
10054         (Insn_template): Same.
10055         (DEF_STUBS): New macro.
10056         (Stub_type): New enum type.
10057         (Stub_template): New class definition.
10058         (Stub): Same.
10059         (Reloc_stub): Same.
10060         (Stub_factory): Same.
10061         (Target_arm::Target_arm): Initialize may_use_blx_ and
10062         should_force_pic_veneer_.
10063         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10064         Target_arm::should_force_pic_veneer,
10065         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10066         Target_arm::using_thumb_only, Target_arm:;default_target): New
10067         method defintions.
10068         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10069         New data member declarations.
10070         (Insn_template::size, Insn_template::alignment): New method defintions.
10071         (Stub_template::Stub_template): New method definition.
10072         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10073         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10074         (Stub_factory::Stub_factory): New method definition.
10075         * gold.h (string_hash): New template.
10076         * output.h (Input_section_specifier::hash_value): Use
10077         gold::string_hash.
10078         (Input_section_specifier::string_hash): Remove.
10079         * stringpool.cc (Stringpool_template::string_hash): Use
10080         gold::string_hash.
10081
10082 2009-10-20  Doug Kwan  <dougkwan@google.com>
10083
10084         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10085         symbols of relaxed input sections.
10086         * output.h (Output_section::find_relaxed_input_section): Make
10087         method public.
10088
10089 2009-10-16  Doug Kwan  <dougkwan@google.com>
10090
10091         * dynobj.cc (Versions::Versions): Initialize version_script_.
10092         Only insert base version symbol definition for a shared object
10093         if version script defines any version versions.
10094         (Versions::define_base_version): New method definition.
10095         (Versions::add_def): Check that base version is not needed.
10096         (Versions::add_need): Define base version lazily.
10097         * dynobj.h (Versions::define_base_version): New method declaration.
10098         (Versions::needs_base_version_): New data member declaration.
10099         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10100         (check_DATA): Add no_version_test.stdout.
10101         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10102         New make rules.
10103         * testsuite/Makefile.in: Regenerate.
10104         * testsuite/no_version_test.c: New file.
10105         * testsuite/no_version_test.sh: Ditto.
10106
10107 2009-10-16  Doug Kwan  <dougkwan@google.com>
10108
10109         * expression.cc (class Segment_start_expression): New class definition.
10110         (Segment_start_expression::value): New method definition.
10111         (script_exp_function_segment_start): Return a new
10112         Segment_start_expression.
10113         * gold/script-c.h (script_saw_segment_start_expression): New function
10114         prototype.
10115         * script-sections.cc (Script_sections::Script_sections): Initialize
10116         SAW_SEGMENT_START_EXPRESSION_ to false.
10117         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10118         and -Tbbs options to specify section addresses if given in
10119         command line and no SEGMENT_START expression is seen in a script.
10120         * script-sections.h (Script_sections::saw_segment_start_expression,
10121         Script_sections::set_saw_segment_start_expression): New method
10122         definition.
10123         (Script_sections::saw_segment_start_expression_): New data member
10124         declaration.
10125         * script.cc (script_saw_segment_start_expression): New function.
10126         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10127         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10128         script_test_7.sh and script_test_8.sh.
10129         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10130         script_test_8.stdout.
10131         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10132         (script_test_6, script_test_6.stdout, script_test_7,
10133         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10134         * Makefile.in: Regenerate.
10135         * testsuite/script_test_6.sh: New file.
10136         * testsuite/script_test_6.t: Same.
10137         * testsuite/script_test_7.sh: Same.
10138         * testsuite/script_test_7.t: Same.
10139         * testsuite/script_test_8.sh: Same.
10140
10141 2009-10-16  Doug Kwan  <dougkwan@google.com>
10142
10143         * output.cc (Output_segment::set_section_list_address): Cast
10144         expressions to unsigned long long type to avoid format warnings.
10145
10146 2009-10-15  Ian Lance Taylor  <iant@google.com>
10147
10148         * script.cc (Script_options::add_symbol_assignment): Always add a
10149         dot assignment to script_sections_.
10150         * script-sections.cc (Script_sections::add_dot_assignment):
10151         Initialize if necessary.
10152
10153         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10154         program headers with no load segment if there is a linker script.
10155
10156         * layout.cc (Layout::set_segment_offsets): Align the file offset
10157         to the segment aligment for -N or -n with no load segment.
10158         * output.cc (Output_segment::add_output_section): Don't crash if
10159         the first section is a TLS section.
10160         (Output_segment::set_section_list_addresses): Print an error
10161         message if the address moves backward in a linker script.
10162         * script-sections.cc
10163         (Output_section_element_input::set_section_addresses): Don't
10164         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10165         (Orphan_output_section::set_section_addresses): Likewise.
10166
10167 2009-10-15  Doug Kwan  <dougkwan@google.com>
10168
10169         * layout.cc (Layout::finish_dynamic_section): Generate tags
10170         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10171         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10172         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10173
10174 2009-10-14  Ian Lance Taylor  <iant@google.com>
10175
10176         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10177         fields.
10178         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10179         data_shdr fields of relinfo.
10180         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10181         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10182         R_386_TLS_LDO_32, adjust based on section flags.
10183         (Target_i386::Relocate::fix_up_ldo): Remove.
10184
10185 2009-10-13  Ian Lance Taylor  <iant@google.com>
10186
10187         Add support for -pie.
10188         * options.h (class General_options): Add -pie and
10189         --pic-executable.
10190         (General_options::output_is_position_independent): Test -pie.
10191         (General_options::output_is_executable): Return true if not shared
10192         and not relocatable.
10193         (General_options::output_is_pie): Remove.
10194         * options.cc (General_options::finalize): Reject incompatible uses
10195         of -pie.
10196         * gold.cc (queue_middle_tasks): A -pie link is not static.
10197         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10198         * symtab.cc (Symbol::final_value_is_known): Return false if
10199         output_is_position_independent.
10200         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10201         output_is_position_independent.
10202         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10203         output_is_position_independent.
10204         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10205         output_is_position_independent.
10206         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10207         two_file_pie_test.
10208         (basic_pie_test.o, basic_pie_test): New targets.
10209         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10210         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10211         (two_file_pie_test): New target.
10212         * testsuite/Makefile.in: Rebuild.
10213         * README: Remove note saying that -pie is not supported.
10214
10215 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10216
10217         * options.h (class General_options): Add -init and -fini.
10218         * layout.cc (Layout::finish_dynamic_section): Emit
10219         given init and fini functions.
10220
10221 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10222
10223         * gc.h (gc_process_relocs): Check if icf is enabled using new
10224         function.
10225         * gold.cc (queue_initial_tasks): Likewise.
10226         (queue_middle_tasks): Likewise.
10227         * object.cc (do_layout): Likewise.
10228         * symtab.cc (is_section_folded): Likewise.
10229         * main.cc (main): Likewise.
10230         * reloc.cc (Read_relocs::run): Likewise.
10231         (Sized_relobj::do_scan_relocs): Likewise.
10232         * icf.cc (is_function_ctor_or_dtor): New function.
10233         (Icf::find_identical_sections): Check if function is ctor or dtor when
10234         safe icf is chosen.
10235         * options.h (General_options::icf): Change option to be an enum.
10236         (Icf_status): New enum.
10237         (icf_enabled): New method.
10238         (icf_safe_folding): New method.
10239         (set_icf_status): New method.
10240         (icf_status_): New variable.
10241         * (options.cc) (General_options::finalize): Set icf_status_.
10242         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10243         icf_test and icf_keep_unique_test to use the --icf enum flag.
10244         * testsuite/icf_safe_test.sh: New file.
10245         * testsuite/icf_safe_test.cc: New file.
10246
10247 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10248
10249         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10250         includes to gc.h and icf.h.
10251         * arm.cc: Include gc.h.
10252         * gold.cc: Likewise.
10253         * i386.cc: Likewise.
10254         * powerpc.cc: Likewise.
10255         * sparc.cc: Likewise.
10256         * x86_64.cc: Likewise.
10257         * gc.h: Include icf.h.
10258
10259 2009-10-11  Ian Lance Taylor  <iant@google.com>
10260
10261         * plugin.cc: Include "gold.h" before other header files.
10262
10263 2009-10-10  Chris Demetriou  <cgd@google.com>
10264
10265         * options.h (Input_file_argument::Input_file_type): New enum.
10266         (Input_file_argument::is_lib_): Replace with...
10267         (Input_file_argument::type_): New member.
10268         (Input_file_argument::Input_file_argument): Take Input_file_type
10269         'type' rather than boolean 'is_lib' as second argument.
10270         (Input_file_argument::is_lib): Use type_.
10271         (Input_file_argument::is_searched_file): New function.
10272         (Input_file_argument::may_need_search): Handle is_searched_file.
10273         * options.cc (General_options::parse_library): Support -l:filename.
10274         (General_options::parse_just_symbols): Update for Input_file_argument
10275         changes.
10276         (Command_line::process): Likewise.
10277         * archive.cc (Archive::get_file_and_offset): Likewise.
10278         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10279         * script.cc (read_script_file, script_add_file): Likewise.
10280         * fileread.cc (Input_file::Input_file): Likewise.
10281         (Input_file::will_search_for): Handle is_searched_file.
10282         (Input_file::open): Likewise.
10283         * readsyms.cc (Read_symbols::get_name): Likewise.
10284         * testsuite/Makefile.am (searched_file_test): New test.
10285         * testsuite/Makefile.in: Regenerate.
10286         * testsuite/searched_file_test.cc: New file.
10287         * testsuite/searched_file_test_lib.cc: New file.
10288
10289 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10290             Ian Lance Taylor  <iant@google.com>
10291
10292         * descriptor.cc: Include <cstdio> and "binary-io.h".
10293         (Descriptors::open): Open the files in binary mode always.
10294         * script.cc (Lex::get_token): Treat \r as whitespace.
10295
10296 2009-10-09  Ian Lance Taylor  <iant@google.com>
10297
10298         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10299
10300 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10301             Ian Lance Taylor  <iant@google.com>
10302
10303         * configure.ac: Check for readv function also.
10304         * fileread.cc (readv): Define if not HAVE_READV.
10305         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10306         does not exist.
10307         * config.in: Regenerate.
10308         * configure: Regenerate.
10309
10310 2009-10-09  Doug Kwan  <dougkwan@google.com>
10311
10312         * layout.cc (Layout::make_output_section): Call target hook to make
10313         ordinary output section.
10314         (Layout::finalize): Adjust parameter list of call the
10315         Target::may_relax().
10316         * layout.h (class Layout::section_list): New method.
10317         * merge.h (Output_merge_base::entsize): Change visibility to public.
10318         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10319         New methods.
10320         (Output_merge_string::do_is_string): New method.
10321         * object.cc (Sized_relobj::do_setup): renamed from
10322         Sized_relobj::set_up.
10323         * object.h (Sized_relobj::adjust_shndx,
10324         Sized_relobj::initializ_input_to_output_maps,
10325         Sized_relobj::free_input_to_output_maps): Change visibilities to
10326         protected.
10327         (Sized_relobj::setup): Virtualize.
10328         (Sized_relobj::do_setup): New method declaration.
10329         (Sized_relobj::invalidate_section_offset,
10330         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10331         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10332         * options.cc (parse_int): New function.
10333         * options.h (parse_int): New declaration.
10334         (DEFINE_int): New macro.
10335         (stub_group_size): New option.
10336         * output.cc (Output_section::Output_section): Initialize memebers
10337         merge_section_map_, merge_section_by_properties_map_,
10338         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10339         (Output_section::add_input_section): Handled deferred code-fill
10340         generation and remove an old comment.
10341         (Output_section::add_relaxed_input_section): New method definition.
10342         (Output_section::add_merge_input_section): Use merge section by
10343         properties map to speed to search.  Update merge section maps
10344         as appropriate.
10345         (Output_section::build_relaxation_map): New method definition.
10346         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10347         Same.
10348         (Output_section::relax_input_section): Renamed to
10349         Output_section::convert_input_sections_to_relaxed_sections and change
10350         interface to take a vector of pointers to relaxed sections.
10351         (Output_section::find_merge_section,
10352         Output_section::find_relaxed_input_section): New method definitions.
10353         (Output_section::is_input_address_mapped,
10354         Output_section::output_offset, Output_section::output_address):
10355         Use output section data maps to speed up searching.
10356         (Output_section::find_starting_output_address): Add comments.
10357         (Output_section::do_write,
10358         Output_section::write_to_postprocessing_buffer): Do code-fill
10359         generation as appropriate.
10360         (Output_section::get_input_sections): Invalidate relaxed input section
10361         map.
10362         (Output_section::restore_states): Adjust type of checkpoint .
10363         Invalidate relaxed input section map.
10364         * output.h (Output_merge_base): New class declaration.
10365         (Input_section_specifier): New class defintion.
10366         (class Output_relaxed_input_section) Change base class to
10367         Output_section_data_build.
10368         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10369         base class initializer.
10370         (Output_section::add_relaxed_input_section): New method declaration.
10371         (Output_section::Input_section): Change visibility to protected.
10372         (Output_section::Input_section::relobj,
10373         Output_section::Input_section::shndx): Handle relaxed input sections.
10374         Output_section::input_sections) Change visibility to protected.  Also
10375         define overload to return a non-const pointer.
10376         (Output_section::Merge_section_properties): New class defintion.
10377         (Output_section::Merge_section_by_properties_map,
10378         Output_section::Output_section_data_by_input_section_map,
10379         Output_section::Relaxation_map): New types.
10380         (Output_section::relax_input_section): Rename method to
10381         Output_section::convert_input_sections_to_relaxed_sections and change
10382         interface to take a vector of relaxed section pointers.
10383         (Output_section::find_merge_section,
10384         Output_section::find_relaxed_input_section,
10385         Output_section::build_relaxation_map,
10386         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10387         New method declarations.
10388         (Output_section::merge_section_map_
10389         Output_section::merge_section_by_properties_map_,
10390         Output_section::relaxed_input_section_map_,
10391         Output_section::is_relaxed_input_section_map_valid_,
10392         Output_section::generate_code_fills_at_write_): New data members.
10393         * script-sections.cc
10394         (Output_section_element_input::set_section_addresses): Call
10395         current_data_size and addralign methods of relaxed input sections.
10396         (Orphan_output_section::set_section_addresses): Call current_data_size
10397         and addralign methods of relaxed input sections.
10398         * symtab.cc (Symbol_table::compute_final_value): Extract template
10399         from the body of Symbol_table::sized_finalize_symbol.
10400         (Symbol_table::sized_finalized_symbol): Call
10401         Symbol_table::compute_final_value.
10402         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10403         (Symbol_table::compute_final_value): New templated method declaration.
10404         * target.cc (Target::do_make_output_section): New method defintion.
10405         * target.h (Target::make_output_section): New method declaration.
10406         (Target::relax): Add more parameters for input objects, symbol table
10407         and layout.  Adjust call to do_relax.
10408         (Target::do_make_output_section): New method declaration.
10409         (Target::do_relax): Add parameters for input objects, symbol table
10410         and layout.
10411
10412 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10413
10414         * pread.c: Include stdio.h.
10415
10416 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10417
10418         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10419         defined.
10420
10421 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10422
10423         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10424         Change read_shndx type to unsigned int.
10425         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10426         int.
10427         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10428         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10429         Change read_shndx type to unsigned int.
10430         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10431         int.
10432         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10433         * layout.cc (Layout::create_symtab_sections): Cast the result of
10434         local_symcount * symsize to off_t in the gold_assert.
10435
10436 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10437
10438         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10439         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10440         R_ARM_BASE_ABS.
10441         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10442         (Arm_relocate_functions::thm_abs5): New function.
10443         (Arm_relocate_functions::abs12): New function.
10444         (Arm_relocate_functions::abs16): New function.
10445         (Arm_relocate_functions::base_abs): New function.
10446         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10447         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10448         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10449         R_ARM_BASE_ABS.
10450         (Scan::global): Likewise.
10451         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10452         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10453         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10454         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10455         R_ARM_BASE_ABS.
10456
10457 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10458
10459         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10460         (Arm_relocate_functions::movt_prel): New function.
10461         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10462         (Arm_relocate_functions::thm_movt_prel): New function.
10463         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10464         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10465         (Scan::global, Relocate::relocate): Likewise.
10466         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10467
10468 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10469
10470         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10471         Incremental_checker.
10472         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10473         unsigned int.
10474         (class Incremental_inputs_header): New class.
10475         (Incremental_inputs_header_writer): Edit comment.
10476         (Incremental_inputs_entry): New class.
10477         (Incremental_inputs_entry_writer): Edit comment.
10478         (Sized_incremental_binary::do_find_incremental_inputs_section):
10479         Add *strtab_shndx parameter, fill it.
10480         (Sized_incremental_binary::do_check_inputs): New method.
10481         (Incremental_checker::can_incrementally_link_output_file): Use
10482         Sized_incremental_binary::check_inputs.
10483         (Incremental_inputs::report_command_line): Save command line in
10484         command_line_.
10485         * incremental.h:
10486         (Incremental_binary::find_incremental_inputs_section): New
10487         method.
10488         (Incremental_binary::do_find_incremental_inputs_section): Add
10489         strtab_shndx parameter.
10490         (Incremental_binary::do_check_inputs): New pure virtual method.
10491         (Sized_incremental_binary::do_check_inputs): Declare.
10492         (Incremental_checker::Incremental_checker): Add incremental_inputs
10493         parameter, use it to initialize incremental_inputs_.
10494         (Incremental_checker::incremental_inputs_): New field.
10495         (Incremental_checker::command_line): New method.
10496         (Incremental_checker::inputs): New method.
10497         (Incremental_checker::command_line_): New field.
10498
10499 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10500
10501         * incremental.cc: Include <cstdarg> and "target-select.h".
10502         (vexplain_no_incremental): New function.
10503         (explain_no_incremental): New function.
10504         (Incremental_binary::error): New method.
10505         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10506         method.
10507         (make_sized_incremental_binary): New function.
10508         (open_incremental_binary): New function.
10509         (can_incrementally_link_file): Add checks if output is ELF and has
10510         inputs section.
10511         * incremental.h: Include "elfcpp_file.h" and "output.h".
10512         (Incremental_binary): New class.
10513         (Sized_incremental_binary): New class.
10514         (open_incremental_binary): Declare.
10515         * object.cc (is_elf_object): Use
10516         elfcpp::Elf_recognizer::is_elf_file.
10517         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10518         * output.h (Output_file::filesize): New method.
10519
10520 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10521
10522         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10523         New function.
10524         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10525         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10526         function.
10527         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10528         function.
10529         (Arm_relocate_functions::movw_abs_nc): New function.
10530         (Arm_relocate_functions::movt_abs): New function.
10531         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10532         (Arm_relocate_functions::thm_movt_abs): New function.
10533         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10534         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10535         (Scan::global): Likewise.
10536         (Relocate::relocate): Likewise.
10537         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10538
10539 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10540
10541         * arm.cc (Arm_relocate_functions::got_prel) New function.
10542         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10543         (Relocate::relocate): Likewise.
10544         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10545
10546 2009-10-06  Ian Lance Taylor  <iant@google.com>
10547
10548         * options.h (class General_options): Define
10549         split_stack_adjust_size parameter.
10550         * object.h (class Object): Add uses_split_stack_ and
10551         has_no_split_stack_ fields.  Add uses_split_stack and
10552         has_no_split_stack accessor functions.  Declare
10553         handle_split_stack_section.
10554         (class Reloc_symbol_changes): Define.
10555         (class Sized_relobj): Define Function_offsets.  Declare
10556         split_stack_adjust, split_stack_adjust_reltype, and
10557         find_functions.
10558         * object.cc (Object::handle_split_stack_section): New function.
10559         (Sized_relobj::do_layout): Call handle_split_stack_section.
10560         * dynobj.cc (Sized_dynobj::do_layout): Call
10561         handle_split_stack_section.
10562         * reloc.cc (Sized_relobj::relocate_sections): Call
10563         split_stack_adjust for executable sections in split_stack
10564         objects.  Pass reloc_map to relocate_section.
10565         (Sized_relobj::split_stack_adjust): New function.
10566         (Sized_relobj::split_stack_adjust_reltype): New function.
10567         (Sized_relobj::find_functions): New function.
10568         * target-reloc.h: Include "object.h".
10569         (relocate_section): Add reloc_symbol_changes parameter.  Change
10570         all callers.
10571         * target.h (class Target): Add calls_non_split method.  Declare
10572         do_calls_non_split virtual method.  Declare match_view and
10573         set_view_to_nop.
10574         * target.cc: Include "elfcpp.h".
10575         (Target::do_calls_non_split): New function.
10576         (Target::match_view): New function.
10577         (Target::set_view_to_nop): New function.
10578         * gold.cc (queue_middle_tasks): Give an error if mixing
10579         split-stack and non-split-stack objects with -r.
10580         * i386.cc (Target_i386::relocate_section): Add
10581         reloc_symbol_changes parameter.
10582         (Target_i386::do_calls_non_split): New function.
10583         * x86_64.cc (Target_x86_64::relocate_section): Add
10584         reloc_symbol_changes parameter.
10585         (Target_x86_64::do_calls_non_split): New function.
10586         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10587         parameter.
10588         * powerpc.cc (Target_powerpc::relocate_section): Add
10589         reloc_symbol_changes parameter.
10590         * sparc.cc (Target_sparc::relocate_section): Add
10591         reloc_symbol_changes parameter.
10592         * configure.ac: Call AM_CONDITIONAL for the default target.
10593         * configure: Rebuild.
10594         * testsuite/Makefile.am (TEST_AS): New variable.
10595         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10596         (check_DATA): Add split_i386 and split_x86_64 files.
10597         (SPLIT_DEFSYMS): Define.
10598         (split_i386_[1234n].o): New targets.
10599         (split_i386_[124]): New targets.
10600         (split_i386_[1234r].stdout): New targets.
10601         (split_x86_64_[1234n].o): New targets.
10602         (split_x86_64_[124]): New targets.
10603         (split_x86_64_[1234r].stdout): New targets.
10604         (MOSTLYCLEANFILES): Add new executables.
10605         * testsuite/split_i386.sh: New file.
10606         * testsuite/split_x86_64.sh: New file.
10607         * testsuite/split_i386_1.s: New file.
10608         * testsuite/split_i386_2.s: New file.
10609         * testsuite/split_i386_3.s: New file.
10610         * testsuite/split_i386_4.s: New file.
10611         * testsuite/split_i386_n.s: New file.
10612         * testsuite/split_x86_64_1.s: New file.
10613         * testsuite/split_x86_64_2.s: New file.
10614         * testsuite/split_x86_64_3.s: New file.
10615         * testsuite/split_x86_64_4.s: New file.
10616         * testsuite/split_x86_64_n.s: New file.
10617         * testsuite/testfile.cc (Target_test): Update relocation_section
10618         function.
10619         * testsuite/Makefile.in: Rebuild.
10620
10621 2009-10-06  Ian Lance Taylor  <iant@google.com>
10622
10623         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10624         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10625         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10626         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10627         the address on ldo_addrs_.
10628         (Target_i386::Relocate::fix_up_ldo): New function.
10629
10630 2009-10-06   Rafael Espindola  <espindola@google.com>
10631
10632         * plugin.cc (add_input_library): New.
10633         (Plugin::load): Add add_input_library to tv.
10634         (Plugin_manager::add_input_file): Add the is_lib argument.
10635         (add_input_file): Update call to Plugin_manager::add_input_file.
10636         (add_input_library): New.
10637         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10638
10639 2009-09-30  Doug Kwan  <dougkwan@google.com>
10640
10641         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10642         symbol and call Symbol::may_need_copy_reloc to determine if
10643         a copy reloc is needed.
10644         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10645         nocopyreloc is given in command line.
10646         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10647         given in command line.
10648         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10649         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10650         of the removed Target_i386::may_need_copy_reloc.
10651         * options.h (copyreloc): New option with default value false.
10652         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10653         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10654         instead of the removed Target_powerpc::may_need_copy_reloc.
10655         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10656         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10657         instead of the removed Target_sparc::may_need_copy_reloc.
10658         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10659         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10660         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10661         instead of the removed Target_x86_64::may_need_copy_reloc.
10662
10663 2009-09-30  Ian Lance Taylor  <iant@google.com>
10664
10665         * object.h (class Object): Remove target_ field, and target,
10666         sized_target, and set_target methods.
10667         (Object::sized_target): Remove.
10668         (class Sized_relobj): Update declarations.  Remove sized_target.
10669         * object.cc (Sized_relobj::setup): Remove target parameter.
10670         Change all callers.
10671         (Input_objects::add_object): Don't do anything with the target.
10672         (make_elf_sized_object): Add punconfigured parameter.  Change all
10673         callers.  Set or test parameter target.
10674         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10675         Change all callers.
10676         * parameters.cc (Parameters::set_target): Change parameter type to
10677         be non-const.
10678         (Parameters::default_target): Remove.
10679         (set_parameters_target): Change parameter type to be non-const.
10680         (parameters_force_valid_target): New function.
10681         (parameters_clear_target): New function.
10682         * parameters.h (class Parameters): Update declarations.  Remove
10683         default_target method.  Add sized_target and clear_target
10684         methods.  Change target_ to be non-const.
10685         (set_parameters_target): Update declaration.
10686         (parameters_force_valid_target): Declare.
10687         (parameters_clear_target): Declare.
10688         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10689         as NULL if we aren't searching.
10690         (Add_symbols::run): Don't check for compatible target.
10691         * fileread.cc (Input_file::open_binary): Call
10692         parameters_force_valid_target.
10693         * gold.cc (queue_middle_tasks): Likewise.
10694         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10695         set_target on object.
10696         * dynobj.h (class Sized_dynobj): Update declarations.
10697         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10698         make_elf_object returns NULL.
10699         (Archive::include_member): Don't check whether object target is
10700         compatible.
10701         * output.cc (Output_section::add_input_section): Get target from
10702         parameters.
10703         (Output_section::relax_input_section): Likewise.
10704         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10705         parameters.
10706         (Sized_relobj::do_scan_relocs): Likewise.
10707         (Sized_relobj::relocate_sections): Likewise.
10708         * resolve.cc (Symbol_table::resolve): Likewise.
10709         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10710         parameter.  Change all callers.
10711         (Symbol_table::add_from_object): Get target from parameters.
10712         (Symbol_table::add_from_relobj): Don't check object target.
10713         (Symbol_table::add_from_dynobj): Likewise.
10714         (Symbol_table::define_special_symbol): Get target from
10715         parameters.
10716         * symtab.h (class Symbol_table): Update declaration.
10717         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10718         parameter.  Change all callers.  Clear parameter target.
10719         (Binary_test): Test target here.
10720         * testsuite/object_unittest.cc (gold_testsuite): Remove
10721         target_test_pointer parameter.  Change all callers.
10722         (Object_test): Test target here.
10723
10724 2009-09-26  Ian Lance Taylor  <iant@google.com>
10725
10726         * testsuite/initpri1.c: Don't try to use constructor priorities if
10727         compiling with gcc before 4.3.
10728
10729 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10730
10731         * testsuite/retain_symbols_file_test.sh (check_present): Change
10732         output file name to retain_symbols_file_test.stdout.
10733         (check_absent): Likewise.
10734
10735 2009-09-18  Craig Silverstein  <csilvers@google.com>
10736
10737         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10738         * options.cc: Include <cerrno> and <fstream>.
10739         (General_options::finalize): Parse -retain-symbols-file tag.
10740         * options.h: New flag.
10741         (General_options): New method should_retain_symbol, new
10742         variable symbols_to_retain.
10743         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10744         should_retain_symbol map.
10745         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10746         * testsuite/Makefile.in: Regenerate.
10747         * testsuite/retain_symbols_file_test.sh: New file.
10748
10749 2009-09-18  Nick Clifton  <nickc@redhat.com>
10750
10751         * po/es.po: Updated Spanish translation.
10752
10753 2009-09-17  Doug Kwan  <dougkwan@google.com>
10754
10755         * debug.h (DEBUG_RELAXATION): New constant.
10756         (DEBUG_ALL): Add DEBUG_RELAXATION.
10757         (debug_string_to_enum): Add relaxation debug option.
10758         * layout.cc
10759         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10760         Layout::Relaxation_debug_check::read_sections,
10761         Layout::Relaxation_debug_check::read_sections): New method definitions.
10762         (Layout::Layout): Initialize data members
10763         record_output_section_data_from_scrips_,
10764         script_output_section_data_list_ and relaxation_debug_check_.
10765         (Layout::save_segments, Layout::restore_segments,
10766         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10767         Layout::relaxation_loop_body): New method definitions.
10768         (Layout::finalize): Support relaxation.  Move section layout code to
10769         Layout::relaxation_loop_body.
10770         (Layout::set_asection_address_from_script): Move code for orphan
10771         section placement out.
10772         (Layout::place_orphan_sections_in_script): New method definition.
10773         * layout.h (Output_segment_headers, Output_file_header):
10774         New forward class declarations.
10775         (Layout::~Layout): Define.
10776         (Layout::new_output_section_data_from_script): New method definition.
10777         (Layout::place_orphan_sections_in_script): New method declaration.
10778         (Layout::Segment_states): New type declaration.
10779         (Layout::save_segments, Layout::restore_segments,
10780         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10781         Layout::relaxation_loop_body): New method declarations.
10782         (Layout::Output_section_data_list): New type declaration.
10783         (Layout::Relaxation_debug_check): New class definition.
10784         (Layout::record_output_section_data_from_script_,
10785         Layout::script_output_section_data_list_, Layout::segment_states_,
10786         Layout::relaxation_debug_check_): New data members.
10787         * output.cc: (Output_section_headers::do_size): New method definition.
10788         (Output_section_headers::Output_section_headers): Move size
10789         computation to Output_section_headers::do_size.
10790         (Output_segment_headers::do_size): New method definition.
10791         (Output_file_header::Output_file_header): Move size computation to
10792         Output_file_header::do_size and call it.
10793         (Output_file_header::do_size): New method definition.
10794         (Output_data_group::Output_data_group): Adjust call to
10795         Output_section_data.
10796         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10797         (Output_symtab_xindex::do_write): Add array bound check.
10798         (Output_section::Input_section::print_to_mapfile): Handle
10799         RELAXED_INPUT_SECTION_CODE.
10800         (Output_section::Output_section): Initialize data member checkpoint_.
10801         (Output_section::~Output_section): Delete checkpoint object pointed
10802         by checkpoint_.
10803         (Output_section::add_input_section): Always add an Input_section if
10804         relaxing.
10805         (Output_section::add_merge_input_section): Add assert.
10806         (Output_section::relax_input_section): New method definition.
10807         (Output_section::set_final_data_size): Set load address to zero for
10808         an unallocated section.
10809         (Output_section::do_address_and_file_offset_have_reset_values):
10810         New method definition.
10811         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10812         Handle relaxed input section.
10813         (Output_section::sort_attached_input_sections): Checkpoint input
10814         section list lazily.
10815         (Output_section::get_input_sections): Change type of input_sections to
10816         list of Simple_input_section pointers.  Checkpoint input section list
10817         lazily.  Also handle relaxed input sections.
10818         (Output_section::add_input_section_for_script): Take a reference to
10819         a Simple_input_section object instead of Relobj pointer and section
10820         index as parameter.  Handle relaxed input sections.
10821         (Output_section::save_states, Output_section::restore_states): New
10822         method definitions.
10823         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10824         (Output_data::is_data_size_fixed): New method definition.
10825         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10826         if it is fixed.
10827         (Output_data::address_and_file_offset_have_reset_values): New method
10828         definition.
10829         (Output_data::do_address_and_file_offset_have_reset_values): New method
10830         definition.
10831         (Output_data::set_data_size): Check that data size is not fixed.
10832         (Output_data::fix_data_size): New method definition.
10833         (Output_data::is_data_size_fixed_): New data member.
10834         (Output_section_headers::set_final_data_size): New method definition.
10835         (Output_section_headers::do_size): New method declaration.
10836         (Output_segment_headers::set_final_data_size): New method definition.
10837         (Output_segment_headers::do_size): New method declaration.
10838         (Output_file_header::set_final_data_size)::New method definition.
10839         (Output_file_header::do_size)::New method declaration.
10840         (Output_section_data::Output_section_data): Add new parameter
10841         is_data_size_fixed and use it to fix data size.
10842         (Output_data_const::Output_data_const): Adjust call to base class
10843         constructor and fix data size.
10844         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10845         base class constructor and fix data size.
10846         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10847         base class constructor and fix data size.
10848         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10849         class constructor and fix data size.
10850         (Output_data_group::set_final_data_size): New method definition.
10851         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10852         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10853         class constructor and fix data size.
10854         (Output_relaxed_input_section): New class definition.
10855         (Output_section::Simple_input_section): New class definition.
10856         (Output_section::get_input_sections): Adjust parameter list.
10857         (Output_section::add_input_section_for_script): Same.
10858         (Output_section::save_states, Output_section::restore_states,
10859         Output_section::do_address_and_file_offset_have_reset_values,
10860         (Output_section::Input_section::Input_section): Handle
10861         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10862         Output_relaxed_input_section.
10863         (Output_section::Input_section::is_input_section,
10864         Output_section::Input_section::set_output_section): Handle relaxed
10865         input section.
10866         (Output_section::Input_section::is_relaxed_input_section,
10867         Output_section::Input_section::output_section_data,
10868         Output_section::Input_section::relaxed_input_section): New method
10869         definitions.
10870         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10871         value.
10872         (Output_section::Input_section::u1_): Update comments.
10873         (Output_section::Input_section::u2_): Add new union member poris.
10874         (Output_section::Checkpoint_output_section): New classs definition.
10875         (Output_section::relax_input_section): New method declaration.
10876         (Output_section::checkpoint_): New data member.
10877         (Output_segment): Update comments.
10878         (Output_segment::Output_segment): Un-privatize copy constructor.
10879         (Output_segment::operator=): Un-privatize.
10880         * script-sections.cc (Output_section_element::Input_section_list):
10881         Change element type to Output_section::Simple_input_section.
10882         (Output_section_element_dot_assignment::set_section_addresses):
10883         Register output section data for relaxation clean up.
10884         (Output_data_exression::Output_data_expression): Adjust call to base
10885         constructor to fix data size.
10886         (Output_section_element_data::set_section_addresses): Register
10887         Output_data_expression object for relaxation clean up.
10888         (struct Input_section_info): Replace Relobj pointer and section index
10889         pair with Output_section::Simple_input_section and Convert struct to a
10890         class.
10891         (Input_section_sorter::operator()): Adjust access to
10892         Input_section_info data member to use accessors.
10893         (Output_section_element_input::set_section_addresses): Use layout
10894         parameter.  Adjust code to use Output_section::Simple_input_section
10895         and Input_secction_info classes.  Register filler for relaxation
10896         clean up.
10897         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10898         and section index pair with Output_section::Simple_input_section
10899         class.  Adjust code accordingly.
10900         (Phdrs_element::release_segment): New method definition.
10901         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10902         segment list.
10903         (Script_sections::release_segments): New method definition.
10904         * gold/script-sections.h (Script_sections::release_segments): New
10905         method declaration.
10906         * gold/target.h (Target::may_relax, Target::relax,
10907         Target::do_may_relax, Target::do_relax): New method definitions.
10908
10909 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10910
10911         * arm.cc (has_signed_unsigned_overflow): New function.
10912         (Arm_relocate_functions::abs8): New function.
10913         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10914         (Target_arm::Scan::global): Likewise.
10915         (Target_arm::relocate::relocate): Likewise.
10916         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10917         Likewise.
10918
10919 2009-09-16  Cary Coutant  <ccoutant@google.com>
10920
10921         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10922         * testsuite/Makefile.in: Regenerate.
10923
10924 2009-09-11  Nick Clifton  <nickc@redhat.com>
10925
10926         * po/gold.pot: Updated by the Translation project.
10927
10928 2009-09-08  Cary Coutant  <ccoutant@google.com>
10929
10930         * output.cc (Output_file::open): Add execute permission to empty file.
10931         * testsuite/Makefile.am (permission_test): New test.
10932         * testsuite/Makefile.in: Regenerate.
10933
10934 2009-09-02  Ian Lance Taylor  <iant@google.com>
10935
10936         * output.cc (Output_file::resize): Call map_no_anonymous rather
10937         than map.
10938
10939 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10940
10941         * gold.cc: Include "incremental.h".
10942         (queue_initial_tasks): Call Incremental_checker methods.
10943         * incremental.cc: Include "output.h".
10944         (Incremental_checker::can_incrementally_link_output_file): New
10945         method.
10946         * incremental.h (Incremental_checker): New class.
10947
10948         * output.cc (Output_file::open_for_modification): New method.
10949         (Output_file::map_anonymous): Changed return type to bool.  Record
10950         map in base_ field.
10951         (Output_file::map_no_anonymous): New method, broken out of map.
10952         (Output_file::map): Use map_no_anonymous and map_anonymous.
10953         * output.h (class Output_file): Update declarations.
10954
10955 2009-08-24  Cary Coutant  <ccoutant@google.com>
10956
10957         * options.h (Command_line::Pre_options): New class.
10958         (Command_line::pre_options): New member.
10959         * options.cc (gold::options::ready_to_register): New variable.
10960         (One_option::register_option): Do nothing if not registering options.
10961         Assert if same short option registered twice.
10962         (General_options::General_options): Turn off option registration when
10963         done constructing.
10964         (Command_line::Pre_options::Pre_options): New constructor.
10965
10966 2009-08-24  Cary Coutant  <ccoutant@google.com>
10967
10968         * options.h (General_options::no_keep_memory): Remove incorrect
10969         short option.
10970
10971 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10972
10973         * Makefile.am (am__skiplex, am__skipyacc): New.
10974         * Makefile.in: Regenerate.
10975
10976 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10977
10978         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10979         (INCLUDES): ... this.
10980         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10981         (AM_CPPFLAGS): Renamed from ...
10982         (INCLUDE): ... this.
10983         * Makefile.in, testsuite/Makefile.in: Regenerate.
10984
10985         * Makefile.in: Regenerate.
10986         * aclocal.m4: Likewise.
10987         * config.in: Likewise.
10988         * configure: Likewise.
10989         * testsuite/Makefile.in: Likewise.
10990
10991         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10992         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10993         * Makefile.in: Regenerate.
10994         * testsuite/Makefile.in: Regenerate.
10995
10996 2009-08-19  Cary Coutant  <ccoutant@google.com>
10997
10998         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10999         symbols in shared libraries overridden by hidden or internal symbols
11000         in the main program.
11001
11002 2009-08-19  Chris Demetriou  <cgd@google.com>
11003
11004         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11005         checking source file names in error messages.
11006
11007 2009-08-18  Doug Kwan  <dougkwan@google.com>
11008
11009         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11010         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11011         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11012         an elfcpp::Ehdr as parameter.
11013         * object.cc (Object::set_target): Remove the version that looks up
11014         a target and sets it.
11015         (Sized_relobj::setup): Take a Target object instead of
11016         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11017         (make_elf_sized_object): Find target and ask target to
11018         make an ELF object.
11019         * object.h: (Object::set_target): Remove the version that looks up
11020         a target and sets it.
11021         (Sized_relobj::setup): Take a Target object instead of
11022         an elfcpp:Ehdr as parameter.
11023         * target.cc: Include dynobj.h.
11024         (Target::do_make_elf_object_implementation): New.
11025         (Target::do_make_elf_object): New.
11026         * target.h (Target::make_elf_object): New template declaration.
11027         (Target::do_make_elf_object): New method declarations.
11028         (Target::do_make_elf_object_implementation): New template declaration.
11029
11030 2009-08-14  Ian Lance Taylor  <iant@google.com>
11031
11032         * gold.h (FUNCTION_NAME): Define.
11033         (gold_unreachable): Use FUNCTION_NAME.
11034
11035 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11036
11037         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11038         symbol in the --keep-unique list is not found.
11039
11040 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11041
11042         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11043         been maked as --keep-unique.
11044         (Icf::unfold_section): New function.
11045         * icf.h (Icf::unfold_section): New function.
11046         * options.h (General_options::keep_unique): New option.
11047         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11048         * testsuite/Makefile.in: Regenerate.
11049         * testsuite/icf_keep_unique_test.sh: New file.
11050         * testsuite/icf_keep_unique_test.cc: New file.
11051
11052 2009-08-12  Cary Coutant  <ccoutant@google.com>
11053
11054         PR 10471
11055         * resolve.cc (Symbol_table::resolve): Check for references from
11056         dynamic objects to hidden and internal symbols.
11057         * testsuite/Makefile.am (hidden_test.sh): New test.
11058         * testsuite/Makefile.in: Regenerate.
11059         * testsuite/hidden_test.sh: New script.
11060         * testsuite/hidden_test_1.c: New test source.
11061         * testsuite/hidden_test_main.c: New test source.
11062
11063 2009-08-11  Doug Kwan  <dougkwan@google.com>
11064
11065         * arm.cc: Update comments.
11066         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11067         segment to locate the .ARM.exidx section if present.
11068
11069 2009-08-09  Doug Kwan  <dougkwan@google.com>
11070
11071         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11072         patch.
11073
11074 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11075         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11076         compiler warnings.
11077
11078 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11079
11080         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11081         valid tls_segment only for non-debug-section relocations.
11082         * testsuite/Makefile.am: Add gc_tls_test.
11083         * testsuite/Makefile.in: Regenerate.
11084         * testsuite/gc_tls_test.cc: New file.
11085         * testsuite/gc_tls_test.sh: New file.
11086
11087 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11088
11089         * icf.cc: New file.
11090         * icf.h: New file.
11091         * Makefile.am (CCFILES): Add icf.cc.
11092         (HFILES): Add icf.h
11093         * Makefile.in: Regenerate.
11094         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11095         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11096         section, symbol and addend information for the relocs.
11097         * gold.cc (queue_middle_tasks): Call identical code folding.
11098         * gold.h: Add defines for multimap.
11099         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11100         to the call of finalize_local_symbols.
11101         * main.cc (main): Create object of class Icf.
11102         * object.cc (Sized_relobj::do_layout): Allow this function to be
11103         called twice during icf.
11104         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11105         to sections marked as identical by icf.
11106         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11107         when available.
11108         (Sized_relobj::do_section_entsize): New function.
11109         * object.h (Object::section_entsize): New function.
11110         (Object::do_section_entsize): New pure virtual function.
11111         (Relobj::finalize_local_symbols): Add new parameter.
11112         (Relobj::do_section_entsize): New function.
11113         * options.h (General_options::icf): New option.
11114         (General_options::icf_iterations): New option.
11115         (General_options::print_icf_sections): New option.
11116         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11117         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11118         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11119         icf.
11120         * symtab.cc (Symbol_table::is_section_folded): New function.
11121         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11122         to sections marked as identical by icf.
11123         * symtab.h (Symbol_table::set_icf): New function.
11124         (Symbol_table::icf): New function.
11125         (Symbol_table::is_section_folded): New function.
11126         (Symbol_table::icf_): New data member.
11127         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11128         * testsuite/Makefile.am: Add commands to build icf_test.
11129         * testsuite/Makefile.in: Regenerate.
11130         * testsuite/icf_test.sh: New file.
11131         * testsuite/icf_test.cc: New file.
11132
11133 2009-07-24  Chris Demetriou  <cgd@google.com>
11134
11135         * layout.cc (is_compressible_debug_section): Fix incorrect
11136         comment about compressed section names.
11137
11138 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11139
11140         PR 10419
11141         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11142
11143 2009-07-16  Ian Lance Taylor  <iant@google.com>
11144
11145         PR 10400
11146         * layout.h: #include <map>.
11147         (class Kept_section): Change from struct to class.  Add accessors
11148         and setters.  Add section size to Comdat_group mapping.  Change
11149         Comdat_group to std::map.  Add is_comdat_ field.  Add
11150         linkonce_size field in union.
11151         (class Layout): Update declaration of find_or_add_kept_section.
11152         Don't declare find_kept_object.
11153         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11154         parameter.  Add object, shndx, is_comdat, and is_group_name
11155         parameters.  Change all callers.  Adjust for new Kept_section.
11156         (Layout::find_kept_object): Remove.
11157         * object.cc (Sized_relobj::include_section_group): Update use of
11158         Kept_section.  Rename secnum to shndx.  Only record
11159         Kept_comdat_section if sections are the same size.
11160         (Sized_relobj::include_linkonce_section): Update use of
11161         Kept_section.  Only record Kept_comdat_section if sections are the
11162         same size.  Set size of linkonce section.
11163         (Sized_relobj::map_to_kept_section): Update call to
11164         get_kept_comdat_section.
11165         * object.h (class Sized_relobj): Rename fields in
11166         Kept_comdat_section to drop trailing underscores; change object
11167         field to Relobj*.  Change Kept_comdat_section_table to store
11168         struct rather than pointer.
11169         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11170         Add kept_object and kept_shndx parameters.  Change all callers.
11171         (Sized_relobj::get_kept_comdat_section): Change return type to
11172         bool.  Add kept_object and kept_shndx parameters.  Change all
11173         callers.
11174         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11175         Layout::find_or_add_kept_section.
11176
11177 2009-07-09  Ian Lance Taylor  <iant@google.com>
11178
11179         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11180         Reserve space in the hash table.
11181
11182 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11183
11184         * fileread.cc (File_read::get_mtime): New method.
11185         * fileread.h (Timespec): New structure.
11186         (File_read::get_mtime): New method.
11187         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11188         Renamed from timestamp_nsec.
11189         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11190         Elf_Xword.
11191         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11192         timestamp_nsec.
11193         (Incremental_inputs::report_archive): Save mtime; style fix.
11194         (Incremental_inputs::report_obejct): Save mtime; style fix.
11195         (Incremental_inputs::report_script): Save mtime; style fix.
11196         (Incremental_inputs::finalize_inputs): Style fix.
11197         (Incremental_inputs::finalize): Style fix.
11198         (Incremental_inputs::create_input_section_data): Store inputs
11199         mtime.
11200         * incremental.h (Incremental_inputs::report_script): Add mtime
11201         argument.
11202         (Incremental_inputs::Input_info::Input_info): Intialize only one
11203         union member.
11204         (Incremental_inputs::Input_info::archive): Move to nameless
11205         union.
11206         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11207         (Incremental_inputs::Input_info::script): Move to nameless union.
11208         (Incremental_inputs::mtime): New field.
11209         * script.cc (read_input_script): Pass file mtime to
11210         Incremental_input.
11211         * script.h (Script_info::inputs): Style fix.
11212
11213 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11214
11215         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11216         instead of 32.
11217
11218 2009-06-24  Ian Lance Taylor  <iant@google.com>
11219
11220         PR 10156
11221         * layout.cc (Layout::choose_output_section): If we find an
11222         existing section, update the flags.
11223         (Layout::create_notes): New function, broken out of
11224         Layout::finalize.
11225         (Layout::finalize): Don't create note sections.
11226         (Layout::create_note): Don't crash if linker script discards
11227         section.
11228         (Layout::create_gold_note): Likewise.
11229         (Layout::create_build_id): Likewise.  Don't set
11230         after_input_sections on the section.
11231         (Layout::create_executable_stack_info): Remove target parameter.
11232         Change caller.
11233         * layout.h (class Layout): Declare create_notes.  Update
11234         declaration of create_executable_stack_info.
11235         * gold.cc (queue_middle_tasks): Call create_notes.
11236         * output.cc (Output_section::update_flags_for_input_section): Move
11237         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11238         invalid.
11239         * output.h (Output_data::mark_address_invalid): New function.
11240         (class Output_section): Only declare, not define,
11241         update_flags_for_input_section.  Remove set_flags.
11242
11243 2009-06-24  Ian Lance Taylor  <iant@google.com>
11244
11245         * script-sections.cc (Output_section_definition::
11246         set_section_addresses): Rename shadowing local load_address to
11247         laddr.
11248
11249 2009-06-24  Ian Lance Taylor  <iant@google.com>
11250
11251         PR 10244
11252         * reloc.cc (relocate_sections): Skip empty relocation sections.
11253
11254 2009-06-23  Ian Lance Taylor  <iant@google.com>
11255
11256         PR 10156
11257         * layout.cc (Layout::create_note): Use choose_output_section
11258         rather than make_output_section.
11259
11260 2009-06-23  Ian Lance Taylor  <iant@google.com>
11261
11262         PR 10237
11263         * options.cc (General_options::parse_V): Set printed_version_.
11264         (General_options::General_options): Initialize printed_version_.
11265         * options.h (class General_options): Add printed_version_ field.
11266         * gold.cc (queue_initial_tasks): If there are no input files,
11267         don't give a fatal error if we printed the version information.
11268         (queue_middle_tasks): If using -r with a shared object, give a
11269         fatal error rather than an ordinary error.
11270
11271 2009-06-23  Ian Lance Taylor  <iant@google.com>
11272
11273         PR 10219
11274         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11275         (Layout::make_output_section): Set have_stabstr_section_ if we see
11276         a .stab*str section.
11277         (Layout::finalize): Call link_stabs_sections.
11278         (Layout::link_stabs_sections): New file.
11279         * layout.h (class Layout): Add have_stabstr_section_ field.
11280         Declare link_stabs_sections.
11281
11282 2009-06-23  Doug Kwan  <dougkwan@google.com>
11283
11284         * Makefile.am (libgold_a_LIBADD): New.
11285         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11286         * Makefile.in: Regenerate.
11287         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11288         * configure: Regenerate.
11289         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11290         * fileread.cc: Include sys/state.h
11291         * gold.h: Declare memmem and strndup if found missing.
11292         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11293
11294 2009-06-23  Ian Lance Taylor  <iant@google.com>
11295
11296         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11297         * configure: Rebuild.
11298
11299 2009-06-23  Ian Lance Taylor  <iant@google.com>
11300
11301         PR 10147
11302         * object.cc (Object::section_contents): Don't try to get a view if
11303         the section has length zero.
11304         (Object::handle_gnu_warning_section): If the section is empty, use
11305         the name of the section as the warning.
11306
11307 2009-06-23  Ian Lance Taylor  <iant@google.com>
11308
11309         PR 10133
11310         * stringpool.h (class Stringpool_template): Add optimize_ field.
11311         (Stringpool_template::set_optimize): New function.
11312         * stringpool.cc (Stringpool_template::Stringpool_template):
11313         Initialize optimize_ field.
11314         (Stringpool_template::set_string_offsets): Test local optimize
11315         fild rather than parameter.
11316         * layout.cc (Layout::Layout): Call set_optimize on the section
11317         name stringpool.
11318
11319 2009-06-22  Ian Lance Taylor  <iant@google.com>
11320
11321         PR 10030
11322         * yyscript.y: Parse TARGET.
11323         * script.cc (script_set_target): New function.
11324         * script-c.h (script_set_target): Declare.
11325         * options.cc (General_options::string_to_object_format): Rename
11326         from string_to_object_format in anonymous namespace.  Change
11327         callers.
11328         * options.h (class General_options): Declare
11329         string_to_object_format.
11330
11331 2009-06-22  Ian Lance Taylor  <iant@google.com>
11332
11333         * script-sections.cc (Script_sections::create_segments): Don't put
11334         program headers in a PT_LOAD segment if -n or -N.
11335
11336 2009-06-22  Ian Lance Taylor  <iant@google.com>
11337
11338         PR 10141
11339         * options.h (class General_options): Add -z lazy and -z now.  Sort
11340         -z options into alphabetical order.
11341         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11342
11343 2009-06-21  Ian Lance Taylor  <iant@google.com>
11344
11345         * layout.cc (Layout::make_output_section): Call
11346         Target::new_output_section.
11347         (Layout::attach_allocated_section_to_segment): Put large section
11348         sections in a separate load segment with the large segment flag
11349         set.
11350         (Layout::segment_precedes): Sort large data segments after other
11351         load segments.
11352         (align_file_offset): New static function.
11353         (Layout::set_segment_offsets): Use align_file_offset.
11354         * output.h (class Output_section): Add is_small_section_ and
11355         is_large_section_ fields.
11356         (Output_section::is_small_section): New function.
11357         (Output_section::set_is_small_section):  New function.
11358         (Output_section::is_large_section): New function.
11359         (Output_section::set_is_large_section): New function.
11360         (Output_section::is_large_data_section): New function.
11361         (class Output_segment): Add is_large_data_segment_ field.
11362         (Output_segment::is_large_data_segment): New function.
11363         (Output_segment::set_is_large_data_segment): New function.
11364         * output.cc (Output_section::Output_section): Initialize new
11365         fields.
11366         (Output_segment::Output_segment): Likewise.
11367         (Output_segment::add_output_section): Add assertion that large
11368         data sections always go in large data segments.  Force small data
11369         sections to the end of the list of data sections.  Force small BSS
11370         sections to the start of the list of BSS sections.  For large BSS
11371         sections to the end of the list of BSS sections.
11372         * symtab.h (class Symbol): Declare is_common_shndx.
11373         (Symbol::is_defined): Check Symbol::is_common_shndx.
11374         (Symbol::is_common): Likewise.
11375         (class Symbol_table): Define enum Commons_section_type.  Update
11376         declarations.  Add small_commons_ and large_commons_ fields.
11377         * symtab.cc (Symbol::is_common_shndx): New function.
11378         (Symbol_table::Symbol_table): Initialize new fields.
11379         (Symbol_table::add_from_object): Put small and large common
11380         symbols in the right list.
11381         (Symbol_table::sized_finalized_symbol): Check
11382         Symbol::is_common_shndx.
11383         (Symbol_table::sized_write_globals): Likewise.
11384         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11385         common symbol lists.  Don't call do_allocate_commons_list if the
11386         list is empty.
11387         (Symbol_table::do_allocate_commons_list): Remove is_tls
11388         parameter.  Add comons_section_type parameter.  Change all
11389         callers.  Handle small and large common symbols.
11390         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11391         Symbol::is_common_shndx.
11392         * resolve.cc (symbol_to_bits): Likewise.
11393         * target.h (Target::small_common_shndx): New function.
11394         (Target::small_common_section_flags): New function.
11395         (Target::large_common_shndx): New function.
11396         (Target::large_common_section_flags): New function.
11397         (Target::new_output_section): New function.
11398         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11399         small_common_section_flags, and large_common_section_flags
11400         fields.
11401         (Target::do_new_output_section): New virtual function.
11402         * arm.cc (Target_arm::arm_info): Initialize new fields.
11403         * i386.cc (Target_i386::i386_info): Likewise.
11404         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11405         Likewise.
11406         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11407         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11408         (Target_x86_64::do_new_output_section): New function.
11409         * configure.ac: Define conditional MCMODEL_MEDIUM.
11410         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11411         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11412         (large_LDFLAGS): Define.
11413         * testsuite/large.c: New file.
11414         * testsuite/testfile.cc (Target_test::test_target_info):
11415         Initialize new fields.
11416         * configure, testsuite/Makefile.in: Rebuild.
11417
11418 2009-06-05  Doug Kwan  <dougkwan@google.com>
11419
11420         * Makefile.am (CCFILES): Add target.cc.
11421         * Makefile.in: Regenerate.
11422         * i386.cc (class Target_i386): Define new virtual method to
11423         override do_is_local_label_name in parent.
11424         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11425         local symbols if --discard-locals or -X is given.
11426         * options.h (class General_options): Declare new options
11427         '--discard-locals' and '-X' for discarding locals.
11428         * target.h (class Target): Define new methods is_local_label_name.
11429         Declare new virtual method do_is_local_label_name.
11430         * target.cc: New file.
11431         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11432         (check_SCRIPTS): Add discard_locals_test.sh.
11433         (check_DATA): Add discard_local_tests.syms.
11434         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11435         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11436         * testsuite/Makefile.in: Regenerate.
11437         * testsuite/discard_locals_test.c: New file.
11438         * testsuite/discard_locals_test.sh: Same.
11439
11440 2009-06-05  Doug Kwan  <dougkwan@google.com>
11441
11442         * object.cc (Sized_relobj::Sized_relobj): Initialize
11443         discarded_eh_frame_shndx_ to -1U.
11444         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11445         section.
11446         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11447         a discarded .eh_frame section.
11448         (Sized_relobj::do_finalize_local_symbols): Ditto.
11449         * object.h (class Sized_relobj): Declare new member
11450         discarded_eh_frame_shndx_.
11451         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11452         (local_labels_test.o, local_labels_test): New rules.
11453         * testsuite/Makefile.in: Regenerate.
11454
11455 2009-06-04  Doug Kwan  <dougkwan@google.com>
11456
11457         * layout.cc (Layout::section_name_mapping): Add mapping for
11458         special ARM sections.
11459
11460 2009-06-03  Doug Kwan  <dougkwan@google.com>
11461
11462         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11463         (utils::has_overflow): Same.
11464
11465 2009-06-03  Ian Lance Taylor  <iant@google.com>
11466
11467         * layout.cc (Layout::section_name_mapping): New array, replacing
11468         Layout::linkonce_mapping.
11469         (Layout::section_name_mapping_count): New variable, replacing
11470         Layout::linkonce_mapping_count.
11471         (Layout::linkonce_output_name): Remove.
11472         (Layout::output_section_name): Rewrite.
11473         * layout.h (class Layout): Rename Linkonce_mapping to
11474         Section_name_mapping, linkonce_mapping to section_name_mapping,
11475         linkonce_mapping_count to section_name_mapping_count.  Don't
11476         declare linkonce_output_name.
11477
11478 2009-06-03  Doug Kwan  <dougkwan@google.com>
11479
11480         * gold/arm.cc (namespace utils): New.
11481         (Target_arm::reloc_is_non_pic): Define new method.
11482         (class Arm_relocate_functions): New.
11483         (Target_arm::Relocate::relocate): Handle relocation types used by
11484         Android.
11485
11486 2009-06-03  Ian Lance Taylor  <iant@google.com>
11487
11488         * arm.cc (Target_arm::scan::global): Use || instead of |.
11489
11490 2009-06-02  Doug Kwan  <dougkwan@google.com>
11491
11492         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11493         issued_non_pic_error_.
11494         (class Target_arm::Scan): Declare new method check_non_pic.
11495         Define new method symbol_needs_plt_entry.
11496         Declare new data member issued_non_pic_error_.
11497         (class Target_arm::Relocate): Declare new method
11498         should_apply_static_reloc.
11499         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11500         (Target_arm::Scan::check_non_pic): Define new method.
11501         (Target_arm::Scan::local): Handle a small subset of reloc types used
11502         by Android.
11503         (Target_arm::Scan::local): Same.
11504         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11505
11506 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11507
11508         * incremental.cc (Incremental_inputs::report_command_line): Filter
11509         out --incremental-* options.
11510
11511 2009-05-29  Doug Kwan  <dougkwan@google.com>
11512
11513         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11514         template class.
11515         (class Target_arm): Update comment.
11516         (Target_arm::Target_arm): Initialize new data members GOT_,
11517         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11518         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11519         and Target_arm::rel_dyn_section.
11520         Declare new_enum Target_arm::Got_type.
11521         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11522         and DYNBSS_.
11523         Update commments for member do_dynsym_value.
11524         (Target_arm::got_size, Target_arm::plt_section,
11525         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11526         new methods inside class defintion.
11527         (Target_arm::got_section): Define new method.
11528         (Target_arm::rel_dyn_section): Same.
11529         (Output_data_plt_arm): New template class.
11530         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11531         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11532         (Output_data_plt_arm::add_entry): Same.
11533         (Output_data_plt_arm::first_plt_entry): Define new
11534         static data member for PLT instruction template.
11535         (Output_data_plt_arm::plt_entry): Same.
11536         (Output_data_plt_arm::do_write): Define new method.
11537         (Target_arm::make_plt_entry): Same.
11538         (Target_arm::do_finalize_sections): Same.
11539         (Target_arm::do_dynsym_value): Same.
11540
11541 2009-05-28  Doug Kwan  <dougkwan@google.com>
11542
11543         * Makefile.am (TARGETSOURCES): Add arm.cc.
11544         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11545         * Makefile.in: Regenerate.
11546         * arm.cc: New file.
11547         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11548
11549 2009-05-26  Doug Kwan  <dougkwan@google.com>
11550
11551         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11552         (General_options::check_excluded_libs): Strip off directories in
11553         archive name before matching like GNU ld does.
11554         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11555         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11556         (exclude_libs_test_LDFLAGS): Add linker option
11557         -Wl,--exclude-libs,libexclude_libs_test_3
11558         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11559         an explicit archive without using -l.
11560         (alt/libexclude_libs_test_3.a): New make rule.
11561         * testsuite/Makefile.in: Regenerate.
11562         * testsuite/exclude_libs_test.c : Declare lib3_default().
11563         (main): Call it.
11564         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11565         * exclude_libs_test_3.c: New file.
11566
11567 2009-05-26  Nick Clifton  <nickc@redhat.com>
11568
11569         * po/id.po: New Indonesian translation.
11570         * po/gold.pot: Updated template file.
11571
11572 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11573
11574         * testsuite/Makefile.am: Add -ffunction-sections to compile
11575         gc_comdat_test files.  Add -Wl,--gc-sections to build
11576         gc_comdat_test.
11577         * testsuite/Makefile.in: Regenerate.
11578         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11579
11580 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11581
11582         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11583         kept comdat section was garbage collected.
11584         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11585         * testsuite/Makefile.in: Regenerate.
11586         * testsuite/gc_comdat_test.sh: New file.
11587         * testsuite/gc_comdat_test_1.cc: New file.
11588         * testsuite/gc_comdat_test_2.cc: New file.
11589
11590 2009-05-19  Doug Kwan  <dougkwan@google.com>
11591
11592         * archive.cc (Archive::Archive): Move constructor from archive.h
11593         to here.  Initialize no_export_.
11594         (Archive::get_elf_object_for_member): Set no_export flag of object.
11595         * archive.h (Archive::Archive): Move constructor body to
11596         archive.cc.
11597         (Archive::no_export): New method.
11598         (Archive::no_export_): New field.
11599         * object.h (Object::Object): Initialize no_export_ to false.
11600         (Object::no_export, Object::set_no_export): New methods.
11601         (Object::no_export_): New field.
11602         * options.cc (General_options::parse_exclude_libs): New method.
11603         (General_options::check_excluded_libs) Same.
11604         * options.h (exclude_libs): New option.
11605         (General_options::check_excluded_libs): New method declaration.
11606         (General_options::excluded_libs_): New field.
11607         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11608         default or protected visibility if an object has no-export flag set.
11609         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11610         (check_SCRIPTS): Add exclude_libs_test.sh.
11611         (check_DATA): Add exclude_libs_test.syms.
11612         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11613         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11614         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11615         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11616         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11617         libexclude_libs_test_2.a): New rules.
11618         * testsuite/Makefile.in: Regenerate.
11619         * testsuite/exclude_libs_test.c: New file.
11620         * testsuite/exclude_libs_test.sh: Ditto.
11621         * testsuite/exclude_libs_test_1.c: Ditto.
11622         * testsuite/exclude_libs_test_2.c: Ditto.
11623
11624 2009-05-15  Ian Lance Taylor  <iant@google.com>
11625
11626         * configure.ac: Check for declarations for cases where libiberty.h
11627         checks HAVE_DECL_xxx.
11628         * configure, config.in: Rebuild.
11629
11630 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11631
11632         * gold.h (Incremental_argument_list): Remove (invalid) forward
11633         declaration.
11634         * incremental.cc (Incremental_inputs::report_achive): New method.
11635         (Incremental_inputs::report_object): New method.
11636         (Incremental_inputs::report_script): New method.
11637         (Incremental_inputs::finalize_inputs): New method.
11638         (Incremental_inputs::finalize): Call finalize_inputs().
11639         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11640         Create inputs entries.
11641         * incremental.h (Incremental_input_type): New enum.
11642         (Incremental_inputs::Incremental_input): Initialize new fields.
11643         (Incremental_inputs::report_inputs): New method.
11644         (Incremental_inputs::report_achive): New method.
11645         (Incremental_inputs::report_object): New method.
11646         (Incremental_inputs::report_script): New method.
11647         (Incremental_inputs::finalize_inputs): New method.
11648         (Incremental_inputs::Input_info): New struct.
11649         (Incremental_inputs::Input_info_map): New typedef.
11650         (Incremental_inputs::lock_): New field.
11651         (Incremental_inputs::Inputs_): New field.
11652         (Incremental_inputs::Inputs_map): New field.
11653         * main.cc (main): Call Incremental_input::report_inputs.
11654         * options.h (Input_argument_list): Typedef moved from
11655         Input_arguments.
11656         (Input_file_group::Files): Remove, use ::Input_argument_list.
11657         (Input_file_group::Input_argument_list): Remove, use
11658         ::Input_argument_list.
11659         * plugin.cc (Plugin_manager::add_input_file): Add error in
11660         incremental build.
11661         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11662         functions.
11663         * script.cc (read_input_script): Call
11664         Incremental_input::report_script.
11665         * script.h (Script_info): New class.
11666
11667 2009-04-27  Ian Lance Taylor  <iant@google.com>
11668
11669         * x86_64.cc (do_adjust_output_section): Set entsize to
11670         plt_entry_size.
11671
11672 2009-04-23  Elliott Hughes  <enh@google.com>
11673
11674         * output.cc (Output_file::close): After short writes, continue
11675         writing from the correct offset in the buffer being written.
11676
11677 2009-04-23  Chris Demetriou  <cgd@google.com>
11678
11679         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11680         * configure: Regenerate.
11681         * config.in: Regenerate.
11682         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11683         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11684
11685 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11686
11687         * incremental.cc (Incremental_inputs_header_data): Renamed from
11688         Incremental_input_header_data.
11689         (Incremental_inputs_header_data::data_size): New field.
11690         (Incremental_inputs_header_data::put_input_file_count): Renamed
11691         from input_file_count.
11692         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11693         from command_line_offset.
11694         (Incremental_inputs_header_data::put_reserved): Renamed from
11695         put_reserved.
11696         (Incremental_inputs_entry_data): Renamed from
11697         Incremental_input_entry_data.
11698         (Incremental_inputs_entry_data::data_size): New field.
11699         (Incremental_inputs::report_command_line): New method.
11700         (Incremental_inputs::finalize): New method.
11701         (Incremental_inputs::create_incremental_inputs_data): New method.
11702         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11703         * incremental.h: New file.
11704         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11705         (Layout::finalize): Create incremental inputs section in
11706         incremental builds.
11707         (Layout::create_incremental_info_sections): New method.
11708         * layout.h (Layout::incremental_inputs): New method.
11709         (Layout::create_incremental_info_sections): New method.
11710         (Layout::incremental_inputs_): New field.
11711         * main.cc (main): Notify Incremental_input of the command line.
11712
11713 2009-04-01  Ian Lance Taylor  <iant@google.com>
11714             Mikolaj Zalewski  <mikolajz@google.com>
11715
11716         * gold.h (reserve_unordered_map): Define, three versions, one for
11717         each version of Unordered_map.
11718         * layout.cc (Layout::Layout): Remove options parameter.  Add
11719         number_of_input_files parameter.  Don't initialize options_.
11720         Initialize number_of_input_files_ and resized_signatures_.  Move
11721         sections_are_attached_.
11722         (Layout::layout_group): Reserve space for group_signatures_.
11723         (Layout::find_or_add_kept_section): Change name parameter to be a
11724         reference.  Resize signatures_ map when it gets large enough.
11725         (Layout::layout_eh_frame): Use parameters->options() instead of
11726         this->options_.
11727         (Layout::make_output_section): Likewise.
11728         (Layout::attach_allocated_section_to_segment): Likewise.
11729         (Layout::finalize, Layout::create_executable_stack): Likewise.
11730         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11731         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11732         * layout.h (class Layout): Update declarations.  Remove options_
11733         field.  Add number_of_input_files_ and resized_signatures_
11734         fields.  Move sections_are_attached_ field.
11735         * main.cc (main): Pass number of input files to Layout
11736         constructor.  Don't pass options.
11737
11738 2009-03-30  Ian Lance Taylor  <iant@google.com>
11739
11740         * ffsll.c (ffsll): Correct implementation.
11741
11742 2009-03-27  Ian Lance Taylor  <iant@google.com>
11743
11744         * ffsll.c: New file.
11745         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11746         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11747         * ftruncate.c (ftruncate): Declare before definition.
11748         * mremap.c (mremap): Likewise.
11749         * pread.c (pread): Likewise.
11750         * configure, Makefile.in, config.in: Rebuild.
11751
11752         * mremap.c: New file.
11753         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11754         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11755         (mremap): Declare if HAVE_MREMAP is not defined.
11756         * configure, Makefile.in, config.in: Rebuild.
11757
11758 2009-03-27  Cary Coutant  <ccoutant@google.com>
11759
11760         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11761         position independent.
11762         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11763         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11764
11765 2009-03-24  Cary Coutant  <ccoutant@google.com>
11766
11767         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11768         an executable.
11769         (needs_dynamic_reloc): Likewise.
11770
11771 2009-03-24  Ian Lance Taylor  <iant@google.com>
11772
11773         * yyscript.y (file_cmd): Recognize EXTERN.
11774         (extern_name_list, extern_name_list_body): New nonterminals.
11775         * script.cc (script_add_extern): Define.
11776         * script-c.h (script_add_extern): Declare.
11777
11778 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11779
11780         * object.cc (is_elf_object): Define.
11781         * object.h (is_elf_object): Declare.
11782         * archive.cc (Archive::get_elf_object_for_member): Call
11783         is_elf_object.
11784         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11785
11786 2009-03-24  Elliott Hughes  <enh@google.com>
11787
11788         * output.cc (Output_file::map_anonymous): Define.
11789         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11790         try an anonymous one.  Report the size if the mmap fails.
11791         * output.h (class Output_file): Declare map_anonymous.
11792
11793 2009-03-24  Ian Lance Taylor  <iant@google.com>
11794
11795         * target-select.cc (instantiate_target): Don't acquire the lock if
11796         the instantiated_target_ field has already been set.
11797
11798 2009-03-23  Ian Lance Taylor  <iant@google.com>
11799
11800         * gold-threads.h (class Initialize_lock): Define.
11801         * gold-threads.cc (class Initialize_lock_once): Define.
11802         (initialize_lock_control): New static variable.
11803         (initialize_lock_pointer): New static variable.
11804         (initialize_lock_once): New static function.
11805         (Initialize_lock::Initialize_lock): Define.
11806         (Initialize_lock::initialize): Define.
11807         * target-select.h: Include "gold-threads.h".
11808         (class Target_selector): Add lock_ and initialize_lock_ fields.
11809         Don't define instantiate_target, just declare it.
11810         * target-select.cc (Target_selector::Target_selector): Initialize
11811         new fields.
11812         (Target_selector::instantiate_target): Define.
11813         * descriptors.h: Include "gold-threads.h".
11814         (class Descriptors): Add initialize_lock_ field.
11815         * descriptors.cc (Descriptors::Descriptors): Initialize new
11816         field.
11817         (Descriptors::open): Use initialize_lock_ field
11818         * errors.h (class Errors): Add initialize_lock_ field.
11819         * errors.cc (Errors::Errors): Initialize new field.
11820         (Errors::initialize_lock): Use initialize_lock_ field.
11821         * powerpc.cc (class Target_selector_powerpc): Remove
11822         instantiated_target_ field.  In do_recognize call
11823         instantiate_target rather than do_instantiate_target.  In
11824         do_instantiate_target just allocate a new target.
11825         * sparc.cc (class Target_selector_sparc): Likewise.
11826
11827         * freebsd.h: New file.
11828         * i386.cc: Include "freebsd.h".
11829         (Target_i386): Derive from Target_freebsd rather than
11830         Sized_target.
11831         (Target_selector_i386): Derive from Target_selector_freebsd rather
11832         than Target_selector.
11833         * x86_64.cc: Include "freebsd.h".
11834         (Target_x86_64): Derive from Target_freebsd rather than
11835         Sized_target.
11836         (Target_selector_x86_64): Derive from Target_selector_freebsd
11837         rather than Target_selector.
11838         * target.h (class Target): Add adjust_elf_header and
11839         do_adjust_elf_header.
11840         * output.cc (Output_file_header:: do_sized_write): Call target
11841         adjust_elf_header routine.
11842         * configure.tgt: Set targ_osabi.
11843         * configure.ac: Define GOLD_DEFAULT_OSABI.
11844         * parameters.cc (Parameters::default_target): Pass
11845         GOLD_DEFAULT_OSABI to select_target.
11846         * target-select.h (class Target_selector): Make instantiate_target
11847         protected rather than private.
11848         * Makefile.am (HFILES): Add freebsd.h.
11849         * configure, Makefile.in, config.in: Rebuild.
11850
11851         * merge.cc (do_add_input_section): Correct pend value.  Change
11852         message about last entry not being null terminated from error to
11853         warning.
11854
11855 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11856
11857         * incremental.cc: New file.
11858         * Makefile.am (CCFILES): Add incremental.cc.
11859         * Makefile.in: Rebuild.
11860
11861 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11862
11863         * layout.cc (Layout::output_section_name): Preserve names
11864         of '.note.' sections.
11865
11866 2009-03-19  Ian Lance Taylor  <iant@google.com>
11867
11868         * descriptors.cc (Descriptors::open): Check that the options are
11869         valid before using them.
11870
11871 2009-03-18  Ian Lance Taylor  <iant@google.com>
11872
11873         * script-sections.h: Include <list>.
11874         (class Script_sections): Change Sections_elements from std::vector
11875         to std::list.  Typedef public Elements_iterator.  Add
11876         orphan_section_placement_, data_segment_align_start_, and
11877         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11878         field.
11879         * script-sections.cc (class Orphan_section_placement): New class.
11880         (class Sections_element): Add virtual functions is_relro and
11881         orphan_section_init.  Remove virtual function place_orphan_here.
11882         (class Output_section_definition): Add is_relro and
11883         orphan_section_init.  Remove place_orphan_here.
11884         (class Orphan_output_section): Likewise.
11885         (Script_sections::Script_sections): Update for field changes.
11886         (Script_sections::data_segment_align): Set saw_data_segment_align_
11887         and data_segment_align_start_, not data_segment_align_index.
11888         (Script_sections::data_segment_relro_end): Check
11889         saw_data_segment_align_.  Use data_segment_align_start_ rather
11890         than data_segment_align_index_.
11891         (Script_sections::place_orphan): Rewrite to use
11892         Orphan_section_placement.
11893
11894 2009-03-17  Ian Lance Taylor  <iant@google.com>
11895
11896         * archive.cc (Archive::add_symbols): Check for a version attached
11897         to the symbol name in the archive map.
11898         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11899         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11900         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11901         (ver_test_11.a): New target.
11902         * testsuite/Makefile.in: Rebuild.
11903
11904         * configure.ac: Check for chsize and posix_fallocate.  Replace
11905         ftruncate.
11906         * ftruncate.c: New file, from gnulib.
11907         * output.cc (posix_fallocate): Define dummy version if not
11908         HAVE_POSIX_FALLOCATE.
11909         (Output_file::map): Call posix_fallocate rather than lseek and
11910         write.
11911         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11912         * configure, Makefile.in, config.in: Rebuild.
11913
11914 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11915
11916         * layout.h (Layout::create_note): Add section_name parameter.
11917         * layout.cc (Layout::create_note): Likewise.
11918         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11919
11920 2009-03-17  Ian Lance Taylor  <iant@google.com>
11921
11922         * descriptors.cc: Include "options.h".
11923         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11924         (Descriptors::open): Always use O_CLOEXEC when opening a new
11925         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11926         then set FD_CLOEXEC.
11927
11928         * sparc.cc (class Target_sparc): Add has_got_section.
11929         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11930         make sure we have a GOT section.
11931
11932         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11933         (Target_sparc::Scan::local): Likewise.
11934         (Target_sparc::Scan::global): Likewise.
11935         (Target_sparc::Relocate::relocate): Likewise.
11936         (Target_sparc::Relocate::relocate_tls): Likewise.
11937
11938         * symtab.cc (Symbol_table::define_default_version): New function,
11939         broken out of add_from_object.
11940         (Symbol_table::add_from_object): Call define_default_version.
11941         (Symbol_table::define_special_symbol): Add resolve_oldsym
11942         parameter.  Change all callers.  If the version for a symbol comes
11943         from a version script, resolve it with the symbol with the same
11944         name with no version.  Also add the symbol without a version if
11945         appropriate.
11946         (do_define_in_output_data): If resolving with oldsym, don't delete
11947         sym.
11948         (do_define_in_output_segment): Likewise.
11949         (do_define_as_constant): Likewise.
11950         * symtab.h (class Symbol_table): Update declarations.
11951
11952 2009-03-13  Ian Lance Taylor  <iant@google.com>
11953
11954         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11955         (Read_symbols::requeue): New function.
11956         (Read_symbols::do_read_symbols): If make_elf_object fails because
11957         the target type is not configured, and the file was searched for,
11958         issue a warning and retry with the next directory.
11959         (Add_symbols::run): If the file has an incompatible format, and
11960         it was searched for, requeue the Read_symbols task.  On error,
11961         release the object.
11962         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11963         dirindex parameter to constructor.  Change all callers.  Declare
11964         incompatible_warning and requeue.
11965         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11966         input_argument_ and input_group_ fields.  Add them to
11967         constructor.  Change all callers.
11968         (class Read_script): Add dirindex_ field.  Add it to constructor.
11969         Change all callers.
11970         * archive.cc (Archive::setup): Remove input_objects parameter.
11971         Change all callers.
11972         (Archive::get_file_and_offset): Likewise.
11973         (Archive::read_all_symbols): Likewise.
11974         (Archive::read_symbols): Likewise.
11975         (Archive::get_elf_object_for_member): Remove input_objects
11976         parameter.  Add punconfigured parameter.  Change all callers.
11977         (Archive::add_symbols): Change return type to bool.  Check return
11978         value of include_member.
11979         (Archive::include_all_members): Likewise.
11980         (Archive::include_member): Change return type to bool.  Return
11981         false if first included object has incompatible target.  Set
11982         included_member_ field.
11983         (Add_archive_symbols::run): If add_symbols returns false, requeue
11984         Read_symbols task.
11985         * archive.h (class Archive): Add included_member_ field.
11986         Initialize it in constructor.  Add input_file and searched_for
11987         methods.  Update declarations.
11988         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11989         input_argument_ fields.  Add them to constructor.  Change all
11990         callers.
11991         * script.cc: Include "target-select.h".
11992         (class Parser_closure): Add skip_on_incompatible_target_ and
11993         found_incompatible_target_ fields.  Add
11994         skip_on_incompatible_target parameter to constructor.  Change all
11995         callers.  Add methods skip_on_incompatible_target,
11996         clear_skip_on_incompatible_target, found_incompatible_target, and
11997         set_found_incompatible_target.
11998         (read_input_script): Add dirindex parameter.  Change all callers.
11999         If parser finds an incompatible target, requeue Read_symbols
12000         task.
12001         (script_set_symbol): Clear skip_on_incompatible_target in
12002         closure.
12003         (script_add_assertion, script_parse_option): Likewise.
12004         (script_start_sections, script_add_phdr): Likewise.
12005         (script_check_output_format): New function.
12006         * script.h (read_input_script): Update declaration.
12007         * script-c.h (script_check_output_format): Declare.
12008         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12009         (ignore_cmd): Remove OUTPUT_FORMAT.
12010         * fileread.cc (Input_file::Input_file): Add explicit this.
12011         (Input_file::will_search_for): New function.
12012         (Input_file::open): Add pindex parameter.  Change all callers.
12013         * fileread.h (class Input_file): Add input_file_argument method.
12014         Declare will_search_for.  Update declarations.
12015         * object.cc (make_elf_object): Add punconfigured parameter.
12016         Change all callers.
12017         * object.h (class Object): Make input_file public.  Add
12018         searched_for method.
12019         (make_elf_object): Update declaration.
12020         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12021         restart search.
12022         * dirsearch.h (class Dirsearch): Update declaration.
12023         * options.h (class General_options): Add --warn-search-mismatch.
12024         * parameters.cc (Parameters::is_compatible_target): New function.
12025         * parameters.h (class Parameters): Declare is_compatible_target.
12026         * workqueue.cc (Workqueue::add_blocker): New function.
12027         * workqueue.h (class Workqueue): Declare add_blocker.
12028
12029         * fileread.cc (Input_file::open): Remove options parameter.
12030         Change all callers.
12031         (Input_file::open_binary): Likewise.
12032         * script.cc (read_input_script): Likewise.
12033         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12034         options parameter from constructor.  Change all callers.
12035         (class Read_script): Likewise.
12036         * fileread.h (class Input_file): Update declarations.
12037         * script.h (read_input_script): Update declaration.
12038
12039 2009-03-10  Nick Clifton  <nickc@redhat.com>
12040
12041         * po/es.po: New Spanish translation.
12042
12043 2009-03-06  Cary Coutant  <ccoutant@google.com>
12044
12045         * options.cc (parse_short_option): Keep dash_z from registering itself.
12046
12047 2009-03-03  Ian Lance Taylor  <iant@google.com>
12048
12049         PR 9918
12050         * target-reloc.h (relocate_section): Pass output_section to
12051         relocate.
12052         * i386.cc (Target_i386::should_apply_static_reloc): Add
12053         output_section parameter.  Change all callers.
12054         (Target_i386::Relocate::relocate): Add output_section parameter.
12055         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12056         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12057         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12058         * testsuite/two_file_shared.sh: New script.
12059         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12060         (check_DATA): Add two_file_shared.dbg.
12061         (two_file_shared.dbg): New target.
12062         * testsuite/Makefile.in: Rebuild.
12063
12064 2009-03-01  Ian Lance Taylor  <iant@google.com>
12065
12066         * configure.ac: Check for byteswap.h.
12067         * configure: Rebuild.
12068         * config.in: Rebuild.
12069
12070 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12071
12072         * layout.cc (Layout::find_or_add_kept_section): New function.
12073         (Layout::add_comdat): Removed.
12074         * layout.h (struct Kept_section): Move out of class Layout.
12075         Remove trailing underscores from field names.  Add group_sections
12076         field.  Rename group_ field to is_group.  Change all uses.
12077         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12078         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12079         comdat_groups_ field.
12080         (Sized_relobj::include_section_group): Use
12081         find_or_add_kept_section and Kept_section::group_sections.
12082         (Sized_relobj::include_linkonce_section): Likewise.
12083         * object.cc (class Sized_relobj): Don't define Comdat_group or
12084         Comdat_group_table.  Remove find_comdat_group and
12085         add_comdat_group.  Remove comdat_groups_ field.
12086         * plugin.cc (include_comdat_group): Use
12087         Layout::find_or_add_kept_section.
12088
12089 2009-02-28  Ian Lance Taylor  <iant@google.com>
12090
12091         * README: --gc-sections and map files are now supported.  Document
12092         some build requirements.
12093
12094         PR 6992
12095         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12096         relocatable link set the value of the section symbol to zero.
12097         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12098         relocatable link don't include the section address in the local
12099         symbol value.
12100
12101 2009-02-27  Ian Lance Taylor  <iant@google.com>
12102
12103         PR 6811
12104         * options.h (class Search_directory): Add is_system_directory.
12105         (class General_options): Declare is_in_system_directory.
12106         * options.cc (get_relative_sysroot): Make static.
12107         (get_default_sysroot): Make static.
12108         (General_optoins::is_in_system_directory): New function.
12109         * fileread.cc (Input_file::is_in_system_directory): New function.
12110         * fileread.h (class Input_file): Declare is_in_system_directory.
12111         * object.h (class Object): Add is_in_system_directory.
12112         (class Input_objects): Remove system_library_directory_ field.
12113         * object.cc (Input_objects::add_object): Don't set
12114         system_library_directory_.
12115         (input_objects::found_in_system_library_directory): Remove.
12116         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12117         parameter.  Change all callers.
12118         (Symbol_table::sized_write_globals): Likewise.
12119         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12120         Call Object::is_in_system_directory.
12121         * symtab.h (class Symbol_table): Update declarations.
12122
12123         PR 5990
12124         * descriptors.h (Open_descriptor): Add is_on_stack field.
12125         * descriptors.cc (Descriptors::open): If the descriptor is on the
12126         top of the stack, remove it.  Initialize is_on_stack field.
12127         (Descriptors::release): Only add pod to stack if it is not on the
12128         stack already.
12129         (Descriptors::close_some_descriptor): Clear stack_next and
12130         is_on_stack fields.
12131
12132         PR 7091
12133         * output.cc (Output_section::find_starting_output_address): Rename
12134         from starting_output_address; add PADDR parameter; change return
12135         type.
12136         * output.h (class Output_section): Declare
12137         find_starting_output_address instead of starting_output_address.
12138         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12139         section symbol for which we can't find a merge section.
12140
12141         PR 9836
12142         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12143         hidden or internal, force the symbol to be local.
12144         * resolve.cc (Symbol::override_visibility): Define.
12145         (Symbol::override_base): Use override_visibility.
12146         (Symbol_table::resolve): Likewise.
12147         (Symbol::override_base_with_special): Likewise.
12148         (Symbol_table::override_with_special): If the visibility is hidden
12149         or internal, force the symbol to be local.
12150         * symtab.h (class Symbol): Add set_visibility and
12151         override_visibility.
12152         * testsuite/ver_test_1.sh: New file.
12153         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12154         (check_DATA): Add ver_test_1.syms.
12155         (ver_test_1.syms): New target.
12156         * testsuite/Makefile.in: Rebuild.
12157
12158 2009-02-25  Cary Coutant  <ccoutant@google.com>
12159
12160         * layout.cc (Layout::choose_output_section): Don't rename sections
12161         when using a linker script that has a SECTIONS clause.
12162         * Makefile.in: Regenerate.
12163
12164         * testsuite/Makefile.am (script_test_5.sh): New test case.
12165         * testsuite/Makefile.in: Regenerate.
12166         * testsuite/script_test_5.cc: New file.
12167         * testsuite/script_test_5.sh: New file.
12168         * testsuite/script_test_5.t: New file.
12169
12170 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12171
12172         * archive.cc (Archive::include_member): Update calls to add_symbols.
12173         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12174         the Layout argument.
12175         * dynobj.h (do_add_symbols): Add the Layout argument.
12176         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12177         Layout argument.
12178         * object.h (Object::add_symbols): Add the Layout argument.
12179         (Object::do_add_symbols): Add the Layout argument.
12180         (Sized_relobj::do_add_symbols): Add the Layout argument.
12181         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12182         Unify the two versions.
12183         (Add_plugin_symbols): Remove.
12184         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12185         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12186         (Add_plugin_symbols): Remove.
12187         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12188         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12189         (Add_symbols::run): Make it work with Pulginobj.
12190
12191 2009-02-06  Ian Lance Taylor  <iant@google.com>
12192
12193         * object.cc (Sized_relobj::do_layout): Make info message start
12194         with lower case letter.
12195
12196 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12197
12198         * binary.cc: Fix file comment.
12199
12200         * options.h (enum Incremental_disposition): Define.
12201         (class General_options): Add new options: --incremental,
12202         --incremental_changed, --incremental_unchanged,
12203         --incremental_unknown.  Add incremental_disposition_ and
12204         implicit_incremental_ fields.
12205         (General_options::incremental_disposition): New function.
12206         (class Position_dependent_options): Add incremental_disposition
12207         option.
12208         (Position_dependent_options::copy_from_options): Set incremental
12209         dispositions.
12210         * options.cc (General_options::parse_incremental_changed): New
12211         function.
12212         (General_options::parse_incremental_unchanged): New function.
12213         (General_options::parse_incremental_unknown): New function.
12214         (General_options::General_options): Initialize new fields
12215         incremental_disposition_ and implicit_incremental_.
12216         (General_options::finalize): Check for uasge of --incremental-*
12217         without --incremental.
12218
12219 2009-02-06  Chris Demetriou  <cgd@google.com>
12220
12221         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12222         pointer and to report location as the file name associated with
12223         the symbol.
12224         (gold_undefined_symbol_at_location): New function to replace the
12225         old gold_undefined_symbol functionality.
12226         * target-reloc.h (relocate_section): Update to use
12227         gold_undefined_symbol_at_location.
12228         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12229         Call gold_undefined_symbol function rather than gold_error.
12230         * errors.h (Errors::undefined_symbol): Take location as a
12231         string, rather than calculating it from a relocation.
12232         * errors.cc (Errors::fatal): Print "fatal error:" before the
12233         formatted message.
12234         (Errors::error, Errors::error_at_location): Print "error: "
12235         before the formatted message.
12236         (Errors::undefined_symbol): Take location as a string, rather
12237         than calculating it from a relocation.
12238         (gold_undefined_symbol_at_location): New function akin to
12239         old gold_undefined_symbol, calculates location from relocation.
12240         (gold_undefined_symbol): Change to take only a Symbol pointer
12241         and to report location as the file name associated with the symbol.
12242         * testsuite/debug_msg.sh: Update for changed error messages.
12243         * testsuite/undef_symbol.sh: Likewise.
12244
12245 2009-02-04  Duncan Sands  <baldrick@free.fr>
12246
12247         PR 9812
12248         * reduced_debug_output.h
12249         (Output_reduced_debug_abbrev_section::failed): Use format for
12250         gold_warning.
12251         (Output_reduced_debug_info_section::faild): Likewise.
12252
12253 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12254
12255         * script.cc (Lazy_demangler): New class.
12256         (Version_script_info::get_symbol_version_helper): Demangle a
12257         symbol only once.
12258
12259 2009-01-29  Cary Coutant  <ccoutant@google.com>
12260
12261         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12262         to __tls_get_addr.
12263         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12264
12265 2009-01-28  Ian Lance Taylor  <iant@google.com>
12266
12267         * version.cc (version_string): Bump to 1.9.
12268
12269         * gold.h: Include <cstring> and <stdint.h>.
12270         * version.cc: Include <cstdio>.
12271         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12272         warning.
12273         * reduced_debug_output.cc (insert_into_vector): Rename from
12274         Insert_into_vector; change all callers.  Use Swap_unaligned to
12275         avoid aliasing issue; remove union since it is unnecessary.
12276
12277 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12278
12279         * Makefile.am (CCFILES): Add gc.cc.
12280         (HFILES): Add gc.h.
12281         * Makefile.in: Regenerate.
12282         * gold.cc (Gc_runner): New class.
12283         (queue_initial_tasks): Call garbage collection related tasks
12284         when corresponding options are invoked.
12285         (queue_middle_gc_tasks): New function.
12286         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12287         processed early before laying out sections during garbage collection.
12288         * gold.h (queue_middle_gc_tasks): New function.
12289         (is_prefix_of): Move from "layout.cc".
12290         * i386.cc (Target_i386::gc_process_relocs): New function.
12291         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12292         * main.cc (main): Create object of class "Garbage_collection".
12293         * object.cc (Relobj::copy_symbols_data): New function.
12294         (Relobj::is_section_name_included): New function.
12295         (Sized_relobj::do_layout): Allow this function to be called twice
12296         during garbage collection and defer layout of section during the
12297         first call.
12298         * object.h (Relobj::get_symbols_data): New function.
12299         (Relobj::is_section_name_included): New function.
12300         (Relobj::copy_symbols_data): New function.
12301         (Relobj::set_symbols_data): New function.
12302         (Relobj::get_relocs_data): New function.
12303         (Relobj::set_relocs_data): New function.
12304         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12305         (Relobj::gc_process_relocs): New function.
12306         (Relobj::do_gc_process_relocs): New pure virtual function.
12307         (Relobj::sd_): New data member.
12308         (Sized_relobj::is_output_section_offset_invalid): New function.
12309         (Sized_relobj::do_gc_process_relocs): New function.
12310         * options.h (General_options::gc_sections): Modify to not be a no-op.
12311         (General_options::print_gc_sections): New option.
12312         * plugin.cc (Plugin_finish::run): Remove function call to
12313         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12314         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12315         * reloc.cc (Read_relocs::run): Add task to process relocs and
12316         determine unreferenced sections when doing garbage collection.
12317         (Gc_process_relocs): New class.
12318         (Sized_relobj::do_gc_process_relocs): New function.
12319         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12320         sections that are garbage collected.
12321         * reloc.h (Gc_process_relocs): New class.
12322         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12323         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12324         symbols whose corresponding sections are garbage collected.
12325         (Symbol_table::Symbol_table): Add new parameter for the garbage
12326         collection object.
12327         (Symbol_table::gc_mark_undef_symbols): New function.
12328         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12329         (Symbol_table::gc_mark_dyn_syms): New function.
12330         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12331         as garbage.
12332         (Symbol_table::add_from_object): Likewise.
12333         (Symbol_table::add_from_relobj): When building shared objects, do not
12334         treat externally visible symbols as garbage.
12335         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12336         table information for static and relocatable links.
12337         * symtab.h (Symbol_table::set_gc): New function.
12338         (Symbol_table::gc): New function.
12339         (Symbol_table::gc_mark_undef_symbols): New function.
12340         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12341         (Symbol_table::gc_mark_dyn_syms): New function.
12342         (Symbol_table::gc_): New data member.
12343         * target.h (Sized_target::gc_process_relocs): New pure virtual
12344         function.
12345         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12346         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12347
12348 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12349
12350         * options.h (General_options::gc_sections): Define as a no-op for now.
12351         (General_options::no_keep_memory): Ditto.
12352         (General_options::Bshareable): Define.
12353         * options.cc (General_options::finalize): Honor -Bshareable.
12354
12355 2009-01-20  Andreas Schwab  <schwab@suse.de>
12356
12357         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12358         read the value in the contents, since we don't use it.  Use the
12359         template endianness when writing.
12360         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12361
12362 2009-01-19  Andreas Schwab  <schwab@suse.de>
12363
12364         * configure.tgt (powerpc64-*): Fix targ_obj.
12365
12366 2009-01-15  Ian Lance Taylor  <iant@google.com>
12367
12368         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12369         local symbols when stripping all symbols.
12370
12371 2009-01-14  Cary Coutant  <ccoutant@google.com>
12372
12373         * output.cc (Output_reloc): Add explicit instantiations.
12374
12375 2009-01-14  Cary Coutant  <ccoutant@google.com>
12376
12377         * archive.cc (Archive::get_elf_object_for_member): Remove call
12378         to File_read::claim_for_plugin.
12379         * descriptors.cc (Descriptors::open): Remove reference to
12380         is_claimed.
12381         (Descriptors::claim_for_plugin): Remove.
12382         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12383         (Descriptors::is_claimed): Remove.
12384         (claim_descriptor_for_plugin): Remove.
12385         * fileread.cc (File_read::claim_for_plugin): Remove.
12386         * fileread.h (File_read::claim_for_plugin): Remove.
12387         (File_read::descriptor): Reopen descriptor if necessary.
12388         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12389         (Plugin_manager::all_symbols_read): Add task parameter. Change
12390         all callers.
12391         (Plugin_manager::get_input_file): New function.
12392         (Plugin_manager::release_input_file): New function.
12393         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12394         corresponding data member.
12395         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12396         and pass to base constructor. Change all callers.
12397         (get_input_file, release_input_file): New functions.
12398         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12399         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12400         (Plugin_manager::all_symbols_read): Add task parameter.
12401         (Plugin_manager::get_input_file): New function.
12402         (Plugin_manager::release_input_file): New function.
12403         (Plugin_manager::task_): New data member.
12404         (Pluginobj::Pluginobj): Add filesize parameter.
12405         (Pluginobj::filename): New function.
12406         (Pluginobj::descriptor): New function.
12407         (Pluginobj::filesize): New function.
12408         (Pluginobj::filesize_): New data member.
12409         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12410         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12411         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12412
12413         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12414         with archive libraries.
12415         * testsuite/Makefile.in: Regenerate.
12416         * testsuite/plugin_test.c (struct sym_info): New type.
12417         (get_input_file, release_input_file): New static variables.
12418         (onload): Capture new transfer vector entries.
12419         (claim_file_hook): Stop reading at end of file according to filesize.
12420         Factor out parsing of readelf output into separate function.
12421         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12422         APIs and get the source file name from the symbol table.  Convert
12423         source file name to corresponding object file name.  Print info
12424         message when adding new input files.
12425         (parse_readelf_line): New function.
12426         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12427         * testsuite/plugin_test_2.sh: Likewise.
12428         * testsuite/plugin_test_3.sh: Likewise.
12429         * testsuite/plugin_test_4.sh: New test case.
12430
12431 2009-01-07  Ian Lance Taylor  <iant@google.com>
12432
12433         * version.cc (version_string): Bump to 1.8.
12434
12435 2008-12-23  Cary Coutant  <ccoutant@google.com>
12436
12437         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12438         * plugin.cc (Plugin_manager::finish): Rename as
12439         layout_deferred_objects.  Move cleanup to separate function.
12440         (Plugin_manager::cleanup): New function.
12441         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12442         separately.
12443         * plugin.h (Plugin_manager::finish): Rename as
12444         layout_deferred_objects.
12445         (Plugin_manager::cleanup): New function.
12446         (Plugin_manager::cleanup_done): New field.
12447
12448 2008-12-23  Cary Coutant  <ccoutant@google.com>
12449
12450         * plugin.cc (is_visible_from_outside): New function.
12451         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12452         so we don't return "IR only" status for exported symbols or -r links.
12453
12454         * testsuite/Makefile.am (plugin_test_3): New test case.
12455         * testsuite/Makefile.in: Regenerate.
12456         * testsuite/plugin_test_3.sh: New file.
12457
12458 2008-12-22  Cary Coutant  <ccoutant@google.com>
12459
12460         * object.cc (Sized_relobj::layout_section): New function.
12461         (Sized_relobj::do_layout): Defer layout of input sections until after
12462         plugin has provided replacement files.
12463         (Sized_relobj::do_layout_deferred_sections): New function.
12464         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12465         (Relobj::layout_deferred_sections): New function.
12466         (Relobj::do_layout_deferred_sections): New function.
12467         (Sized_relobj::do_layout_deferred_sections): New function.
12468         (Sized_relobj::layout_section): New function.
12469         (Sized_relobj::Deferred_layout): New structure.
12470         (Sized_relobj::deferred_layout_): New field.
12471         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12472         Change all callers.  Layout deferred sections.
12473         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12474         references.
12475         (Plugin_hook::run): Move code from do_plugin_hook inline.
12476         (Plugin_hook::do_plugin_hook): Remove.
12477         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12478         (Plugin_manager::finish): Renamed, was cleanup.
12479         (Plugin_manager::should_defer_layout): New function.
12480         (Plugin_manager::add_deferred_layout_object): New function.
12481         (Plugin_manager::Deferred_layout_list): New type.
12482         (Plugin_manager::deferred_layout_objects_): New field.
12483         (Plugin_hook::do_plugin_hook): Remove.
12484
12485 2008-12-17  Ian Lance Taylor  <iant@google.com>
12486
12487         * options.h (class General_options): Add --no case for
12488         --export-dynamic.
12489
12490 2008-12-16  Cary Coutant  <ccoutant@google.com>
12491
12492         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12493         vector.
12494         (Plugin_manager::claim_file): Create plugin object even if
12495         plugin did not call the add_symbols callback.
12496         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12497         asking for more symbols than were added.
12498         * testsuite/Makefile.am (plugin_test_1): Add test case with
12499         no global symbols.
12500         (empty.syms): New target.
12501         * testsuite/Makefile.in: Regenerate.
12502         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12503         message. Don't call add_symbols if no globals.
12504         (all_symbols_read_hook): Don't provide replacement for empty
12505         claimed file.
12506
12507 2008-12-12  Ian Lance Taylor  <iant@google.com>
12508
12509         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12510         r_type == 0 for a local symbol with r_sym == 0.
12511         (scan_relocatable_relocs): Pass r_sym to
12512         local_non_section_strategy.
12513         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12514         r_sym parameter.
12515
12516         * configure.ac: Update test for TLS descriptors: they are
12517         supported as of glibc 2.9.
12518         * configure: Rebuild.
12519
12520 2008-12-11  Ian Lance Taylor  <iant@google.com>
12521
12522         PR 7091
12523         * target-reloc.h (Default_scan_relocatable_relocs): For each
12524         function, map r_type == 0 to RELOC_DISCARD.
12525
12526 2008-12-10  Cary Coutant  <ccoutant@google.com>
12527
12528         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12529         object to override a kept COMDAT group from a plugin object.
12530
12531 2008-12-09  Ian Lance Taylor  <iant@google.com>
12532
12533         PR 7088
12534         * yyscript.y (file_cmd): Handle INPUT.
12535
12536         * testsuite/initpri1.c: Change all declarations to be full
12537         prototypes by adding void, to avoid compiler warnings.
12538
12539 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12540
12541         * options.cc (General_options::parse_plugin_opt): New.
12542         (General_options::add_plugin): The argument now is just the filename.
12543         (General_options::add_plugin_option): New.
12544         * options.h (plugin_opt): New.
12545         (add_plugin): Change argument name.
12546         (add_plugin_option): New.
12547         * plugin.cc (Plugin::load): Don't parse the plugin option.
12548         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12549         (Plugin::add_option): New.
12550         (Plugin::args_): Change type.
12551         (Plugin::filename_): New.
12552         (Plugin_manager::add_plugin_option): New.
12553         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12554         * testsuite/Makefile.in: Regenerate.
12555
12556 2008-12-05  Cary Coutant  <ccoutant@google.com>
12557
12558         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12559         Handle --strip-lto-sections option.
12560         * options.h (strip_lto_sections): New option.
12561
12562 2008-12-01  Cary Coutant  <ccoutant@google.com>
12563
12564         * plugin.cc (ld_plugin_message): Change format parameter to const.
12565         Fix mismatch between new[] and delete.
12566
12567 2008-11-14  Cary Coutant  <ccoutant@google.com>
12568
12569         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12570         instead of -1U.
12571
12572 2008-11-05  Craig Silverstein  <csilvers@google.com>
12573
12574         * options.cc (General_options::parse_dynamic_list): New function.
12575         * options.h (General_options): New flags dynamic_list,
12576         dynamic_list_data, dynamic_list_cpp_new, and
12577         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12578         (General_options::in_dynamic_list): New function.
12579         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12580         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12581         (Lex::can_continue_name): Likewise.
12582         (yylex): Likewise.
12583         (read_script_file): New parameter script_options.
12584         (read_dynamic_list): New function.
12585         (Script_options::define_dynamic_list): New function.
12586         (dynamic_list_keyword_parsecodes): New variable.
12587         (dynamic_list_keywords): New variable.
12588         * script.h (Script_options::define_dynamic_list): New function
12589         prototype.
12590         (read_dynamic_list): New function prototype.
12591         * symtab.cc (strprefix): New macro.
12592         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12593         dynamic_list_data, dynamic_list_cpp_new, and
12594         dynamic_list_cpp_typeinfo.
12595         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12596         (dynamic_list_expr): New rule.
12597         (dynamic_list_nodes): Likewise.
12598         (dynamic_list_node): Likewise.
12599         * testsuite/Makefile.am (dynamic_list): New test.
12600         * testsuite/Makefile.in: Regenerated.
12601         * testsuite/dynamic_list.t: New file.
12602         * testsuite/dynamic_list.sh: New file.
12603
12604 2008-11-05  Craig Silverstein  <csilvers@google.com>
12605
12606         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12607         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12608         (t11_last): Likewise.
12609         * testsuite/ver_test_6.c (main): Likewise.
12610
12611 2008-10-07  Cary Coutant  <ccoutant@google.com>
12612
12613         * options.c (General_options::finalize): Add check for -static and
12614         -shared.
12615         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12616         is not empty.
12617
12618 2008-10-02  Cary Coutant  <ccoutant@google.com>
12619
12620         * plugin.cc (make_sized_plugin_object): Fix conditional
12621         compilation to work when not all targets are enabled.
12622
12623 2008-09-29  Cary Coutant  <ccoutant@google.com>
12624
12625         * archive.cc (Archive::get_file_and_offset): Use filename instead
12626         of name to get library path.
12627         (Archive::include_member): Unlock external member of a thin archive.
12628
12629         * testsuite/Makefile.am (TEST_AR): New variable.
12630         (thin_archive_test_1): New test.
12631         (thin_archive_test_2): New test.
12632         * testsuite/Makefile.in: Regenerate.
12633         * testsuite/thin_archive_main.cc: New file.
12634         * testsuite/thin_archive_test_1.cc: New file.
12635         * testsuite/thin_archive_test_2.cc: New file.
12636         * testsuite/thin_archive_test_3.cc: New file.
12637         * testsuite/thin_archive_test_4.cc: New file.
12638
12639 2008-09-29  Cary Coutant  <ccoutant@google.com>
12640
12641         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12642         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12643         instead of -1U.
12644         (Sized_relobj::do_finalize_local_symbols): Likewise.
12645         (Sized_relobj::map_to_kept_section): Likewise.
12646         * object.h (Sized_relobj::invalid_address): New constant.
12647         (Sized_relobj::do_output_section_offset): Check for invalid_address
12648         and return -1ULL.
12649         * output.cc (Output_reloc::local_section_offset): Use constant
12650         invalid_address instead of -1U.
12651         (Output_reloc::get_address): Likewise.
12652         (Output_section::output_address): Change -1U to -1ULL.
12653         * output.h (Output_reloc::invalid_address): New constant.
12654         * reloc.cc (Sized_relobj::write_sections): Use constant
12655         invalid_address instead of -1U.
12656         (Sized_relobj::relocate_sections): Likewise.
12657         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12658         values for merge sections.
12659         * target-reloc.h (relocate_for_relocatable): Use constant
12660         invalid_address instead of -1U.
12661
12662 2008-09-19  Cary Coutant  <ccoutant@google.com>
12663
12664         Add plugin functionality for link-time optimization (LTO).
12665         * configure.ac (plugins): Add --enable-plugins option.
12666         * configure: Regenerate.
12667         * config.in: Regenerate.
12668         * Makefile.am (LIBDL): New variable.
12669         (CCFILES): Add plugin.cc.
12670         (HFILES): Add plugin.h.
12671         (ldadd_var): Add LIBDL.
12672         * Makefile.in: Regenerate.
12673
12674         * archive.cc: Include "plugin.h".
12675         (Archive::setup): Don't preread archive symbols when using a plugin.
12676         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12677         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12678         files.
12679         (Archive::include_member): Add symbols from plugin objects.
12680         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12681         * descriptors.cc (Descriptors::open): Check for file descriptors
12682         abandoned by plugins.
12683         (Descriptors::claim_for_plugin): New function.
12684         * descriptors.h (Descriptors::claim_for_plugin): New function.
12685         (Open_descriptor::is_claimed): New field.
12686         (claim_descriptor_for_plugin): New function.
12687         * fileread.cc (File_read::claim_for_plugin): New function.
12688         * fileread.h (File_read::claim_for_plugin): New function.
12689         (File_read::descriptor): New function.
12690         * gold.cc: Include "plugin.h".
12691         (queue_initial_tasks): Add task to call plugin hooks for generating
12692         new object files.
12693         * main.cc: Include "plugin.h".
12694         (main): Load plugin libraries.
12695         * object.h (Pluginobj): Declare.
12696         (Object::pluginobj): New function.
12697         (Object::do_pluginobj): New function.
12698         (Object::set_target): New function.
12699         * options.cc: Include "plugin.h".
12700         (General_options::parse_plugin): New function.
12701         (General_options::General_options): Initialize plugins_ field.
12702         (General_options::add_plugin): New function.
12703         * options.h (Plugin_manager): Declare.
12704         (General_options): Add --plugin option.
12705         (General_options::has_plugins): New function.
12706         (General_options::plugins): New function.
12707         (General_options::add_plugin): New function.
12708         (General_options::plugins_): New field.
12709         * plugin.cc: New file.
12710         * plugin.h: New file.
12711         * readsyms.cc: Include "plugin.h".
12712         (Read_symbols::do_read_symbols): Check for archive before checking
12713         for ELF file.  Call plugin hooks to claim files.
12714         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12715         from a real object file; force override when processing replacement
12716         files.
12717         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12718         (Symbol::init_base_object): Likewise.
12719         (Symbol::init_base_output_data): Likewise.
12720         (Symbol::init_base_output_segment): Likewise.
12721         (Symbol::init_base_constant): Likewise.
12722         (Symbol::init_base_undefined): Likewise.
12723         (Symbol::output_section): Assert that object is not a plugin.
12724         (Symbol_table::add_from_pluginobj): New function.
12725         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12726         undefined.
12727         (Symbol_table::sized_write_globals): Likewise.
12728         (Symbol_table::add_from_pluginobj): Instantiate template.
12729         * symtab.h (Sized_pluginobj): Declare.
12730         (Symbol::in_real_elf): New function.
12731         (Symbol::set_in_real_elf): New function.
12732         (Symbol::in_real_elf_): New field.
12733         (Symbol_table::add_from_pluginobj): New function.
12734
12735         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12736         (LIBDL): New variable.
12737         (LDADD): Add LIBDL.
12738         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12739         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12740         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12741         (MOSTLYCLEANFILES): Likewise.
12742         * testsuite/Makefile.in: Regenerate.
12743         * testsuite/plugin_test.c: New file.
12744         * testsuite/plugin_test_1.sh: New file.
12745         * testsuite/plugin_test_2.sh: New file.
12746
12747 2008-09-16  Ian Lance Taylor  <iant@google.com>
12748
12749         * target-reloc.h (relocate_section): Check whether a symbol is
12750         defined by the ABI before reporting an undefined symbol error.
12751         * target.h (Target::is_defined_by_abi): Make parameter const.
12752         (Target::do_is_defined_by_abi): Likewise.
12753         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12754         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12755         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12756         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12757         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12758         * testsuite/Makefile.in: Rebuild.
12759
12760         * fileread.cc (make_view): Add casts to avoid warning.
12761
12762 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12763
12764         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12765         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12766
12767 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12768
12769         * options.h (General_options::output_is_executable): New.
12770         (General_options::output_is_pie): New.
12771         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12772         for shared libraries.
12773         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12774
12775 2008-09-11  Chris Demetriou  <cgd@google.com>
12776
12777         * options.h (origin): New -z option.
12778         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12779         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12780         in DT_FLAGS_1.
12781
12782 2008-09-05  Cary Coutant  <ccoutant@google.com>
12783
12784         * fileread.cc (File_read::make_view): Add check for attempt to map
12785         beyond end of file.
12786
12787 2008-09-05  Cary Coutant  <ccoutant@google.com>
12788
12789         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12790         explicit instantiations.
12791
12792 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12793
12794         PR gold/6858
12795         * options.cc (General_options::finalize): Allow undefined symbols
12796         in shlibs if linking -shared.
12797
12798         PR gold/6859
12799         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12800         symbols as not needing a dynsym entry.
12801
12802 2008-08-20  Craig Silverstein  <csilvers@google.com>
12803
12804         * fileread.cc (File_read::open): Do not lock the file unless it
12805         was successfully opened.
12806
12807 2008-08-14  Cary Coutant  <ccoutant@google.com>
12808
12809         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12810         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12811         * testsuite/tls_test.cc (struct int128): 128-bit struct
12812         for testing TLS relocs with non-zero addend.
12813         (v12): New TLS variable.
12814         (t12): New test.
12815         (t_last): Add check for v12.
12816         * testsuite/tls_test.h (t12): New function.
12817         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12818
12819 2008-08-13  Ian Lance Taylor  <iant@google.com>
12820
12821         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12822         set tls_segment_ or relro_segment_.
12823         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12824         when appropriate.
12825         * output.h (Output_section::clear_is_relro): New function.
12826         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12827         sections specially even when output_data_ is empty.
12828         (Output_segment::maximum_alignment): When first section is relro,
12829         only force alignment for PT_LOAD segments.
12830         * script.cc (script_data_segment_align): New function.
12831         (script_data_segment_relro_end): New function.
12832         * script-c.h (script_data_segment_align): Declare.
12833         (script_data_segment_relro_end): Declare.
12834         * script-sections.h (class Script_sections): Declare
12835         data_segment_align and data_segment_relro_end.  Add fields
12836         segment_align_index_ and saw_relro_end_.
12837         * script-sections.cc (class Sections_element): Add set_is_relro
12838         virtual function.  Add new bool* parameter to place_orphan_here.
12839         Add get_output_section virtual function.
12840         (class Output_section_definition): Add set_is_relro.  Add new
12841         bool* parameter to place_orphan_here.  Add get_output_section.
12842         Add is_relro_ field.
12843         (Output_section_definition::Output_section_definition): Initialize
12844         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12845         and is_relro_ fields.
12846         (Output_section_definition::place_orphan_here): Add is_relro
12847         parameter.
12848         (Output_section_definition::set_section_addresses): Set relro for
12849         output section.
12850         (Output_section_definition::alternate_constraint): Likewise.
12851         (class Orphan_output_section): Add new bool* parameter to
12852         place_orphan_here.  Add get_output_section.
12853         (Orphan_output_section::place_orphan_here): Add is_relro
12854         parameter.
12855         (Script_sections::Script_sections): Initialize
12856         data_segment_align_index_ and saw_relro_end_.
12857         (Script_sections::data_segment_align): New function.
12858         (Script_sections::data_segment_relro_end): New function.
12859         (Script_sections::place_orphan): Set or clear is_relro.
12860         (Script_sections::set_section_addresses): Force alignment of first
12861         TLS section.
12862         * yyscript.y (exp): Call script_data_segment_align and
12863         script_data_segment_relro_end.
12864         * testsuite/relro_script_test.t: New file.
12865         * testsuite/relro_test.cc (using_script): Declare.
12866         (t1, t2): Test using_script.
12867         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12868         (relro_script_test_SOURCES): Define.
12869         (relro_script_test_DEPENDENCIES): Define.
12870         (relro_script_test_LDFLAGS): Define.
12871         (relro_script_test_LDADD): Define.
12872         (relro_script_test.so): New target.
12873         * testsuite/Makefile.in: Rebuild.
12874
12875 2008-08-06  Cary Coutant <ccoutant@google.com>
12876
12877         * archive.cc (Archive::total_archives, Archive::total_members)
12878         (Archive::total_members_loaded): New variables.
12879         (Archive::setup): Add parameter.  Add option to preread
12880         archive symbols.
12881         (Archive::read_armap): Add counter.
12882         (Archive::get_file_and_offset): New function.
12883         (Archive::get_elf_object_for_member): New function.
12884         (Archive::read_all_symbols): New function.
12885         (Archive::read_symbols): New function.
12886         (Archive::add_symbols): Add counters.
12887         (Archive::include_all_members): Use armap to find members if it's
12888         already built.
12889         (Archive::include_member): Skip reading symbols if already read.
12890         Factored code into Archive::get_file_and_offset and
12891         Archive::get_elf_object_for_member.  Changed call to
12892         Mapfile::report_include_archive_member.
12893         (Archive::print_stats): New function.
12894         * archive.h: Declare Object and Read_symbols_data classes.
12895         (Archive::Archive): Add initializers for new members.
12896         (Archive::setup): Add parameter.
12897         (Archive::print_stats): New function.
12898         (Archive::total_archives, Archive::total_members)
12899         (Archive::total_members_loaded): New variables.
12900         (Archive::get_file_and_offset): New function.
12901         (Archive::get_elf_object_for_member): New function.
12902         (Archive::read_all_symbols): New function.
12903         (Archive::read_symbols): New function.
12904         (Archive::Archive_member): New class.
12905         (Archive::members_): New member.
12906         (Archive::num_members_): New member.
12907         * main.cc: Include archive.h.
12908         (main): Call Archive::print_stats.
12909         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12910         archive parameter; member_name is now the fully-decorated name.
12911         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12912         * options.h: (General_options): Add --preread-archive-symbols option.
12913         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12914         Archive::setup.
12915
12916 2008-08-04  Ian Lance Taylor  <iant@google.com>
12917
12918         * symtab.h (Symbol::use_plt_offset): New function.
12919         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12920         * powerpc.cc (Relocate::relocate): Likewise.
12921         * sparc.cc (Relocate::relocate): Likewise.
12922         * x86_64.cc (Relocate::relocate): Likewise.
12923         * testsuite/weak_plt.sh: New test.
12924         * testsuite/weak_plt_main.cc: New test.
12925         * testsuite/weak_plt_shared.cc: New test.
12926         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12927         (check_PROGRAMS): Add weak_plt.
12928         (check_DATA): Add weak_plt_shared.so.
12929         (weak_plt_main_pic.o, weak_plt): New targets.
12930         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12931         * testsuite/Makefile.in: Rebuild.
12932
12933         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12934         gcctestdir/ld.
12935         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12936         * testsuite/Makefile.in: Rebuild.
12937
12938 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12939
12940         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12941         * Makefile.in: Regenerate.
12942         * po/POTFILES.in: Regenerate.
12943
12944 2008-07-29  Ian Lance Taylor  <iant@google.com>
12945
12946         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12947         symbols before other symbols.
12948         * testsuite/script_test_2.cc (test_addr): Declare.
12949         (test_addr_alias): Declare.
12950         (main): Check that test_addr and test_addr_alias have the right
12951         values.
12952         * testsuite/script_test_2.t: Define test_addr_alias and
12953         test_addr.
12954
12955 2008-07-24  Ian Lance Taylor  <iant@google.com>
12956
12957         PR 5990
12958         * descriptors.cc: New file.
12959         * descriptors.h: New file.
12960         * gold-threads.h (class Hold_optional_lock): New class.
12961         * fileread.cc: Include "descriptors.h".
12962         (File_read::~File_read): Release descriptor rather than closing
12963         it.
12964         (File_read::open) [file]: Call open_descriptor rather than open.
12965         Set is_descriptor_opened_.
12966         (File_read::open) [memory]: Assert that descriptor is not open.
12967         (File_read::reopen_descriptor): New function.
12968         (File_read::release): Release descriptor.
12969         (File_read::do_read): Make non-const.  Reopen descriptor.
12970         (File_read::read): Make non-const.
12971         (File_read::make_view): Reopen descriptor.
12972         (File_read::do_readv): Likewise.
12973         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12974         Update declarations.
12975         * layout.cc: Include "descriptors.h".
12976         (Layout::create_build_id): Use open_descriptor rather than open.
12977         * output.cc: Include "descriptors.h".
12978         (Output_file::open): Use open_descriptor rather than open.
12979         * archive.cc (Archive::const_iterator): Change Archive to be
12980         non-const.
12981         (Archive::begin, Archive::end): Make non-const.
12982         (Archive::count_members): Likewise.
12983         * archive.h (class Archive): Update declarations.
12984         * object.h (Object::read): Make non-const.
12985         * Makefile.am (CCFILES): Add descriptors.cc.
12986         (HFILES): Add descriptors.h.
12987         * Makefile.in: Rebuild.
12988
12989         PR 6716
12990         * gold.h: Always include <clocale>.  Add Solaris workarounds
12991         following code in binutils/sysdep.h.
12992
12993         PR 6048
12994         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12995         this->eh_frame_hdr_ is NULL before using it.
12996
12997         * dynobj.cc (Versions::Versions): Update comment.
12998
12999         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13000         the base version name.
13001
13002         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13003         array size plus one.
13004         (Stringpool_template::set_string_offsets): Subtract one from key
13005         before using it as an array index.
13006         (Stringpool_template::get_offset_with_length): Likewise.
13007         (Stringpool_template::write_to_buffer): Likewise.
13008         * stringpool.h (Stringpool_template::get_offset_from_key):
13009         Likewise.
13010
13011 2008-07-23  Ian Lance Taylor  <iant@google.com>
13012
13013         PR 6658
13014         * object.h (Merged_symbol_value::value): Do our best to handle a
13015         negative addend.
13016
13017         PR 6647
13018         * script.cc (Version_script_info::get_versions): Don't add empty
13019         version tag to return value.
13020         (Version_script_info::get_symbol_version_helper): Change return
13021         type to bool.  Add pversion parameter.  Change all callers.
13022         (script_register_vers_node): Don't require a non-NULL tag.
13023         * script.h (class Version_script_info): Update declarations.
13024         (Version_script_info::get_symbol_version): Change return type to
13025         bool.  Add version parameter.  Change all callers.
13026         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13027         handling.  Handle an empty version from a version script.
13028         (Symbol_table::define_special_symbol): Likewise.
13029         * testsuite/ver_test_10.script: New file.
13030         * testsuite/ver_test_10.sh: New file.
13031         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13032         (check_DATA): Add ver_test_10.syms.
13033         (ver_test_10.syms, ver_test_10.so): New target.
13034         * testsuite/Makefile.in: Rebuild.
13035
13036 2008-07-23  Simon Baldwin  <simonb@google.com>
13037
13038         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13039         to zero for undefined symbols from dynamic libraries.
13040
13041 2008-07-23  Ian Lance Taylor  <iant@google.com>
13042
13043         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13044         Change all callers.
13045         * symtab.h (class Symbol_table): Update declaration.
13046         * testsuite/ver_test_9.cc: New file.
13047         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13048         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13049         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13050         (ver_test_9.so, ver_test_9.o): New targets.
13051         * testsuite/Makefile.in: Rebuild.
13052
13053 2008-07-22  Ian Lance Taylor  <iant@google.com>
13054
13055         * options.h (class General_options): Define --check-sections.
13056         * layout.cc (Layout::set_segment_offsets): Handle
13057         --check-sections.
13058
13059         * options.h (class General_options): Define -n/--nmagic and
13060         -N/--omagic.
13061         * options.cc (General_options::finalize): For -n/--nmagic or
13062         -N/--omagic, set -static.
13063         * layout.cc (Layout::attach_allocated_section_to_segment): If
13064         -N/--omagic, don't put read-only and read-write sections in
13065         different segments.
13066         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13067         finding a read-only segment.
13068         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13069         don't set the minimum segment alignment to the common page size,
13070         and don't set the file offset to the address modulo the page size.
13071         * script-sections.cc (Script_sections::create_segments): If
13072         -n/--omagic, don't put read-only and read-write sections in
13073         different segments.
13074
13075         * cref.cc: New file.
13076         * cref.h: New file.
13077         * options.h (class General_options): Add --print-symbol-counts.
13078         * main.cc (main): Issue defined symbol report if requested.
13079         * archive.cc (Archive::interpret_header): Make into a const member
13080         function.
13081         (Archive::add_symbols): Call Input_objects::archive_start and
13082         archive_stop.
13083         (Archive::const_iterator): Define new class.
13084         (Archive::begin, Archive::end): New functions.
13085         (Archive::include_all_members): Rewrite to use iterator.
13086         (Archive::count_members): New function.
13087         * archive.h (class Archive): Update declarations.
13088         (Archive::filename): New function.
13089         * object.cc: Include "cref.h".
13090         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13091         (Sized_relobj::do_get_global_symbol_counts): New function.
13092         (Input_objects::add_object): Add object to cross-referencer.
13093         (Input_objects::archive_start): New function.
13094         (Input_objects::archive_stop): New function.
13095         (Input_objects::print_symbol_counts): New function.
13096         * object.h: Declare Cref and Archive.
13097         (Object::get_global_symbol_counts): New function.
13098         (Object::do_get_global_symbol_counts): New pure virtual function.
13099         (class Sized_relobj): Add defined_count_ field.  Update
13100         declarations.
13101         (class Input_objects): Add cref_ field.  Update constructor.
13102         Update declarations.
13103         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13104         defined_count_.
13105         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13106         symbol counts.
13107         (Sized_dynobj::do_get_global_symbol_counts): New function.
13108         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13109         defined_count_.  Update declarations.  Define Symbols typedef.
13110         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13111         parameter.  Change all callers.
13112         (Symbol_table::add_from_dynobj): Add sympointers and defined
13113         parameters.  Change all callers.
13114         * symtab.h (class Symbol_table): Update declarations.
13115         * Makefile.am (CCFILES): Add cref.cc.
13116         (HFILES): Add cref.h.
13117         * Makefile.in: Rebuild.
13118
13119 2008-07-22  Simon Baldwin  <simonb@google.com>
13120
13121         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13122         to zero when writing undefined symbols.
13123
13124 2008-07-22  Ian Lance Taylor  <iant@google.com>
13125
13126         * output.cc (Output_section::add_input_section): Don't try to
13127         merge empty merge sections.
13128
13129 2008-07-21  Craig Silverstein  <csilvers@google.com>
13130
13131         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13132         Include symbol version in error message.
13133
13134 2008-07-20  Chris Demetriou  <cgd@google.com>
13135
13136         * configure.ac (gold_cv_c_random_seed): New configured variable.
13137         (RANDOM_SEED_CFLAGS): New substituted variable.
13138         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13139         * configure: Rebuild.
13140         * Makefile.in: Likewise.
13141         * testsuite/Makefile.in: Likewise.
13142
13143 2008-07-18  Ian Lance Taylor  <iant@google.com>
13144
13145         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13146         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13147         * testsuite/ver_test_main.cc (main): Call t4.
13148         (t4, t4_2a): Define.
13149         * testsuite/ver_test_2.cc (t4_2): Define.
13150         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13151         * testsuite/ver_test_4.cc (t4_2a): Define.
13152         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13153         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13154
13155 2008-07-17  Ian Lance Taylor  <iant@google.com>
13156
13157         * dynobj.cc (Versions::add_def): If we give an error about a
13158         missing version, go ahead and create the version anyhow.
13159
13160 2008-07-10  Ian Lance Taylor  <iant@google.com>
13161
13162         Handle output sections with more than 0x7fffffff bytes.
13163         * object.h (class Relobj): Change map_to_output_ to
13164         output_sections_, and just keep a section pointer.  Change all
13165         uses.  Move comdat group support to Sized_relobj.
13166         (Relobj::is_section_specially_mapped): Remove.
13167         (Relobj::output_section): Remove poff parameter.  Change all
13168         callers.
13169         (Relobj::output_section_offset): New function.
13170         (Relobj::set_section_offset): Rewrite.
13171         (Relobj::map_to_output): Remove.
13172         (Relobj::output_sections): New function.
13173         (Relobj::do_output_section_offset): New pure virtual function.
13174         (Relobj::do_set_section_offset): Likewise.
13175         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13176         group support from Relobj.  Update declarations.
13177         (Sized_relobj::get_output_section_offset): New function.
13178         (Sized_relobj::do_output_section_offset): New function.
13179         (Sized_relobj::do_set_section_offset): New function.
13180         * object.cc (Relobj::output_section_address): Remove.
13181         (Sized_relobj::Sized_relobj): Initialize new fields.
13182         (Sized_relobj::include_section_group): Cast find_kept_object to
13183         Sized_relobj.
13184         (Sized_relobj::include_linkonce_section): Likewise.
13185         (Sized_relobj::do_layout): Use separate arrays for output section
13186         and output offset.
13187         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13188         output_sections.
13189         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13190         output_sections and section_offsets.
13191         (Sized_relobj::write_local_symbols): Likewise.
13192         (map_to_kept_section): Compute output address directly.
13193         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13194         output_sections and section_offsets.
13195         (Sized_relobj::write_sections): Likewise.
13196         (Sized_relobj::relocate_sections): Likewise.
13197         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13198         * output.h (class Output_reloc): Update declarations.  Change
13199         u2_.relobj to Sized_relobj*.
13200         (class Output_data_reloc): Change add functions to use
13201         Sized_relobj*.
13202         * output.cc (Output_reloc::Output_reloc): Change relobj to
13203         Sized_relobj*.
13204         (Output_reloc::local_section_offset): Change return type to
13205         Elf_Addr.  Use get_output_section_offset.
13206         (Output_reloc::get_address): Likewise.
13207         (Output_section::is_input_address_mapped): Don't call
13208         is_section_specially_mapped.
13209         (Output_section::output_offset): Likewise.
13210         (Output_section::output_address): Likewise.
13211         (Output_section::starting_output_address): Likewise.
13212         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13213         parameter to Sized_relobj*.
13214         (Copy_relocs::need_copy_reloc): Likewise.
13215         (Copy_relocs::save): Likewise.
13216         * copy-relocs.h (class Copy_relocs): Update declarations.
13217         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13218         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13219         * target-reloc.h (relocate_for_relocatable): Change
13220         offset_in_output_section type to Elf_Addr.  Change code that uses
13221         it as well.
13222         * layout.cc (Layout::layout): Always set *off.
13223         * mapfile.cc (Mapfile::print_input_section): Use
13224         output_section_offset.
13225         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13226         Sized_relobj*.
13227         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13228         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13229         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13230
13231 2008-07-03  Ian Lance Taylor  <iant@google.com>
13232
13233         * layout.cc (Layout::include_section): Do not discard unrecognized
13234         SHT_STRTAB sections.
13235
13236 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13237
13238         * script.cc (Lex::can_continue_name): Make '?' allowable in
13239         version-script names.
13240         * testsuite/version_script.map: Change glob pattern to use '?'
13241
13242 2008-06-30  Manish Singh  <yosh@gimp.org>
13243
13244         PR 6585
13245         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13246         Correct typo.
13247
13248 2008-06-30  Ian Lance Taylor  <iant@google.com>
13249
13250         PR 6660
13251         PR 6682
13252         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13253         versions]: Don't try to read the value in the contents, since we
13254         don't use it.  Use the template endianness when writing.
13255
13256 2008-06-25  Cary Coutant  <ccoutant@google.com>
13257
13258         * fileread.cc (File_read::make_view): Assert on zero-length view.
13259         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13260         symbol table when there are no symbols to read.
13261
13262 2008-06-23  Craig Silverstein  <csilvers@google.com>
13263
13264         * version.cc (version_string): Bump to 1.7
13265
13266 2008-06-18  Craig Silverstein  <csilvers@google.com>
13267
13268         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13269         constant 0xFFFF to type Valtype.
13270         (Powerpc_relocate_functions::rel16_ha): Likewise.
13271
13272 2008-06-17  Ian Lance Taylor  <iant@google.com>
13273
13274         * output.h (Output_section::Input_section): Initialize p2align_ to
13275         zero for Output_section_data constructors.
13276         (Output_section::Input_section::addralign): If not an input
13277         section, return the alignment of the Output_section_data.
13278         * testsuite/copy_test.cc: New file.
13279         * testsuite/copy_test_1.cc: New file.
13280         * testsuite/copy_test_2.cc: New file.
13281         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13282         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13283         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13284         (copy_test_1_pic.o, copy_test_1.so): New targets.
13285         (copy_test_2_pic.o, copy_test_2.so): New targets.
13286         * testsuite/Makefile.in: Rebuild.
13287
13288         * script-sections.cc (Script_sections::place_orphan): Initialize
13289         local variable exact.
13290
13291 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13292
13293         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13294
13295 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13296             David S. Miller  <davem@davemloft.net>
13297
13298         * powerpc.cc: New file.
13299         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13300         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13301         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13302         * Makefile.in: Rebuild.
13303
13304 2008-06-09  Ian Lance Taylor  <iant@google.com>
13305
13306         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13307         <exception>.
13308         (throwing, orig_terminate): New static variables.
13309         (terminate_handler): New static function.
13310         (t2): Set terminate handler.
13311
13312 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13313
13314         PR 6584
13315         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13316         alignment.
13317
13318 2008-05-30  Cary Coutant  <ccoutant@google.com>
13319
13320         * archive.cc (Archive::include_all_members) Correct to step
13321         over symbol table and extended name table in thin archives.
13322
13323 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13324
13325         PR 6407
13326         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13327         calculation.
13328
13329 2008-05-28  Caleb Howe  <cshowe@google.com>
13330
13331         * reduced_debug_output.cc: New file.
13332         * reduced_debug_output.h: New file.
13333         * options.h (class General_options): Add --strip-debug-non-line.
13334         * options.cc (General_options::finalize): Add strip_debug_non_line
13335         to the strip heirarchy.
13336         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13337         fields.
13338         * layout.cc: Include "reduced_debug_output.h".
13339         (Layout::Layout): Initialize new fields.
13340         (line_only_debug_sections): New static array.
13341         (is_lines_only_debug_sections): New static inline function.
13342         (Layout::include_section): Handle --strip-debug-non-line.
13343         (Layout::make_output_section): If --strip-debug-non-line, build
13344         new output sections for .debug_abbrev and .debug_info.
13345         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13346         gold.  Warn about possible overflow.
13347         (read_signed_LEB_128): Likewise.
13348         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13349         (read_signed_LEB_128): Declare.
13350         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13351         (HFILES): Add reduced_debug_output.h.
13352         * Makefile.in: Rebuild.
13353
13354 2008-05-21  Ian Lance Taylor  <iant@google.com>
13355
13356         * mapfile.cc: New file.
13357         * mapfile.h: New file.
13358         * options.h (class General_options): Add -M/--print-map and -Map.
13359         * options.cc (General_options::finalize): Make -M equivalent to
13360         -Map -.
13361         * main.cc: Include <cstdio> and "mapfile.h".
13362         (main): Open mapfile if requested.
13363         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13364         constructor.  Change caller.
13365         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13366         (queue_middle_tasks): Likewise.
13367         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13368         declarations.
13369         * archive.cc: Include "mapfile.h".
13370         (Archive::add_symbols): Add mapfile parameter.  Change all
13371         callers.  Pass mapfile, symbol, and reason to include_member.
13372         (Archive::include_all_members): Add mapfile parameter.  Change all
13373         callers.
13374         (Archive::include_member): Add mapfile, sym, and why parameters.
13375         Change all callers.  Report inclusion to map file.
13376         * archive.h: Include "fileread.h".
13377         (class Archive): Update declarations.
13378         (Archive::file): New const method.
13379         (class Add_archive_symbols): Add mapfile_ field.  Update
13380         constructor.  Change all callers.
13381         * readsyms.h (class Read_symbols): Likewise.
13382         (class Finish_group): Likewise.
13383         (class Read_script): Likewise.
13384         * common.cc: Include "mapfile.h".
13385         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13386         all callers.
13387         (Symbol_table::do_allocate_commons): Likewise.
13388         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13389         symbol allocation to mapfile.
13390         * common.h (class Allocate_commons_task): Add mapfile_ field.
13391         Update constructor.  Change all callers.
13392         * symtab.h (class Symbol_table): Update declarations.
13393         * layout.cc: Include "mapfile.h".
13394         (Layout_task_runner::run): Print information to mapfile.
13395         (Layout::create_gold_note): Change Output_data_fixed_space to
13396         Output_data_zero_fill.
13397         (Layout::create_build_id): Likewise.
13398         (Layout::print_to_mapfile): New function.
13399         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13400         constructor.  Change caller.
13401         (class Layout): Declare print_to_mapfile.
13402         * output.cc (Output_section::Input_section::print_to_mapfile): New
13403         function.
13404         (Output_section::add_input_section): If producing a map, always
13405         add to input_sections_ list.
13406         (Output_section::do_print_to_mapfile): New function.
13407         (Output_segment::print_sections_to_mapfile): New function.
13408         (Output_segment::print_section_list_to_mapfile): New function.
13409         * output.h: Include "mapfile.h".
13410         (Output_data::print_to_mapfile): New function.
13411         (Output_data::do_print_to_mapfile): New virtual function.
13412         (Output_segment_headers::do_print_to_mapfile): New function.
13413         (Output_file_header::do_print_to_mapfile): New function.
13414         (Output_data_const::do_print_to_mapfile): New function.
13415         (class Output_data_const_buffer): Add map_name_ field.  Update
13416         constructor.  Change all callers.  Add do_print_to_mapfile
13417         function.
13418         (class Output_data_fixed_space): Likewise.
13419         (class Output_data_space): Likewise.
13420         (class Output_data_zero_fill): New class.
13421         (Output_data_strtab::do_print_to_mapfile): New function.
13422         (Output_data_reloc_base::do_print_to_mapfile): New function.
13423         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13424         (Output_data_group::do_print_to_mapfile): New function.
13425         (Output_data_got::do_print_to_mapfile): New function.
13426         (Output_data_dynamic::do_print_to_mapfile): New function.
13427         (Output_symtab_xindex::do_print_to_mapfile): New function.
13428         (class Output_section): Declare do_print_to_mapflie.  Declare
13429         print_to_mapfile in Input_section.
13430         (class Output_segment): Declare new functions.
13431         * object.h (Sized_relobj::symbol_count): New function.
13432         * script-sections.cc
13433         (Output_section_element_dot_assignment::set_section_addresses):
13434         Change Output_data_fixed_space to Output_data_zero_fill.
13435         (Output_data_expression::do_print_to_mapfile): New function.
13436         * script.cc (read_input_script): Add mapfile parameter.  Change
13437         all callers.
13438         * script.h (read_input_script): Update declaration.
13439         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13440         (Eh_frame::do_print_to_mapfile): New function.
13441         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13442         (Output_merge_string::do_print_to_mapfile): New function.
13443         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13444         function.
13445         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13446         function.
13447         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13448         function.
13449         * Makefile.am (CCFILES): Add mapfile.cc.
13450         (HFILES): Add mapfile.h.
13451         * Makefile.in: Rebuild.
13452
13453 2008-05-19  Ian Lance Taylor  <iant@google.com>
13454
13455         * options.h (class General_options): Add -z relro.
13456         * layout.cc (Layout::Layout): Initialize relro_segment_.
13457         (Layout::add_output_section_data): Return the output section.
13458         (Layout::make_output_section): Rcognize relro sections and mark
13459         them appropriately.
13460         (Layout::attach_allocated_section_to_segment): Put relro sections
13461         in a PT_GNU_RELRO segment.
13462         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13463         section as relro.
13464         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13465         PT_TLS segments.
13466         (Layout::linkonce_mapping): Map d.rel.ro.local to
13467         .data.rel.ro.local.
13468         (Layout::output_section_name): Us .data.rel.ro.local for any
13469         section which begins with that.
13470         * layout.h (class Layout): Update add_output_section_data
13471         declaration.  Add relro_segment_ field.
13472         * output.cc (Output_section::Output_section): Initialize is_relro_
13473         and is_relro_local_ fields.
13474         (Output_segment::add_output_section): Group relro sections.
13475         (Output_segment::is_first_section_relro): New function.
13476         (Output_segment::maximum_alignment): If there is a relro section,
13477         align the segment to the common page size.
13478         (Output_segment::set_section_addresses): Track whether we are
13479         looking at relro sections.  If the last section is a relro
13480         section, align to the common page size.
13481         (Output_segment::set_section_list_addresses): Add in_relro
13482         parameter.  Change all callers.  Align to the page size when
13483         moving from relro to non-relro section.
13484         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13485         segment.
13486         * output.h (class Output_section): Add is_relro_ and
13487         is_relro_local_ fields.
13488         (Output_section::is_relro): New function.
13489         (Output_section::set_is_relro): New function.
13490         (Output_section::is_relro_local): New function.
13491         (Output_section::set_is_relro_local): New function.
13492         (class Output_segment): Update declarations.
13493         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13494         * sparc.cc (Target_sparc::got_section): Likewise.
13495         * x86_64.cc (Target_x86_64::got_section): Likewise.
13496         * testsuite/relro_test_main.cc: New file.
13497         * testsuite/relro_test.cc: New file.
13498         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13499         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13500         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13501         (relro_test.so, relro_test_pic.o): New targets.
13502         * testsuite/Makefile.in: Rebuild.
13503
13504 2008-05-16  Ian Lance Taylor  <iant@google.com>
13505
13506         * output.cc (Output_segment::add_output_section): Remove front
13507         parameter.
13508         * output.h (class Output_segment): Remove
13509         add_initial_output_section and overloaded add_output_section.
13510         Update declaration of remaining add_output_section.
13511         * layout.cc (Layout::create_interp): Call add_output_section
13512         rather than add_initial_output_section.
13513         (Layout::finish_dynamic_section): Likewise.
13514
13515         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13516         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13517         know the dynamic type.
13518         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13519         field.  Initialize it in constructor.
13520         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13521         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13522         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13523         reloc.
13524
13525         * output.cc (Output_reloc::get_address): Change return type to
13526         Elf_Addr.
13527         * output.h (class Output_reloc): Update get_address declaration.
13528         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13529         for section addresses.
13530
13531 2008-05-09  Ian Lance Taylor  <iant@google.com>
13532
13533         PR 6493
13534         * gold.cc (gold_nomem): Use return value of write.
13535
13536 2008-05-08  Ian Lance Taylor  <iant@google.com>
13537
13538         * symtab.c (Symbol::init_base_output_data): Add version
13539         parameter.  Change all callers.
13540         (Symbol::init_base_output_segment): Likewise.
13541         (Symbol::init_base_constant): Likewise.
13542         (Symbol::init_base_undefined): Likewise.
13543         (Sized_symbol::init_output_data): Likewise.
13544         (Sized_symbol::init_output_segment): Likewise.
13545         (Sized_symbol::init_constant): Likewise.
13546         (Sized_symbol::init_undefined): Likewise.
13547         (Symbol_table::do_define_in_output_data): If the new symbol has a
13548         version, mark it as the default.
13549         (Symbol_table::do_define_in_output_segment): Likewise.
13550         (Symbol_table::do_define_as_constant): Likewise.
13551         * symtab.h (class Symbol): Update declarations.
13552         (class Sized_symbol): Likewise.
13553         * resolve.cc (Symbol::override_version): New function.
13554         (Symbol::override_base): Call override_version.
13555         (Symbol::override_base_with_special): Likewise.
13556         * testsuite/ver_script_8.script: New file.
13557         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13558         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13559         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13560         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13561
13562 2008-05-06  Ian Lance Taylor  <iant@google.com>
13563
13564         PR 6049
13565         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13566         functions.
13567         (class General_options): Remove existing --undefined, and add
13568         --no-undefined instead.  Add new --undefined as synonym for -u.
13569         * archive.cc (Archive::add_symbols): Check whether symbol was
13570         named with -u.
13571         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13572         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13573         all uses.  Add IS_UNDEFINED.  Update declarations to split
13574         different versions of init_base.  Declare init_base_undefined.
13575         (Symbol::is_defined): Handle IS_UNDEFINED.
13576         (Symbol::is_undefined): Likewise.
13577         (Symbol::is_weak_undefined): Call is_undefined.
13578         (Symbol::is_absolute): Handle IS_CONSTANT.
13579         (class Sized_symbol): Update declarations to split different
13580         versions of init.  Declare init_undefined.
13581         (class Symbol_table): Declare new functions.
13582         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13583         Change all callers.
13584         (Symbol::init_base_output_data): Likewise.
13585         (Symbol::init_base_output_segment): Likewise.
13586         (Symbol::init_base_constant): Likewise.
13587         (Symbol::init_base_undefined): New function.
13588         (Sized_symbol::init_object): Rename from init.  Change all
13589         callers.
13590         (Sized_symbol::init_output_data): Likewise.
13591         (Sized_symbol::init_output_segment): Likewise.
13592         (Sized_symbol::init_constant): Likewise.
13593         (Sized_symbol::init_undefined): New function.
13594         (Symbol_table::add_undefined_symbols_from_command_line): New
13595         function.
13596         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13597         function.
13598         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13599         (Symbol::output_section): Likewise.
13600         (Symbol::set_output_section): Likewise.
13601         (Symbol_table::sized_finalize_symbol): Likewise.
13602         (Symbol_table::sized_write_globals): Likewise.
13603         * resolve.cc (Symbol_table::should_override): Likewise.
13604         (Symbol::override_base_with_special): Likewise.
13605
13606         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13607         symbol, change it to have default visibility.
13608         * testsuite/protected_1.cc: New file.
13609         * testsuite/protected_2.cc: New file.
13610         * testsuite/protected_3.cc: New file.
13611         * testsuite/protected_main_1.cc: New file.
13612         * testsuite/protected_main_2.cc: New file.
13613         * testsuite/protected_main_3.cc: New file.
13614         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13615         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13616         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13617         (protected_1.so): New target.
13618         (protected_1_pic.o, protected_2_pic.o): New targets.
13619         (protected_3_pic.o): New target.
13620         (check_PROGRAMS): Add protected_2.
13621         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13622         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13623         * testsuite/Makefile.in: Rebuild.
13624
13625         * options.h (DEFINE_var): Add set_user_set_##varname__.
13626         (DEFINE_bool_alias): New macro.
13627         (class General_options): Define -Bstatic using DEFINE_bool_alias
13628         rather than DEFINE_special.  Add --undefined as an alias for -z
13629         defs.
13630         * options.cc (General_options::parse_Bstatic): Remove.
13631
13632         * options.h (class General_options): Add --fatal-warnings.
13633         * main.cc (main): Implement --fatal-warnings.
13634         * errors.h (Errors::warning_count): New function.
13635
13636         * options.h (class General_options): Add -Bsymbolic-functions.
13637         * symtab.h (Symbol::is_preemptible): Check for
13638         -Bsymbolic-functions.
13639
13640 2008-05-05  Ian Lance Taylor  <iant@google.com>
13641
13642         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13643         as noVARNAME rather than no-VARNAME.
13644         (class General_options): Add option -z combreloc.
13645         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13646         get_address.
13647         (Output_reloc::sort_before) [SHT_REL]: New function.
13648         (Output_reloc::sort_before) [SHT_RELA]: New function.
13649         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13650         Sort_relocs_comparison.
13651         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13652         parameter.  Change all callers.
13653         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13654         sort_relocs parameter.  Change all callers.
13655         * output.cc (Output_reloc::get_address): New function, broken out
13656         of write_rel.
13657         (Output_reloc::write_rel): Call it.
13658         (Output_reloc::compare): New function.
13659         (Output_data_reloc_base::do_write): Optionally sort relocs.
13660
13661         * configure.ac: If targ_extra_obj is set, link it in.
13662         * configure.tgt: Initialize all variables.
13663         (x86_64*): Set targ_extra_obj and targ_extra_size.
13664         * configure: Rebuild.
13665
13666         * object.cc (Sized_relobj::include_section_group): Adjust section
13667         indexes read from group data.  Build vector to pass to
13668         layout_group.
13669         * layout.cc (Layout::layout_group): Add flags and shndxes
13670         parameters.  Remove contents parameter.  Change caller.  Update
13671         explicit instantiations.
13672         * layout.h (class Layout): Update layout_group declaration.
13673         * output.cc (Output_data_group::Output_data_group): Add flags and
13674         input_shndxes parameters.  Remove contents parameter.  Change
13675         caller.
13676         (Output_data_group::do_write): Change input_sections_ to
13677         input_shndxes_.
13678         * output.h (class Output_data_group): Update constructor
13679         declaration.  Rename input_sections_ to input_shndxes_.
13680         * testsuite/many_sections_test.cc: Add template.
13681
13682 2008-04-30  Cary Coutant  <ccoutant@google.com>
13683
13684         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13685
13686         * layout.cc (Layout::include_section): Refactored check for debug
13687         info section.
13688         (Layout::add_comdat): Add new parameters.  Change type
13689         of signature parameter.  Add object and shndx to signatures table.
13690         (Layout::find_kept_object): New function.
13691         * layout.h: Include <cstring>.
13692         (Layout::is_debug_info_section): New function.
13693         (Layout::add_comdat): Add new parameters.
13694         (Layout::find_kept_object): New function.
13695         (Layout::Kept_section): New struct.
13696         (Layout::Signatures): Change type of map range.
13697         * object.cc (Relobj::output_section_address): New function.
13698         (Sized_relobj::include_section_group): Add new parameters.  Change
13699         calls to Layout::add_comdat.  Change to build table of kept comdat
13700         groups and table mapping discarded sections to kept sections.
13701         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13702         (Sized_relobj::do_layout): Change calls to include_section_group and
13703         include_linkonce_section.
13704         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13705         value to zero when section is discarded.
13706         (Sized_relobj::map_to_kept_section): New function.
13707         * object.h (Relobj::output_section_address): New function.
13708         (Relobj::Comdat_group): New type.
13709         (Relobj::find_comdat_group): New function.
13710         (Relobj::Comdat_group_table): New type.
13711         (Relobj::Kept_comdat_section): New type.
13712         (Relobj::Kept_comdat_section_table): New type.
13713         (Relobj::add_comdat_group): New function.
13714         (Relobj::set_kept_comdat_section): New function.
13715         (Relobj::get_kept_comdat_section): New function.
13716         (Relobj::comdat_groups_): New field.
13717         (Relobj::kept_comdat_sections_): New field.
13718         (Symbol_value::input_value): Update comment.
13719         (Sized_relobj::map_to_kept_section) New function.
13720         (Sized_relobj::include_linkonce_section): Add new parameter.
13721         * target-reloc.h (Comdat_behavior): New type.
13722         (get_comdat_behavior): New function.
13723         (relocate_section): Add code to map a discarded section to the
13724         corresponding kept section when applying a relocation.
13725
13726 2008-04-30  Craig Silverstein  <csilvers@google.com>
13727
13728         * dwarf_reader.cc (next_generation_count): New static var.
13729         (Addr2line_cache_entry): New struct.
13730         (addr2line_cache): New static var.
13731         (Dwarf_line_info::one_addr2line): Added caching.
13732         (Dwarf_line_info::clear_addr2line_cache): New function.
13733         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13734         cache-size parameter.
13735         (Dwarf_line_info::one_addr2line_cache): New function.
13736         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13737         new cache-size argument to one_addr2line(), and clear cache.
13738
13739 2008-04-28  Cary Coutant  <ccoutant@google.com>
13740
13741         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13742         R_386_PC8 relocations.
13743
13744 2008-04-23  Ian Lance Taylor  <iant@google.com>
13745
13746         * object.cc (Sized_relobj::include_section_group): Check for
13747         invalid section group.
13748
13749         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13750         header size.
13751
13752         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13753         than read for file header.
13754         * archive.cc (Archive::include_member): Likewise.
13755
13756 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13757
13758         * aclocal.m4: Regenerate.
13759         * configure: Regenerate.
13760
13761 2008-04-19  Ian Lance Taylor  <iant@google.com>
13762
13763         * version.cc (version_string): Bump to 1.6.
13764
13765         * testsuite/Makefile.am (many_sections_r_test): New target.
13766         (many_sections_r_test_SOURCES): Remove.
13767         (many_sections_r_test_DEPENDENCIES): Remove.
13768         (many_sections_r_test_LDFLAGS): Remove.
13769         (many_sections_r_test_LDADD): Remove.
13770
13771         * object.cc (Sized_relobj::do_add_symbols): Always pass
13772         local_symbol_count_ to add_from_relobj.
13773
13774         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13775         every thousand variables.
13776         * testsuite/Makefile.in: Rebuild.
13777
13778         * object.cc (Xindex::initialize_symtab_xindex): New function.
13779         (Xindex::read_symtab_xindex): New function.
13780         (Xindex::sym_xindex_to_shndx): New function.
13781         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13782         available.
13783         (Sized_relobj::do_initialize_xindex): New function.
13784         (Sized_relobj::do_read_symbols): Adjust section links.
13785         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13786         parameter.  Change all callers.
13787         (Sized_relobj::include_section_group): Adjust section links and
13788         symbol section indexes.
13789         (Sized_relobj::do_layout): Adjust section links.
13790         (Sized_relobj::do_count_local_symbols): Adjust section links and
13791         symbol section indexes.
13792         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13793         ordinary and special symbols.
13794         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13795         dynsym_xindex parameters.  Change all callers.  Adjust section
13796         links.  Use SHN_XINDEX when needed.
13797         (Sized_relobj::get_symbol_location_info): Adjust section links.
13798         Don't get fooled by special symbols.
13799         * object.h (class Xindex): Define.
13800         (class Object): Add xindex_ parameter.  Declare virtual functoin
13801         do_initialize_xindex.
13802         (Object::adjust_sym_shndx): New function.
13803         (Object::set_xindex): New protected function.
13804         (class Symbol_value): Add is_ordinary_shndx_ field.
13805         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13806         (Symbol_value::value): Assert ordinary section.
13807         (Symbol_value::initialize_input_to_output_map): Likewise.
13808         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13809         Change all callers.
13810         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13811         all callers.
13812         (class Sized_relobj): Update declarations.
13813         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13814         parameter.  Change all callers.
13815         (Sized_relobj::adjust_shndx): New function.
13816         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13817         field.
13818         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13819         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13820         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13821         (Sized_dynobj::read_dynsym_section): Adjust section links.
13822         (Sized_dynobj::read_dynamic): Likewise.
13823         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13824         section links.
13825         (Sized_dynobj::do_initialize_xindex): New function.
13826         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13827         do_initialize_xindex.
13828         (Sized_dynobj::adjust_shndx): New function.
13829         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13830         dynsym_xindex_ fields.
13831         (Layout::finalize): Add a call to set_section_indexes before
13832         creating the symtab sections.
13833         (Layout::set_section_indexes): Don't do anything if the section
13834         already has a section index.
13835         (Layout::create_symtab_sections): Add shnum parameter.  Change
13836         caller.  Create .symtab_shndx section if needed.
13837         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13838         caller.
13839         (Layout::allocated_output_section_count): New function.
13840         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13841         needed.
13842         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13843         fields.  Update declarations.
13844         (Layout::symtab_xindex): New function.
13845         (Layout::dynsym_xindex): New function.
13846         (class Write_symbols_task): Add layout_ field.
13847         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13848         Change caller.
13849         * output.cc (Output_section_headers::Output_section_headers): Add
13850         shstrtab_section parameter.  Change all callers.
13851         (Output_section_headers::do_sized_write): Store overflow values
13852         for section count and section string table section index in
13853         section header zero.
13854         (Output_file_header::do_sized_write): Check for overflow of
13855         section count and section string table section index.
13856         (Output_symtab_xindex::do_write): New function.
13857         (Output_symtab_xindex::endian_do_write): New function.
13858         * output.h (class Output_section_headers): Add shstrtab_section_.
13859         Update declarations.
13860         (class Output_symtab_xindex): Define.
13861         (Output_section::has_out_shndx): New function.
13862         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13863         field.
13864         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13865         Change all callers.
13866         (Sized_symbol::init): Likewise.
13867         (Symbol::output_section): Check for ordinary symbol.
13868         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13869         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13870         callers.
13871         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13872         Change all callers.  Simplify handling of symbols from sections
13873         not included in the link.
13874         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13875         distinction.
13876         (Weak_alias_sorter::operator()): Assert that symbols are
13877         ordinary.
13878         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13879         distinction.
13880         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13881         parameters.  Change all callers.
13882         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13883         symbol distinction.  Use SHN_XINDEX when needed.
13884         (Symbol_table::write_section_symbol): Add symtab_xindex
13885         parameter.  Change all callers.
13886         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13887         SHN_XINDEX when needed.
13888         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13889         declarations.
13890         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13891         (Symbol::is_defined): Check is_ordinary.
13892         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13893         (Symbol::is_absolute, Symbol::is_common): Likewise.
13894         (class Sized_symbol): Update declarations.
13895         (class Symbol_table): Update declarations.
13896         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13897         parameters.  Change all callers.
13898         (Sized_symbol::override): Likewise.
13899         (Symbol_table::override): Likewise.
13900         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13901         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13902         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13903         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13904         to be in an ordinary section.
13905         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13906         object and is_ordinary parameters.  Change all callers.
13907         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13908         Change all callers.  Don't add undefined or non-ordinary symbols
13909         to reloc_map_.
13910         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13911         Change all callers.
13912         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13913         declarations.
13914         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13915         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13916         (Sized_relobj::relocate_sections): Likewise.
13917         * target-reloc.h (scan_relocs): Adjust section symbol index.
13918         (scan_relocatable_relocs): Likewise.
13919         * i386.cc (Scan::local): Check for ordinary symbols.
13920         * sparc.cc (Scan::local): Likewise.
13921         * x86_64.cc (Scan::local): Likewise.
13922         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13923         to symbol_section_and_value.
13924         * testsuite/many_sections_test.cc: New file.
13925         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13926         (check_PROGRAMS): Add many_sections_test.
13927         (many_sections_test_SOURCES): Define.
13928         (many_sections_test_DEPENDENCIES): Define.
13929         (many_sections_test_LDFLAGS): Define.
13930         (BUILT_SOURCES): Add many_sections_define.h.
13931         (many_sections_define.h): New target.
13932         (BUILT_SOURCES): Add many_sections_check.h.
13933         (many_sections_check.h): New target.
13934         (check_PROGRAMS): Add many_sections_r_test.
13935         (many_sections_r_test_SOURCES): Define.
13936         (many_sections_r_test_DEPENDENCIES): Define.
13937         (many_sections_r_test_LDFLAGS): Define.
13938         (many_sections_r_test_LDADD): Define.
13939         (many_sections_r_test.o): New target.
13940         * testsuite/Makefile.in: Rebuild.
13941
13942 2008-04-17  Cary Coutant  <ccoutant@google.com>
13943
13944         * errors.cc (Errors::info): New function.
13945         (gold_info): New function.
13946         * errors.h (Errors::info): New function.
13947         * gold.h (gold_info): New function.
13948         * object.cc (Input_objects::add_object): Print trace output.
13949         * options.cc (options::parse_set): New function.
13950         (General_options::parse_wrap): Deleted.
13951         (General_options::General_options): Deleted initializer.
13952         * options.h (options::String_set): New typedef.
13953         (options::parse_set): New function.
13954         (DEFINE_set): New macro.
13955         (General_options::wrap): Changed to use DEFINE_set. Changed
13956         callers of any_wrap_symbols and is_wrap_symbol.
13957         (General_options::trace, General_options::trace_symbol):
13958         New options.
13959         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13960         (General_options::wrap_symbols_): Deleted.
13961         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13962
13963 2008-04-17  David S. Miller  <davem@davemloft.net>
13964
13965         * options.cc (General_options::parse_V): New function.
13966         * options.h: Add entries for -V and -Qy.
13967
13968 2008-04-17  Ian Lance Taylor  <iant@google.com>
13969
13970         * common.cc (Symbol_table::allocate_commons): Remove options
13971         parameter.  Change caller.
13972         (Symbol_table::do_allocate_commons): Remove options parameter.
13973         Change caller.  Just call do_allocate_commons_list twice.
13974         (Symbol_table::do_allocate_commons_list): New function, broken out
13975         of do_allocate_commons.
13976         * common.h (class Allocate_commons_task): Remove options_ field.
13977         Update constructor.
13978         * symtab.cc (Symbol_table::Symbol_table): Initialize
13979         tls_commons_.
13980         (Symbol_table::add_from_object): Put TLS common symbols on
13981         tls_commons_ list.
13982         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13983         which are IN_OUTPUT_DATA.
13984         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13985         allocate_commons and do_allocate_commons declarations.  Declare
13986         do_allocate_commons_list.
13987         * gold.cc (queue_middle_tasks): Update creation of
13988         Allocate_commons_task to not pass options.
13989         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13990         (TLS_TEST_C_FLAGS): New variable.
13991         (tls_test_c_pic.o): New target.
13992         (tls_test_shared.so): Link in tls_test_c_pic.o.
13993         (tls_test_c_pic_ie.o): New target.
13994         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13995         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13996         (tls_test_c.o): New target.
13997         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13998         (tls_pic_test_LDADD): Likewise.
13999         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14000         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14001         (tls_test_c_gnu2.o): New target.
14002         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14003         tls_test_c_gnu2.o.
14004         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14005         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14006         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14007         * testsuite/tls_test.cc: Include "config.h".
14008         (t_last): Call t11_last.
14009         * testsuite/tls_test.h (t11, t11_last): Declare.
14010         * testsuite/tls_test_c.c: New file.
14011         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14012         * configure.ac: Check for OpenMP support.
14013         * configure, config.in, Makefile.in: Rebuild.
14014         * testsuite/Makefile.in: Rebuild.
14015
14016 2008-04-16  Cary Coutant  <ccoutant@google.com>
14017
14018         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14019         (Target_i386::tls_base_symbol_defined_): New field.
14020         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14021         (Target_i386::Scan::global): Likewise.
14022         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14023         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14024         (Target_x86_64::tls_base_symbol_defined_): New field.
14025         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14026         (Target_x86_64::Scan::global): Likewise.
14027
14028 2008-04-16  Cary Coutant  <ccoutant@google.com>
14029
14030         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14031         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14032         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14033         building shared libraries.
14034         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14035         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14036         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14037         * testsuite/Makefile.in: Rebuild.
14038         * testsuite/weak_undef.h: New file.
14039         * testsuite/weak_undef_file1.cc: Add extra test cases.
14040         * testsuite/weak_undef_file2.cc: Likewise.
14041         * testsuite/weak_undef_test.cc: Likewise.
14042
14043 2008-04-16  David S. Miller  <davem@davemloft.net>
14044
14045         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14046         Add issued_non_pic_error_ field.  Declare check_non_pic.
14047         (Target_sparc::Scan::check_non_pic): New function.
14048         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14049         (Target_sparc::Scan::global): Likewise.
14050
14051         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14052         * configure: Rebuild.
14053
14054         * options.h (DEFINE_enable): New macro.
14055         (new_dtags): New enable option.
14056         (initfirst, interpose, loadfltr, nodefaultlib,
14057         nodelete, nodlopen, nodump): New -z options.
14058         * layout.cc (Layout:finish_dynamic_section): If new
14059         dtags enabled, emit DT_RUNPATH.  Also, emit a
14060         DT_FLAGS_1 containing any specified -z flags.
14061
14062 2008-04-16  Ian Lance Taylor  <iant@google.com>
14063
14064         * copy-relocs.cc: New file.
14065         * copy-relocs.h: New file.
14066         * reloc.cc: Remove Copy_relocs code.
14067         * reloc.h: Likewise.
14068         * reloc-types.h (struct Reloc_types) [both versions]: Add
14069         get_reloc_addend_noerror.
14070         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14071         variants of add_global which take an addend which must be zero.
14072         * i386.cc: Include "copy-relocs.h".
14073         (class Target_i386): Change type of copy_relocs_ to variable,
14074         update initializer.
14075         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14076         Change all callers.
14077         (Target_i386::do_finalize_sections): Change handling of
14078         copy_relocs_.
14079         * sparc.cc: Include "copy-relocs.h".
14080         (class Target_sparc): Change type of copy_relocs_ to variable,
14081         update initializer.
14082         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14083         Change all callers.
14084         (Target_sparc::do_finalize_sections): Change handling of
14085         copy_relocs_.
14086         * x86_64.cc: Include "copy-relocs.h".
14087         (class Target_x86_64): Change type of copy_relocs_ to variable,
14088         update initializer.
14089         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14090         class.  Change all callers.
14091         (Target_x86_64::do_finalize_sections): Change handling of
14092         copy_relocs_.
14093         * Makefile.am (CCFILES): Add copy-relocs.cc.
14094         (HFILES): Add copy-relocs.h.
14095
14096         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14097
14098         * testsuite/script_test_4.sh: Permit leading zeroes.
14099
14100 2008-04-15  Ian Lance Taylor  <iant@google.com>
14101
14102         * script-sections.cc (Script_sections::create_segments): Use
14103         header_size_adjustment even when there is enough room for the
14104         headers.
14105         * testsuite/script_test_4.sh: New file.
14106         * testsuite/script_test_4.t: New file.
14107         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14108         (check_DATA): Add script_test_4.stdout.
14109         (MOSTLYCLEANFILES): Likewise.
14110         (script_test_4): New target.
14111         (script_test_4.stdout): New target.
14112         * testsuite/Makefile.in: Rebuild.
14113
14114         * sparc.cc: Add definitions for Output_data_plt_sparc class
14115         constants.
14116
14117 2008-04-14  David S. Miller  <davem@davemloft.net>
14118
14119         * sparc.cc: New file.
14120         * Makefile.am (TARGETSOURCES): Add sparc.cc
14121         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14122         * configure.tgt: Document targ_extra_size and
14123         targ_extra_big_endian.  Add entries for sparc-* and
14124         sparc64-*.
14125         * configure.ac: Handle targ_extra_size and
14126         targ_extra_big_endian.
14127         * Makefile.in: Rebuild.
14128         * configure: Likewise.
14129         * po/POTFILES.in: Likewise.
14130         * po/gold.pot: Likewise.
14131
14132 2008-04-14  Ian Lance Taylor  <iant@google.com>
14133
14134         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14135         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14136         in the name/type/flags to section mapping.  Don't call
14137         allocate_output_section.
14138         (Layout::choose_output_section): Change parameter from adjust_name
14139         to is_input_section.  Don't permit input sections after sections
14140         are attached to segments.  Don't call allocate_output_section.
14141         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14142         not write_enable_output_section.
14143         (Layout::make_output_section): Don't push to
14144         unattached_section_list_ nor call attach_to_segment.  Call
14145         attach_section_to_segment if sections are attached.
14146         (Layout::attach_sections_to_segments): New function.
14147         (Layout::attach_section_to_segment): New function.
14148         (Layout::attach_allocated_section_to_segment): Rename from
14149         attach_to_segment.  Remove flags parameter.
14150         (Layout::allocate_output_section): Remove function.
14151         (Layout::write_enable_output_section): Remove function.
14152         * layout.h (class Layout): Update for above changes.  Add new
14153         field sections_are_attached_.
14154         * output.h (Output_section::update_flags_for_input_section): New
14155         function.
14156         * output.cc (Output_section::add_input_section): Call
14157         update_flags_for_input_section.
14158         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14159
14160 2008-04-11  Cary Coutant  <ccoutant@google.com>
14161
14162         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14163         thought unnecessary.
14164         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14165
14166 2008-04-11  Ian Lance Taylor  <iant@google.com>
14167
14168         * output.h (class Output_section_data): Remove inline definition
14169         of set_addralign.
14170         * output.cc (Output_section_data::set_addralign): New function.
14171
14172 2008-04-11  Cary Coutant  <ccoutant@google.com>
14173
14174         Add support for TLS descriptors for i386 and x86_64.
14175         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14176         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14177         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14178         GOT_TYPE_TLS_DESC.
14179         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14180         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14181         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14182         relocations.
14183         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14184         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14185         Fix problem with initial-exec relocations.
14186         (Target_i386::Relocate::relocate_tls): Likewise.
14187         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14188         relaxation.
14189         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14190         support for section-plus-offset dynamic table entries.
14191         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14192         (Output_data_dynamic::Dynamic_entry): Add support for
14193         section-plus-offset dynamic table entries.
14194         (Output_data_dynamic::Classification): Likewise.
14195         (Output_data_dynamic::classification_): Renamed offset_.
14196         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14197         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14198         (Target_x86_64::make_plt_section): New function.
14199         (Target_x86_64::reserve_tlsdesc_entries): New function.
14200         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14201         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14202         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14203         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14204         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14205         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14206         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14207         add extra PLT entry for TLS descriptors.
14208         (Output_data_plt_x86_64::got_): New field.
14209         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14210         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14211         fields.
14212         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14213         descriptors.
14214         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14215         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14216         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14217         R_386_TLS_DESC_CALL relocations.
14218         (Target_x86_64::Scan::global): Likewise.
14219         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14220         for TLS descriptors.
14221         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14222         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14223         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14224         GD-to-IE relaxation.
14225         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14226         and TLS_DESCRIPTORS.
14227         * Makefile.in: Rebuild.
14228         * configure: Rebuild.
14229         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14230         (tls_test_shared2.so): New target.
14231         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14232         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14233         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14234         (tls_shared_gd_to_ie_test_LDADD): New variable.
14235         (tls_shared_gnu2_gd_to_ie_test): New target.
14236         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14237         New targets.
14238         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14239         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14240         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14241         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14242         (tls_shared_gnu2_test): New target.
14243         (tls_test_gnu2_shared.so): New target.
14244         (tls_shared_gnu2_test_SOURCES): New variable.
14245         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14246         (tls_shared_gnu2_test_LDFLAGS): New variable.
14247         (tls_shared_gnu2_test_LDADD): New variable.
14248         * testsuite/Makefile.in: Rebuild.
14249         * testsuite/Makefile.
14250
14251 2008-04-11  Ian Lance Taylor  <iant@google.com>
14252
14253         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14254         justsyms.t.
14255         * testsuite/Makefile.in: Rebuild.
14256
14257         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14258         long.
14259         * testsuite/script_test_2.cc (main): Adjust test.
14260
14261 2008-04-11  David S. Miller  <davem@davemloft.net>
14262             Ian Lance Taylor  <iant@google.com>
14263
14264         * options.h (General_options): Add entries for '-Y' and
14265         '-relax'.
14266         * options.cc (General_options:finalize): If -Y was used, add those
14267         entries to the library path instead of the default "/lib" and
14268         "/usr/lib".
14269
14270 2008-04-11  David S. Miller  <davem@davemloft.net>
14271
14272         * testsuite/justsyms.t: Start at 0x100.
14273         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14274         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14275         long.
14276         * testsuite/script_test_2.cc: Adjust string and section length
14277         checks.
14278
14279 2008-04-09  Ian Lance Taylor  <iant@google.com>
14280
14281         PR gold/5996
14282         * script-sections.cc (Sections_element::allocate_to_segment): Add
14283         orphan parameter.
14284         (Output_section_definition::allocate_to_segment): Likewise.
14285         (Orphan_output_section::allocate_to_segment): Likewise.
14286         (Script_sections::attach_sections_using_phdrs_clause): Don't
14287         propagate non-PT_LOAD segments to orphan sections.
14288         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14289         readelf rather than objdump.
14290         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14291         .interp section and PT_INTERP segment are the same size.
14292         * testsuite/Makefile.in: Rebuild.
14293
14294         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14295         aliases for symbols defined in the same object.
14296         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14297         (weak_alias_test_SOURCES): New variable.
14298         (weak_alias_test_DEPENDENCIES): New variable.
14299         (weak_alias_test_LDFLAGS): New variable.
14300         (weak_alias_test_LDADD): New variable.
14301         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14302         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14303         (weak_alias_test_3.o): New target.
14304         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14305         * testsuite/weak_alias_test_main.cc: New file.
14306         * testsuite/weak_alias_test_1.cc: New file.
14307         * testsuite/weak_alias_test_2.cc: New file.
14308         * testsuite/weak_alias_test_3.cc: New file.
14309
14310 2008-04-08  Ian Lance Taylor  <iant@google.com>
14311
14312         * options.h (class General_options): Add --noinhibit-exec option.
14313         * main.cc (main): Check --noinhibit-exec.
14314
14315         * options.h (class General_options): Define --wrap as a special
14316         option.  Add wrap_symbols_ field.
14317         (General_options::any_wrap_symbols): New function.
14318         (General_options::is_wrap_symbol): New function.
14319         * options.cc (General_options::parse_wrap): New function.
14320         (General_options::General_options): Initialize wrap_symbols_.
14321         * symtab.cc (Symbol_table::wrap_symbol): New function.
14322         (Symbol_table::add_from_object): Handle --wrap.
14323         * symtab.h (class Symbol_table): Declare wrap_symbol.
14324         * target.h (Target::wrap_char): New function.
14325         (Target::Target_info): Add wrap_char field.
14326         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14327         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14328         * testsuite/testfile.cc (Target_test::test_target_info):
14329         Likewise.
14330
14331         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14332         there is one.
14333
14334         * layout.h (class Layout): Add added_eh_frame_data_ field.
14335         * layout.cc (Layout::Layout): Initialize new field.
14336         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14337         output section until we find a section we merged successfully.
14338         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14339         that the size be non-zero.
14340
14341         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14342         qualifier.
14343
14344 2008-04-08  Craig Silverstein  <csilvers@google.com>
14345
14346         * configure.ac: Export new conditional variable HAVE_ZLIB.
14347         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14348         on HAVE_ZLIB.
14349         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14350         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14351
14352 2008-04-07  Ian Lance Taylor  <iant@google.com>
14353
14354         * version.cc (version_string): Set to "1.5".
14355
14356         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14357         Add issued_non_pic_error_ field.  Declare check_non_pic.
14358         (Target_x86_64::Scan::check_non_pic): New function.
14359         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14360         (Target_x86_64::Scan::global): Likewise.
14361
14362         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14363         addend parameter.  Change caller.  Handle merge sections.
14364         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14365         Address to Addend.  Don't add in the result of
14366         local_section_offset, pass down the addend and use the returned
14367         value.
14368         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14369         Update declarations of local_section_offset and symbol_value.
14370         * testsuite/two_file_test_1.cc (t18): New function.
14371         * testsuite/two_file_test_2.cc (f18): New function.
14372         * testsuite/two_file_test_main.cc (main): Call t18.
14373         * testsuite/two_file_test.h (t18, f18): Declare.
14374
14375         * configure.ac: Don't test for objdump, c++filt, or readelf.
14376         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14377         conditionals.
14378         (TEST_READELF): New variable.
14379         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14380         (check_PROGRAMS): Add two_file_strip_test.
14381         (two_file_strip_test): New target.
14382         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14383         (two_file_same_shared_strip_test_SOURCES): New variable.
14384         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14385         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14386         (two_file_same_shared_strip_test_LDADD): New variable.
14387         (two_file_shared_strip.so): New target.
14388         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14389         (ver_test_5.syms, ver_test_7.syms): Likewise.
14390         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14391         (strip_test_3.stdout): Use TEST_OBJDUMP.
14392         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14393
14394 2008-04-04  Cary Coutant  <ccoutant@google.com>
14395
14396         * symtab.h (Symbol::is_weak_undefined): New function.
14397         (Symbol::is_strong_undefined): New function.
14398         (Symbol::is_absolute): New function.
14399         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14400         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14401         absolute symbols.
14402         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14403         (weak_undef_test): New target.
14404         * testsuite/Makefile.in: Rebuild.
14405         * testsuite/weak_undef_file1.cc: New file.
14406         * testsuite/weak_undef_file2.cc: New file.
14407         * testsuite/weak_undef_test.cc: New file.
14408
14409 2008-04-03  Craig Silverstein  <csilvers@google.com>
14410
14411         * compressed_output.h (class Output_compressed_section): Use
14412         unsigned buffer.
14413         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14414         add zlib header.
14415         (zlib_compressed_suffix): Removed.
14416         (Output_compressed_section::set_final_data_size): Use unsigned
14417         buffers.
14418         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14419         Fix linker invocation.
14420         (flagstest_o_specialfile_and_compress_debug_sections):
14421         Likewise.
14422         * testsuite/Makefile.in: Regenerated.
14423
14424 2008-04-02  David S. Miller  <davem@davemloft.net>
14425
14426         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14427         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14428
14429 2008-04-02  Craig Silverstein  <csilvers@google.com>
14430
14431         * TODO: New file.
14432
14433 2008-04-02  Ian Lance Taylor  <iant@google.com>
14434
14435         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14436         parameters.  Update for new key type to views_.  Change all
14437         callers.
14438         (File_read::read): Adjust for byteshift in returned view.
14439         (File_read::add_view): New function, broken out of
14440         find_and_make_view.
14441         (File_read::make_view): New function, broken out of
14442         find_and_make_view.
14443         (File_read::find_or_make_view): Add offset and aligned
14444         parameters.  Rewrite accordingly.  Change all callers.
14445         (File_read::get_view): Add offset and aligned parameters.  Adjust
14446         for byteshift in return value.
14447         (File_read::get_lasting_view): Likewise.
14448         * fileread.h (class File_read): Update declarations.
14449         (class File_read::View): Add byteshift_ field.  Add byteshift to
14450         constructor.  Add byteshift method.
14451         * archive.h (Archive::clear_uncached_views): New function.
14452         (Archive::get_view): Add aligned parameter.  Change all callers.
14453         * object.h (Object::get_view): Add aligned parameter.  Change all
14454         callers.
14455         (Object::get_lasting_view): Likewise.
14456
14457         * fileread.cc (File_read::release): Don't call clear_views if
14458         there are multiple objects.
14459         * fileread.h (File_read::clear_uncached_views): New function.
14460         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14461         on the archive.
14462
14463 2008-03-31  Cary Coutant  <ccoutant@google.com>
14464
14465         Add thin archive support.
14466         * archive.cc (Archive::armagt): New const.
14467         (Archive::setup): Remove task parameter and calls to unlock.
14468         (Archive::unlock_nested_archives): New function.
14469         (Archive::read_header): Add nested_off parameter. Change
14470         all callers.
14471         (Archive::interpret_header): Likewise.
14472         (Archive::include_all_members): Change to handle thin
14473         archives.
14474         (Archive::include_member): Likewise.
14475         * archive.h (Archive::Archive): Add new parameters and
14476         initializers.
14477         (Archive::armagt): New const.
14478         (Archive::setup): Remove task parameter.
14479         (Archive::unlock_nested_archives): New function.
14480         (Archive::read_header): Add nested_off parameter.
14481         (Archive::interpret_header): Likewise.
14482         (Archive::Nested_archive_table): New typedef.
14483         (Archive::is_thin_archive_): New field.
14484         (Archive::nested_archives_): New field.
14485         (Archive::options_): New field.
14486         (Archive::dirpath_): New field.
14487         (Archive::task_): New field.
14488         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14489         for thin archives.  Pass additional parameters to
14490         Archive::Archive.  Unlock the archive file after calling
14491         Archive::setup.
14492
14493 2008-03-29  Ian Lance Taylor  <iant@google.com>
14494
14495         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14496         version symbol to be local.
14497         * testsuite/ver_test_4.sh: New file.
14498         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14499         (check_DATA): Add ver_test_4.syms.
14500         (ver_test_4.syms): New target.
14501         * testsuite/Makefile.in: Rebuild.
14502
14503         * output.cc
14504         (Output_section::Input_section_sort_entry::has_priority): New
14505         function.
14506         (Output_section::Input_section_sort_entry::match_file_name): New
14507         function.
14508         (Output_section::Input_section_sort_entry::match_section_name):
14509         Remove.
14510         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14511         Remove.
14512         (Output_section::Input_section_sort_entry::match_section_file):
14513         Remove.
14514         (Output_section::Input_section_sort_compare::operator()): Rewrite
14515         using new Input_section_sort_entry functions.  Sort crtbegin and
14516         crtend first.  Sort sections with no priority before sections with
14517         a priority.
14518         * testsuite/initpri1.c (d3): Check j != 4.
14519         (cd5): New constructor/destructor function.
14520         (main): Check j != 2.
14521
14522         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14523         new symbol when resolving, don't call set_is_default.
14524         * testsuite/ver_test_7.cc: New file.
14525         * testsuite/ver_test_7.sh: New file.
14526         * testsuite/Makefile.am (ver_test_7.so): New target.
14527         (ver_test_7.o): New target.
14528         (check_SCRIPTS): Add ver_test_7.sh.
14529         (check_DATA): Add ver_test_7.syms.
14530         (ver_test_7.syms): New target.
14531
14532 2008-03-28  Ian Lance Taylor  <iant@google.com>
14533
14534         * layout.cc (Layout::layout): If we see an input section with a
14535         name that needs sorting, set the must_sort flag for the output
14536         section.
14537         (Layout::make_output_section): If the name of the output section
14538         indicates that it might require sorting, set the may_sort flag.
14539         * output.h (Output_section::may_sort_attached_input_sections): New
14540         function.
14541         (Output_section::set_may_sort_attached_input_sections): New
14542         function.
14543         (Output_section::must_sort_attached_input_sections): New
14544         function.
14545         (Output_section::set_must_sort_attached_input_sections): New
14546         function.
14547         (class Output_section): Declare Input_section_sort_entry.  Define
14548         Input_section_sort_compare.  Declare
14549         sort_attached_input_sections.  Add new fields:
14550         may_sort_attached_input_sections_,
14551         must_sort_attached_input_sections_,
14552         attached_input_sections_are_sorted_.
14553         * output.cc (Output_section::Output_section): Initialize new
14554         fields.
14555         (Output_section::add_input_section): Add an entry to
14556         input_sections_ if may_sort or must_sort are true.
14557         (Output_section::set_final_data_size): Call
14558         sort_attached_input_sections if necessary.
14559         (Output_section::Input_section_sort_entry): Define new class.
14560         (Output_section::Input_section_sort_compare::operator()): New
14561         function.
14562         (Output_section::sort_attached_input_sections): New function.
14563         * configure.ac: Check whether the compiler supports constructor
14564         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14565         * testsuite/initpri1.c: New file.
14566         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14567         CONSTRUCTOR_PRIORITY.
14568         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14569         (initpri1_LDFLAGS): New variable.
14570         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14571
14572 2008-03-27  Ian Lance Taylor  <iant@google.com>
14573
14574         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14575         * testsuite/common_test_1.c: New file.
14576         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14577         (common_test_1_SOURCES): New variable.
14578         (common_test_1_DEPENDENCIES): New variable.
14579         (common_test_1_LDFLAGS): New variable.
14580
14581         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14582         and commons_ correctly when NAME/VERSION does not override
14583         NAME/NULL.
14584         * testsuite/ver_test_6.c: New file.
14585         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14586         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14587         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14588
14589 2008-03-26  Ian Lance Taylor  <iant@google.com>
14590
14591         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14592         of an undefined symbol from a version script.
14593         * testsuite/Makefile.am (ver_test_5.so): New target.
14594         (ver_test_5.o): New target.
14595         (check_SCRIPTS): Add ver_test_5.sh.
14596         (check_DATA): Add ver_test_5.syms.
14597         (ver_test_5.syms): New target.
14598         * testsuite/ver_test_5.cc: New file.
14599         * testsuite/ver_test_5.script: New file.
14600         * testsuite/ver_test_5.sh: New file.
14601         * Makefile.in, testsuite/Makefile.in: Rebuild.
14602
14603         PR gold/5986
14604         Fix problems building gold with gcc 4.3.0.
14605         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14606         (gold_error_at_location, gold_warning_at_location): Use it.
14607         * configure.ac: Check whether we can compile and use a template
14608         function with a printf attribute.
14609         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14610         when jumping over bytes.
14611         * object.cc: Instantiate Object::read_section_data.
14612         * debug.h: Include <cstring>
14613         * dwarf_reader.cc: Include <algorithm>
14614         * main.cc: Include <cstring>.
14615         * options.cc: Include <cstring>.
14616         * output.cc: Include <cstring>.
14617         * script.cc: Include <cstring>.
14618         * script.h: Include <string>.
14619         * symtab.cc: Include <cstring> and <algorithm>.
14620         * target-select.cc: Include <cstring>.
14621         * version.cc: Include <string>.
14622         * testsuite/testmain.cc: Include <cstdlib>.
14623         * configure, config.in: Rebuild.
14624
14625 2008-03-25  Ian Lance Taylor  <iant@google.com>
14626
14627         * options.cc: Include "../bfd/bfdver.h".
14628         (options::help): Print bug reporting address.
14629
14630         * version.cc (print_version): Adjust output for current value of
14631         BFD_VERSION_STRING.
14632
14633         * NEWS: New file.
14634
14635         * options.cc (options::help): Print list of supported targets.
14636         * target-select.h: Include <vector>.
14637         (class Target_selector): Make machine_, size_, and is_big_endian_
14638         fields const.  Add bfd_name_ and instantiated_target_ fields.
14639         (Target_selector::Target_selector): Add bfd_name parameter.
14640         (Target_selector::recognize): Make non-virtual, call
14641         do_recognize.
14642         (Target_selector::recognize_by_name): Make non-virtual, call
14643         do_recognize_by_name.
14644         (Target_selector::supported_names): New function.
14645         (Target_selector::bfd_name): New function.
14646         (Target_selector::do_instantiate_target): New pure virtual
14647         function.
14648         (Target_selector::do_recognize): New virtual function.
14649         (Target_selector::do_recognize_by_name): New virtual function.
14650         (Target_selector::instantiate_target): New private function.
14651         (supported_target_names): Declare.
14652         * target-select.cc (Target_selector::Target_selector): Update for
14653         new parameter and fields.
14654         (select_target_by_name): Check that the name matches before
14655         calling recognize_by_name.
14656         (supported_target_names): New function.
14657         * i386.cc (class Target_selector_i386): Update Target_selector
14658         constructor call.  Remove recognize and recognize_by_name.  Add
14659         do_instantiate_target.
14660         * x86_64.cc (class Target_selector_x86_64): Likewise.
14661         * testsuite/testfile.cc (class Target_selector_test): Update for
14662         changes to Target_selector.
14663
14664         * README: Rewrite, with some notes on unsupported features.
14665
14666 2008-03-24  Cary Coutant  <ccoutant@google.com>
14667
14668         * i386.cc (Target_i386::Got_type): New enum declaration.
14669         (Target_i386::Scan::local): Updated callers of Output_data_got
14670         member functions.
14671         (Target_i386::Scan::global): Likewise.
14672         (Target_i386::Relocate::relocate): Likewise.
14673         (Target_i386::Relocate::relocate_tls): Likewise.
14674         * object.h (Got_offset_list): New class.
14675         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14676         (Sized_relobj::local_got_offset): Likewise.
14677         (Sized_relobj::set_local_got_offset): Likewise.
14678         (Sized_relobj::local_has_tls_got_offset): Removed.
14679         (Sized_relobj::local_tls_got_offset): Removed.
14680         (Sized_relobj::set_local_tls_got_offset): Removed.
14681         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14682         * output.cc (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         * output.h (Output_data_got::add_global): Added got_type parameter.
14699         (Output_data_got::add_global_with_rel): Likewise.
14700         (Output_data_got::add_global_with_rela): Likewise.
14701         (Output_data_got::add_global_pair_with_rel): New function.
14702         (Output_data_got::add_global_pair_with_rela): New function.
14703         (Output_data_got::add_local): Added got_type parameter.
14704         (Output_data_got::add_local_with_rel): Likewise.
14705         (Output_data_got::add_local_with_rela): Likewise.
14706         (Output_data_got::add_local_pair_with_rel): New function.
14707         (Output_data_got::add_local_pair_with_rela): New function.
14708         (Output_data_got::add_global_tls): Removed.
14709         (Output_data_got::add_global_tls_with_rel): Removed.
14710         (Output_data_got::add_global_tls_with_rela): Removed.
14711         (Output_data_got::add_local_tls): Removed.
14712         (Output_data_got::add_local_tls_with_rel): Removed.
14713         (Output_data_got::add_local_tls_with_rela): Removed.
14714         * resolve.cc (Symbol::override_base_with_special): Removed
14715         reference to has_got_offset_ field.
14716         * symtab.cc (Symbol::init_fields): Replaced initialization
14717         of got_offset_ with got_offsets_.  Removed initialization
14718         of has_got_offset_
14719         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14720         (Symbol::got_offset): Likewise.
14721         (Symbol::set_got_offset): Likewise.
14722         (Symbol::has_tls_got_offset): Removed.
14723         (Symbol::tls_got_offset): Removed.
14724         (Symbol::set_tls_got_offset): Removed.
14725         (Symbol::got_offset_): Removed.
14726         (Symbol::tls_mod_got_offset_): Removed.
14727         (Symbol::tls_pair_got_offset_): Removed.
14728         (Symbol::got_offsets_): New field.
14729         (Symbol::has_got_offset): Removed.
14730         (Symbol::has_tls_mod_got_offset): Removed.
14731         (Symbol::has_tls_pair_got_offset): Removed.
14732         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14733         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14734         member functions.
14735         (Target_x86_64::Scan::global): Likewise.
14736         (Target_x86_64::Relocate::relocate): Likewise.
14737         (Target_x86_64::Relocate::relocate_tls): Likewise.
14738
14739 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14740
14741         * yyscript.y: Fix spelling error in comment.
14742
14743 2008-03-24  Ian Lance Taylor  <iant@google.com>
14744
14745         * options.h (class General_options): Define build_id option.
14746         * layout.h (class Layout): Declare write_build_id, create_note,
14747         create_build_id.  Add build_id_note_ member.
14748         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14749         "libiberty.h", "md5.h", "sha1.h".
14750         (Layout::Layout): Initialize eh_frame_data_,
14751         eh_frame_hdr_section_, and build_id_note_.
14752         (Layout::finalize): Call create_build_id.
14753         (Layout::create_note): New function, broken out of
14754         Layout::create_gold_note.
14755         (Layout::create_gold_note): Call create_note.
14756         (Layout::create_build_id): New function.
14757         (Layout::write_build_id): New function.
14758         (Close_task_runner::run): Call write_build_id.
14759
14760         * x86_64.cc: Correct license to GPLv3.
14761
14762 2008-03-23  Ian Lance Taylor  <iant@google.com>
14763
14764         * options.cc: Include "demangle.h".
14765         (parse_optional_string): New function.
14766         (parse_long_option): Handle takes_optional_argument.
14767         (parse_short_option): Update dash_z initializer.  Handle
14768         takes_optional_argument.
14769         (General_options::General_options): Initialize do_demangle_.
14770         (General_options::finalize): Set do_demangle_.  Handle demangling
14771         style.
14772         * options.h (parse_optional_string): Declare.
14773         (struct One_option): Add optional_arg field.  Update constructor.
14774         Update call constructor calls.  Add takes_optional_argument
14775         function.
14776         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14777         (DEFINE_optional_string): Define.
14778         (General_options::demangle): Change from DEFINE_bool to
14779         DEFINE_optional_string.
14780         (General_options::no_demangle): New function.
14781         (General_options::do_demangle): New function.
14782         (General_options::set_do_demangle): New function.
14783         (General_options::execstack_status_): Move definition to end of
14784         class definition.
14785         (General_options::static_): Likewise.
14786         (General_options::do_demangle_): New field.
14787         * object.cc (big_endian>::get_symbol_location_info): Call
14788         Options::do_demangle, not Options::demangle.
14789         * symtab.cc (demangle): Likewise.
14790
14791 2008-03-22  Ian Lance Taylor  <iant@google.com>
14792
14793         * gold.h: Include <cstddef> and <sys/types.h>
14794         * options.h: Include <cstring>.
14795
14796 2008-03-21  Ian Lance Taylor  <iant@google.com>
14797
14798         * Added source code to GNU binutils.
14799 \f
14800 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14801
14802 Copying and distribution of this file, with or without modification,
14803 are permitted in any medium without royalty provided the copyright
14804 notice and this notice are preserved.
14805
14806 Local Variables:
14807 mode: change-log
14808 left-margin: 8
14809 fill-column: 74
14810 version-control: never
14811 End: