gold/
[external/binutils.git] / gold / ChangeLog
1 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2
3         * options.h (General_options): Remove leading space from help
4         messages for -nostdlib and --rosegment.
5
6 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
7
8         PR ld/15365
9         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
10
11 2013-05-03  Alan Modra  <amodra@gmail.com>
12
13         * merge.cc (Output_merge_string::do_add_input_section): Correct
14         scan for number of strings.  Rename vars to avoid shadowing.
15         Include missing terminator in input_size_.
16
17 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
18
19         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
20         Restore empty string handling.
21
22 2013-05-01  Cary Coutant  <ccoutant@google.com>
23
24         * stringpool.cc (Stringpool_template::new_key_offset): Fix
25         uninitialized warning.
26
27 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
28
29         * output.cc (Output_section::add_merge_input_section): Allow
30         to merge sections if the alignment is more than character size.
31         * merge.h (Output_merge_string::Output_merge_string): Remove
32         assert.
33         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
34         only not-null strings. Check the alignment of strings.
35         * stringpool.h
36         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
37         alignment as the argument.
38         (Stringpool_template<Stringpool_char>::addralign_): New class member.
39         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
40         Align non-zero length strings according to the addralign_.
41         (Stringpool_template<Stringpool_char>::set_string_offsets):
42         Updating offsets according to the given alignment.
43         * testsuite/Makefile.am (text_section_grouping): Test if string
44         literals are getting merged.
45         * testsuite/Makefile.in: Regenerate.
46         * testsuite/merge_string_literals_1.c: New file.
47         * testsuite/merge_string_literals_2.c: Ditto.
48         * testsuite/merge_string_literals.sh: Ditto.
49
50 2013-04-26  Ian Lance Taylor  <iant@google.com>
51
52         * target-reloc.h (relocate_section): If the reloc offset is out of
53         range, pass VIEW as NULL to relocate.relocate.
54         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
55         * i386.cc (Target_i386::Relocate::relocate): Likewise.
56         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
57         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
58         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
59         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
60
61 2013-04-26  Geoff Pike  <gpike@chromium.org>
62
63         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
64         * layout.cc (Hash_task): New class.
65         (Layout::queue_build_id_tasks): New function.
66         (Layout::write_build_id): Handle single-thread portion of build ID
67         computation.  (In some cases, all of it is single-threaded.)  Replace
68         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
69         functionality in fewer lines of code.
70         * layout.h (Layout::queue_build_id_tasks): New function declaration.
71         * options.h (General_options): make "--build-id" default to tree
72         rather than sha1.  Add two new options related to --build-id=tree:
73         --build-id-chunk-size-for-treehash and
74         --build-id-min-file-size-for-treehash.
75         * Makefile.am: add testing of --build-id=tree and related new options
76         (these tests will be invoked by "make check").
77         * Makefile.in: Regenerate.
78
79 2013-04-25  Alan Modra  <amodra@gmail.com>
80
81         * configure.tgt: Add powerpcle and powerpc64le.
82
83 2013-04-22  Alan Modra  <amodra@gmail.com>
84
85         PR gold/15355
86         * layout.cc (Layout::segment_precedes): Allow more than one
87         segment with the same type and flags.
88
89 2013-04-15  Cary Coutant  <ccoutant@google.com>
90
91         * layout.cc (Layout::set_relocatable_section_offsets): Don't
92         allocate space in file for BSS sections.
93
94 2013-04-15  Cary Coutant  <ccoutant@google.com>
95
96         * script-sections.cc (Orphan_output_section): Reset address
97         to zero after each orphaned section for relocatable links.
98
99 2013-04-15  Cary Coutant  <ccoutant@google.com>
100
101         * symtab.cc (Symbol_table::sized_write_globals): Subtract
102         section starting address for relocatable link.
103         * testsuite/Makefile.am (script_test_11): New test.
104         * testsuite/Makefile.in: Regenerate.
105         * testsuite/script_test_11.c: New source file.
106         * testsuite/script_test_11.t: New linker script.
107
108 2013-04-13  Alan Modra  <amodra@gmail.com>
109
110         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
111         owner when sections are not adjacent and exceed group size.
112         (Target_powerpc::group_sections): Handle corner case.
113         (Target_powerpc::Branch_info::make_stub): Handle case where
114         stub table doesn't exist due to branches in non-exec sections.
115         (Target_powerpc::Relocate::relocate): Likewise.
116
117 2013-04-11  Alan Modra  <amodra@gmail.com>
118
119         PR gold/15354
120         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
121         .branch_lt to match bfd ld.  Adjust comments throughout file.
122
123 2013-04-04  Ian Lance Taylor  <iant@google.com>
124
125         GCC PR c++/56840
126         * object.cc (do_layout_deferred_sections): Handle .eh_frame
127         sections before checking whether they are included in the link.
128
129 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
130
131         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
132         object before calling the plugin claim_file handler.  Pass the elf
133         object of the archive to the plugin. Delete the elf object if the
134         plugin claims the file.
135
136 2013-03-21  Alan Modra  <amodra@gmail.com>
137
138         * layout.cc (Layout::set_segment_offsets): Accept writable .text
139         segment when omagic.
140
141 2013-03-21  Alan Modra  <amodra@gmail.com>
142
143         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
144         comparison warning.
145         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
146         uninitialized" warning.
147
148 2013-03-20  Alan Modra  <amodra@gmail.com>
149
150         * symtab.h (Symbol::clear_version): New function.
151         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
152         is_needed by weak references.  Clear version for symbols defined
153         in as-needed objects that are not needed.
154
155 2013-03-15  Alan Modra  <amodra@gmail.com>
156
157         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
158         static and public.  Add report_err param.  Return false for data refs.
159         (Target_powerpc::rela_dyn_section): New overloaded function.
160         (Target_powerpc::plt_, iplt_): Elucidate.
161         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
162         (Output_data_plt_powerpc::do_write): Don't write .iplt.
163         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
164         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
165         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
166         push_branch and make_plt_entry for ifunc syms when
167         reloc_needs_plt_for_ifunc.
168         (Target_powerpc::Relocate::relocate): Don't use plt entry value
169         for ifunc unless reloc_needs_plt_for_ifunc.
170
171 2013-03-15  Alan Modra  <amodra@gmail.com>
172
173         * gc.h (gc_process_relocs): Don't look through function descriptors.
174         * icf.cc (get_section_contents): Do so here instead.
175
176 2013-03-13  Alan Modra  <amodra@gmail.com>
177
178         * powerpc.cc (is_branch_reloc): Forward declare.
179         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
180         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
181         false for 64-bit, true for 32-bit non-branch relocs.
182         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
183         * testsuite/Makefile.am (icf_test): Use linker map file instead of
184         nm output.
185         (icf_safe_test): Generate linker map file as well as nm output.
186         (icf_safe_so_test): Likewise.
187         * testsuite/Makefile.in: Regenerate.
188         * testsuite/icf_test.sh: Parse linker map file to determine
189         section folding.
190         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
191         * testsuite/icf_safe_so_test.sh: Likewise.
192         (X86_32_or_ARM_specific_safe_fold): Merge into..
193         (arch_specific_safe_fold): ..this.
194         (X86_64_specific_safe_fold): Delete unused function.
195
196 2013-03-12  Alan Modra  <amodra@gmail.com>
197
198         * gc.h (gc_process_relocs): Look through function descriptors
199         to determine shndx, symvalue and addend used by ICF.  Tidy
200         variable duplication.
201
202 2013-03-11  Alan Modra  <amodra@gmail.com>
203
204         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
205         * layout.cc (Layout_task_runner::run): ..to here.
206         * symtab.h (struct Symbol_location): Extract from..
207         (class Symbol_table): ..here.
208         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
209         * target.h (class Target): Add function_location and
210         do_function_location functions.
211         (class Sized_target): Add do_function_location.
212         * object.h (class Sized_relobj_file): Move find_shdr..
213         (class Object): ..to here.
214         * object.cc: Likewise.  Update to suit.  Instantiate.
215         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
216         * powerpc.cc (class Powerpc_dynobj): New.
217         (Target_powerpc::do_function_location): New function.
218         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
219         (Powerpc_dynobj::do_read_symbols): New function.
220         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
221
222 2013-03-08  Ian Lance Taylor  <iant@google.com>
223
224         * options.cc (General_options::string_to_object_format): Accept
225         "default".
226
227 2013-03-08  Alan Modra  <amodra@gmail.com>
228
229         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
230         pointer to Post_fde.
231         (struct Post_fde): Move definition to here..
232         * ehframe.cc (struct Post_fde): ..from here.
233         (Cie::write): Don't alloc Post_fde.
234         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
235
236 2013-03-07  Alan Modra  <amodra@gmail.com>
237
238         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
239         relocation referencing .LC0.
240         * testsuite/discard_locals_test.sh: Remove FIXMEs.
241
242 2013-03-07  Alan Modra  <amodra@gmail.com>
243
244         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
245         always_inline.  Add assembly for powerpc to avoid GOT.
246
247 2013-03-07  Alan Modra  <amodra@gmail.com>
248
249         * testsuite/script_test_10.sh: Don't test .bss section
250         header number.
251
252 2013-03-06  Alan Modra  <amodra@gmail.com>
253
254         * powerpc.cc (class Powerpc_relobj): Move some member functions.
255         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
256         all callers.  Handle folded sections.
257         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
258         to Powerpc_relobj.
259         (Global_symbol_visitor_opd::operator()): Likewise.
260
261 2013-03-04  Alan Modra  <amodra@gmail.com>
262
263         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
264         * testsuite/Makefile.in: Regenerate.
265
266 2013-03-01  Cary Coutant  <ccoutant@google.com>
267
268         Add dwp support for v2 DWARF package file format.
269         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
270         tu_length parameter.  Adjust all callers.
271         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
272         * dwp.cc: Include dwarf.h.
273         (Section_bounds): New struct type.
274         (Unit_set): New struct type.
275         (Dwo_file::Dwo_file): Initialize new data member.
276         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
277         Combine and rename to...
278         (Dwo_file::read_unit_index): ...this.
279         (Dwo_file::sized_read_compunit_index)
280         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
281         (Dwo_file::sized_read_unit_index): ...this.
282         (Dwo_file::copy_section): Remove section_name, is_str_offsets
283         parameters; add section_id parameter.
284         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
285         (Dwo_file::add_unit_set): ...this.
286         (Dwo_file::shndx_map_): Remove.
287         (Dwo_file::sect_offsets_): New data member.
288         (Dwp_output_file::Dwp_output_file): Initialize new data members.
289         (Dwp_output_file::add_section): Rename to...
290         (Dwp_output_file::add_contribution): ...this.
291         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
292         (Dwp_output_file::add_tu_set): Likewise.
293         (Dwp_output_file::Contribution): New type.
294         (Dwp_output_file::Section::contributions): New data member.
295         (Dwp_output_file::Cu_or_tu_set): Remove.
296         (Dwp_output_file::Section::Section): New ctor.
297         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
298         (Dwp_output_file::Dwp_index::Section_table): New type.
299         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
300         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
301         parameter.
302         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
303         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
304         (Dwp_output_file::Dwp_index::section_table): New member function.
305         (Dwp_output_file::Dwp_index::section_table_end): New member function.
306         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
307         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
308         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
309         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
310         (Dwp_output_file::Dwp_index::section_table_): New data member.
311         (Dwp_output_file::Dwp_index::section_mask_): New data member.
312         (Dwp_output_file::add_output_section): New member function.
313         (Dwp_output_file::write_new_section): New member function.
314         (Dwp_output_file::write_contributions): New member function.
315         (Dwp_output_file::section_id_map_): New data member.
316         (class Dwo_id_info_reader): Remove.
317         (class Unit_reader): New class.
318         (get_dwarf_section_name): New function.
319         (Dwo_file::read_executable): Adjust initializations of class data.
320         (Dwo_file::read): Add support for v2 package file format.
321         (Dwo_file::read_unit_index): Likewise.
322         (Dwo_file::sized_read_unit_index): Likewise.
323         (Dwo_file::copy_section): Likewise.
324         (Dwo_file::add_unit_set): Likewise.
325         (Dwp_output_file::add_output_section): Likewise.
326         (Dwp_output_file::add_contribution): Likewise.
327         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
328         for empty slot.
329         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
330         file format.
331         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
332         slot.
333         (Dwp_output_file::initialize): Remove unused function.
334         (Dwp_output_file::finalize): Add support for v2 package file format.
335         (Dwp_output_file::write_index): Likewise.
336         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
337         function prototype.
338
339 2013-03-01  Cary Coutant  <ccoutant@google.com>
340
341         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
342         function into class definition in header file.
343         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
344         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
345         New function.
346         (Dwarf_info_reader::check_buffer): Move here from .cc file.
347
348 2013-02-28  Alan Modra  <amodra@gmail.com>
349
350         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
351         * target.cc (Target::do_plt_fde_location): New function.
352         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
353         accessor function, and constructor param.
354         (struct Post_fde, Post_fdes): Declare.
355         (Cie::write): Add post_fdes param.
356         * ehframe.cc (Fde::write): Use plt_fde_location.
357         (struct Post_fde): Define.
358         (Cie::write): Stash FDEs added post merge mapping.
359         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
360         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
361         (Eh_frame::do_sized_write): Arrange to write post map FDES after
362         other FDEs.
363         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
364         (Target_powerpc::has_glink): New function.
365         (Target_powerpc::do_relax): Add eh_frame info for stubs.
366         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
367         glink_eh_frame_fde_32, default_fde): New data.
368         (Stub_table::eh_frame_added_): New var.
369         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
370         Make const.
371         (Stub_table::add_eh_frame): New function.
372         (Output_data_glink::add_eh_frame): New function.
373         (Target_powerpc::make_glink_section): Call add_eh_frame.
374
375 2013-02-15  Ian Lance Taylor  <iant@google.com>
376
377         * options.h (DEFINE_uint64_alias): Define.
378         (class General_options): Add -Ttext-segment as an alias for
379         -Ttext.
380
381 2013-02-15  Alan Modra  <amodra@gmail.com>
382
383         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
384         (Stub_table::do_write): ..here, two places.
385         (Stub_table::plt_call_size): Use it here too.
386
387 2013-02-11  Ian Lance Taylor  <iant@google.com>
388
389         * descriptors.cc (Descriptors::close_all): New function.
390         * descriptors.h (class Descriptors): Declare close_all.
391         (close_all_descriptors): New inline function.
392         * plugin.cc: Include "descriptors.h".
393         (Plugin_manager::cleanup): Call close_all_descriptors.
394
395 2013-02-06  Alan Modra  <amodra@gmail.com>
396
397         * README: Update coding style link.
398
399 2013-01-28  Cary Coutant  <ccoutant@google.com>
400
401         * dwp.cc (File_list): New typedef.
402         (Dwo_name_info_reader): New class.
403         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
404         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
405         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
406         (Dwo_file::read_executable): New function.
407         (Dwo_file::read): Move common setup code to ...
408         (Dwo_file::make_object): ... here.
409         (dwp_options): Add --exec/-e.
410         (usage): Likewise.
411         (main): Likewise.
412
413 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
414
415         * layout.cc (Layout::layout): Check for option text_reorder.
416         (Layout::make_output_section): Ditto.
417         * options.h (text_reorder): New option.
418         * output.cc (Input_section_sort_compare): Remove special ordering
419         of section names.
420         (Output_section::
421          Input_section_sort_section_name_special_ordering_compare::
422          operator()): New function.
423         (Output_section::sort_attached_input_sections): Use new sort function
424         for .text.
425         * output.h (Input_section_sort_section_name_special_ordering_compare):
426         New struct.
427         * testsuite/Makefile.am (text_section_grouping): Test option
428         --no-text-reorder
429         * testsuite/Makefile.in: Regenerate.
430         * testsuite/text_section_grouping.sh: Check order of functions without
431         default text reordering.
432
433 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
434
435         * options.h (General_options): Change default to true for new_dtags.
436
437 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
438
439         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
440         when enable_new_dtags is false.  Only add DT_RUNPATH when
441         enable_new_dtags is true.
442
443 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
444
445         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
446         used in declaration and definition consistent.
447         (Target_powerpc::symval_for_branch): Ditto.
448
449 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
450
451         * testsuite/plugin_final_layout.cc: Fix comment.
452
453 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
454
455         * layout.cc (Layout::layout): Do not do default sorting for
456         text sections when section ordering is specified.
457         (make_output_section): Ditto.
458         * testsuite/plugin_final_layout.cc: Name the function sections
459         to catch reordering issues.
460
461 2013-01-15  Alan Modra  <amodra@gmail.com>
462
463         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
464         plt-thread-safe.
465
466 2013-01-15  Alan Modra  <amodra@gmail.com>
467
468         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
469         * testsuite/Makefile.in: Regenerate.
470
471 2013-01-14  Alan Modra  <amodra@gmail.com>
472
473         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
474         * testsuite/Makefile.in: Regenerate.
475
476 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
477
478         PR bfd/14430
479         Fix mingw gold build with plugins enabled
480         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
481         * configure.ac: Export DLOPEN_LIBS and add headers check.
482         * plugin.cc: Handle non-dlfcn case.
483         * Makefile.in: Regenerate.
484         * config.in: Regenerate.
485         * configure: Regenerate.
486         * testsuite/Makefile.in: Regenerate.
487
488 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
489
490         * output.h (sort_attached_input_sections): Change to be public.
491         * script-sections.cc
492         (Output_section_definition::set_section_addresses): Sort
493         attached input sections according to section order before linker
494         script assigns section addresses.
495         (Orphan_output_section::set_section_addresses): Sort
496         attached input sections according to section order before linker
497         script assigns section addresses.
498         * Makefile.am (final_layout.sh): Use a simple linker script to
499         check if section ordering still works.
500         * Makefile.in: Regenerate.
501
502 2013-01-09  Ben Cheng  <bccheng@google.com>
503
504         * arm.cc (Target_arm::attributes_accept_div): New function.
505         (Target_arm::attributes_forbid_div): New function.
506         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
507         attribute using the same new functions as what bfd/elf32_arm.c
508         does.
509
510 2013-01-07  Cary Coutant  <ccoutant@google.com>
511
512         PR gold/14993
513         * output.cc (Output_section::add_input_section): For incremental
514         updates, don't track input sections that are allocated from patch
515         space.
516
517 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
518             Ian Lance Taylor  <iant@google.com>
519
520         PR gold/14897
521         * configure.ac (--enable-ld): Removed.
522         (install_as_default): Set to yes only for --enable-gold=default
523         or --disable-ld.
524         * configure: Regenerated.
525
526 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
527
528         * options.h (General_options): Add -fuse-ld= for GCC linker
529         option compatibility.
530
531 2013-01-04  Cary Coutant  <ccoutant@google.com>
532
533         * configure.ac: Fix typo restoring CXXFLAGS.
534         * configure: Regenerate.
535
536 2013-01-04  Cary Coutant  <ccoutant@google.com>
537
538         * testsuite/Makefile.am (CXXLINK_S): New macro.
539         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
540         * testsuite/Makefile.in: Regenerate.
541
542 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
543
544         * version.cc (print_version): Update copyright year to 2013.
545
546 2012-12-20  Ian Lance Taylor  <iant@google.com>
547
548         * layout.cc (Layout::special_ordering_of_input_section): New
549         function.
550         (Layout::layout): If input section requires special ordering, must
551         sort input sections.
552         (Layout::make_output_section): May sort .text input sections.
553         (Layout::is_section_name_prefix_grouped): Remove.
554         * layout.h (class Layout): Declare
555         special_ordering_of_input_section.  Don't declare
556         is_section_name_prefix_grouped.
557         * output.cc (Output_section::add_input_section): Revert last
558         change.
559         (Output_section::Input_section_sort::match_file_name): Don't crash
560         if called on output section data.
561         (Output_section::Input_section_sort_compare): Sort based on
562         special ordering.
563         (Output_section::Input_section_sort_section_order_index_compare):
564         Revert last patch.
565         (Output_section::sort_attached_input_sections): Likewise.
566
567 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
568
569         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
570         * layout.h (Layout::is_section_name_prefix_grouped): New function.
571         * output.cc (Output_section::add_input_section): Check if section
572         name contains special prefix.  Keep input sections to sort such
573         sections.
574         (Output_section::Input_section_sort_section_order_index_compare
575          ::operator()): Group sections according to prefixes.
576         (Output_section::sort_attached_input_sections): Add condition to
577         Input_section_entry constructor call.
578         * testsuite/Makefile.am (text_section_grouping): New test.
579         * testsuite/Makefile.in: Regenerate.
580         * testsuite/text_section_grouping.cc: New file.
581         * testsuite/text_section_grouping.sh: New file.
582
583 2012-12-17  Nick Clifton  <nickc@redhat.com>
584
585         * Makefile.am: Add copyright notice.
586         * NEWS: Likewise.
587         * README: Likewise.
588         * configure.ac: Likewise.
589         * ftruncate.c: Likewise.
590         * Makefile.in: Regenerate.
591
592 2012-12-14  Cary Coutant  <ccoutant@google.com>
593
594         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
595         --no-as-needed flag.
596         (exception_separate_shared_12_test): Likewise.
597         (incremental_copy_test): Likewise.
598         * testsuite/Makefile.in: Regenerate.
599
600 2012-12-14  Cary Coutant  <ccoutant@google.com>
601
602         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
603         (Dwp_output_file::Dwp_index::enter_set): Add assert.
604
605 2012-12-12  Alan Modra  <amodra@gmail.com>
606
607         * powerpc.cc (class Track_tls): New.
608         (class Relocate, class Scan): Inherit Track_tls.
609         (Target_powerpc::Scan::local, global): Track tls optimization
610         and avoid creating plt entry for __tls_get_addr if all uses
611         are optimized away.
612         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
613
614 2012-12-12  Alan Modra  <amodra@gmail.com>
615
616         * options.h (General_options): Add --toc-sort/--no-toc-sort.
617         Replace no_toc_optimize with toc_optimize.
618         * output.h (Output_section::input_sections): Provide non-const variant.
619         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
620         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
621         accessors.
622         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
623         (class Sort_toc_sections): New.
624         (Target_powerpc::do_finalize_sections): Sort toc sections.
625         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
626
627 2012-12-10  Roland McGrath  <mcgrathr@google.com>
628
629         * testsuite/binary_unittest.cc (read_all): New function.
630         (Sized_binary_test): Use it instead of ::read.
631         * fileread.cc (do_read): Don't assume pread always reads the whole
632         amount in a single call.
633
634 2012-12-10  Alan Modra  <amodra@gmail.com>
635
636         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
637         Set EM_PPC64 or EM_PPC here.
638         (Target_selector_powerpc::do_recognize): Delete.
639
640 2012-12-10  Alan Modra  <amodra@gmail.com>
641
642         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
643         stub_table_.
644         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
645
646 2012-12-07  Roland McGrath  <mcgrathr@google.com>
647
648         * testsuite/binary_unittest.cc (Sized_binary_test):
649         Use open_descriptor rather than ::open.
650
651 2012-12-07  Alan Modra  <amodra@gmail.com>
652
653         * powerpc.cc (Stub_table::do_write): Delete redundant Address
654         typedef and invalid_address constant.
655         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
656         instantiate constants.
657
658 2012-12-06  Roland McGrath  <mcgrathr@google.com>
659
660         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
661         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
662         * aclocal.m4: Regenerate.
663         * configure: Regenerate.
664         * Makefile.in: Regenerate.
665         * testsuite/Makefile.in: Regenerate.
666
667 2012-12-07  Alan Modra  <amodra@gmail.com>
668
669         * options.h (General_options): Add no_toc_optimize.
670         * powerpc.cc (ok_lo_toc_insn): New function.
671         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
672
673 2012-12-06  Alan Modra  <amodra@gmail.com>
674
675         * options.h (General_options): Add plt_align, plt_static_chain,
676         plt_thread_safe.  Update stub_group_size help text.
677         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
678         for new plt_thread_safe_ var.
679         (use_plt_offset): Correct comments.
680         (Target_powerpc::do_relax): Look for thread creation symbols to
681         determine default plt_thread_safe value.  Clear plt call stubs
682         as well as branch stubs each iteration.
683         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
684         insn constants.
685         (l, hi, ha, write_insn): Move earlier.
686         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
687         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
688         plt stubs too.
689         (Stub_table::update_size): Adjust.
690         (Stub_table::prev_size, set_prev_size): Delete.
691         (Stub_table::stub_align): Let --plt-align affect result.
692         (Stub_table::plt_call_size): Calculate sizes for various stubs.
693         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
694         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
695         (Stub_table::do_write): Support more stub variants.
696
697 2012-12-04  Alan Modra  <amodra@gmail.com>
698
699         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
700         (Target_powerpc::do_define_standard_symbols): New function.
701
702 2012-12-03  Alan Modra  <amodra@gmail.com>
703
704         * output.h: Formatting, whitespace.
705
706 2012-12-03  Alan Modra  <amodra@gmail.com>
707
708         * layout.h (Layout::get_executable_sections): Declare.
709         * layout.cc (Layout::get_executable_sections): New function.
710         * arm.cc (Target_arm::group_sections): Use it.
711         (Arm_output_section::group_sections): Delete now redundant test.
712         * output.cc (Output_reloc::Output_reloc): Add is_relative.
713         param to handle relative relocs.
714         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
715         (Output_data_reloc::add_absolute): Adjust.
716         (Output_data_reloc::add_relative): New function.
717         (Output_data::reset_data_size): New function.
718         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
719         (Output_section::set_addralign): New function.
720         (Output_section::checkpoint_set_addralign): New function.
721         (Output_section::clear_section_offsets_need_adjustment): New function.
722         (Output_section::input_sections): Make public.
723         * powerpc.cc (class Output_data_brlt_powerpc): New.
724         (class Stub_table, class Stub_control): New.
725         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
726         stub_table_, set_stub_table, stub_table): New vectors and accessor
727         functions.
728         (Target_powerpc::do_may_relax, do_relax, push_branch,
729         new_stub_table, stub_tables, brlt_section, group_sections,
730         add_branch_lookup_table, find_branch_lookup_table,
731         write_branch_lookup_table, make_brlt_section): New functions.
732         (Target_powerpc::struct Sort_sections, class Branch_info): New.
733         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
734         branch_info_): New vars.
735         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
736         make call stubs here.
737         (Output_data_glink): Remove all call stub handling from this class.
738         (Target_powerpc::Scan::local, global): Save interesting branch
739         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
740         (Target_powerpc::do_finalize_sections): Only make reg save/restore
741         functions on final link.
742         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
743         Handle long branch destinations too.
744         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
745         do_plt_address_for_local): Adjust lookup of plt call stubs.
746
747 2012-11-30  Alan Modra  <amodra@gmail.com>
748
749         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
750         relocs against protected symbols when building 32-bit shared libs.
751
752 2012-11-30  Alan Modra  <amodra@gmail.com>
753
754         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
755         param.  Call got_section() to make .got.  Update all callers
756         and their callers and so on.
757
758 2012-11-30  Alan Modra  <amodra@gmail.com>
759
760         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
761         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
762         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
763         value if it already exists.
764
765 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
766
767         PR gold/14858
768         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
769
770 2012-11-14  Roland McGrath  <mcgrathr@google.com>
771
772         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
773         than bfc instruction for data sandboxing.
774
775 2012-11-08  Alan Modra  <amodra@gmail.com>
776
777         * po/POTFILES.in: Regenerate.
778
779 2012-11-05  Alan Modra  <amodra@gmail.com>
780
781         * configure.ac: Apply 2012-09-10 change to config.in here.
782         * configure: Regenerate.
783
784 2012-11-05  Alan Modra  <amodra@gmail.com>
785
786         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
787         (struct Opd_ent): Use "Address" rather than "Offset".
788         (Output_data_got_powerpc::got_base_offset): Return Valtype.
789         (Target_powerpc::got_section): Make public.
790         (Target_powerpc::scan_relocs): Move code setting symbols..
791         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
792         Create _SDA_BASE_ only when referenced.
793
794 2012-11-02  Roland McGrath  <mcgrathr@google.com>
795
796         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
797         from last change.
798
799 2012-11-01  Roland McGrath  <mcgrathr@google.com>
800
801         * target.h (Sized_target::relocate_relocs): Use Elf_Off
802         for offset_in_output_section parameter.
803         (Sized_target::relocate_special_relocatable): Likewise.
804         * arm.cc (Target_arm::relocate_relocs): Likewise.
805         (Target_arm::relocate_special_relocatable): Likewise.
806         * i386.cc (Target_i386::relocate_relocs): Likewise.
807         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
808         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
809         * target-reloc.h (relocate_relocs): Likewise.
810         * testsuite/testfile.cc (Target_test): Likewise.
811         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
812         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
813
814         * system.h: Move inclusion of <clocale> to after <libintl.h> in
815         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
816
817         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
818         parameter, which is unused in the [!F_SETFD] case.
819
820         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
821         SYMNDX to off_t before comparing it to this->data_size().
822         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
823         * incremental.cc (Output_section_incremental_inputs::do_write):
824         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
825
826         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
827
828 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
829
830         * gold.cc (Target_arm::do_adjust_elf_header): Add the
831         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
832         in EABI_VER5.
833
834 2012-10-29  Cary Coutant  <ccoutant@google.com>
835
836         * dwp.cc (usage): Add file and exit status parameters;
837         add --help and --version options.
838         (print_version): New function.
839         (main): Add --help and --version options.
840
841 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
842
843         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
844         final_layout_sequence.txt.
845         * testsuite/Makefile.in: Regenerated.
846
847 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
848
849         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
850         COMPILE generated by automake.
851         (LINK1): Likewise.
852         (CXXCOMPILE1): Likewise.
853         (CXXLINK1): Likewise.
854         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
855         (LINK): Likewise.
856         (CXXCOMPILE): Likewise.
857         (CXXLINK): Likewise.
858         * testsuite/Makefile.in: Regenerated.
859
860 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
861
862         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
863         on bad fwrite return.
864
865 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
866
867         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
868         on val.
869
870 2012-10-23  Cary Coutant  <ccoutant@google.com>
871
872         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
873         * testsuite/Makefile.in: Regenerate.
874         * testsuite/dwp_test.h: New source file.
875         * testsuite/dwp_test_1.cc: New source file.
876         * testsuite/dwp_test_1.s: New source file.
877         * testsuite/dwp_test_1.sh: New source file.
878         * testsuite/dwp_test_1b.cc: New source file.
879         * testsuite/dwp_test_1b.s: New source file.
880         * testsuite/dwp_test_2.cc: New source file.
881         * testsuite/dwp_test_2.s: New source file.
882         * testsuite/dwp_test_2.sh: New source file.
883         * testsuite/dwp_test_main.cc: New source file.
884         * testsuite/dwp_test_main.s: New source file.
885
886 2012-10-23  Cary Coutant  <ccoutant@google.com>
887
888         * dwp.h: New header file.
889         * dwp.cc: New source file.
890         * gold.h: Move shared declarations to system.h.
891         * system.h: New header file.
892         * Makefile.am: Add dwp.
893         * Makefile.in: Regenerate.
894
895 2012-10-23  Cary Coutant  <ccoutant@google.com>
896
897         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
898         Dwarf_info_reader::read_from_pointer.
899         (Dwarf_pubnames_table::read_header): Likewise.
900         (Dwarf_pubnames_table::next_name): Likewise.
901         (Dwarf_die::read_attributes): Likewise.
902         (Dwarf_die::skip_attributes): Likewise.
903         (Dwarf_info_reader::read_from_pointer): New function template.
904         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
905         (Dwarf_pubnames_table): Likewise.
906         (Dwarf_info_reader::read_from_pointer): New function template.
907         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
908         Dwarf_pubnames_table ctor.
909
910 2012-10-23  Cary Coutant  <ccoutant@google.com>
911
912         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
913         abbrev_shndx.
914         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
915         abbrev_shndx_.
916         (Dwarf_info_reader::set_abbrev_shndx): New method.
917         (Dwarf_info_reader::abbrev_shndx_): New data member.
918
919 2012-10-23  Cary Coutant  <ccoutant@google.com>
920
921         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
922         from object, not parameters.
923         (Dwarf_info_reader::parse): Likewise.
924         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
925         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
926         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
927         methods.
928
929 2012-10-23  Cary Coutant  <ccoutant@google.com>
930
931         * fileread.cc (Input_file::Input_file): New constructor.
932         * fileread.h (class Input_file): Add new constructor.
933
934 2012-10-18  Alan Modra  <amodra@gmail.com>
935
936         PR gold/14727
937         * object.cc (Relobj::is_section_name_included): Also match
938         .sdata personality section.
939
940 2012-10-18  Alan Modra  <amodra@gmail.com>
941
942         * target-reloc.h (class Default_comdat_behavior): New, package up..
943         (get_comdat_behaviour): ..this.
944         (relocate_section): Add Relocate_comdat_behavior template arg,
945         adjust code to suit.
946         * arm.cc (Target_arm::relocate_section): Adjust to suit.
947         (Target_arm::scan_reloc_section): Likewise.
948         * i386.cc (Target_i386::relocate_section): Likewise.
949         * sparc.cc (Target_sparc::relocate_section): Likewise.
950         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
951         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
952         * powerpc.cc (class Relocate_comdat_behavior): New.
953         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
954         gold::relocate_section with new template arg.
955
956 2012-10-18  Alan Modra  <amodra@gmail.com>
957
958         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
959         dynamic relocs for GOT_TPREL got entries, without symbol if
960         resolving locally.
961         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
962         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
963         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
964
965 2012-10-17  Alan Modra  <amodra@gmail.com>
966
967         PR gold/14726
968         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
969
970 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
971
972         * layout.cc (Layout::include_section): Keep sections marked
973         SHF_EXCLUDE when doing relocatable links.
974
975 2012-10-16  Alan Modra  <amodra@gmail.com>
976
977         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
978         (Target_powerpc::do_finalize_sections): Call it.
979         (Output_data_save_res): New class and supporting functions.
980         (Target_powerpc::symval_for_branch): Only look up .opd entry for
981         normal symbols defined in object files.
982
983 2012-10-12  Alan Modra  <amodra@gmail.com>
984
985         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
986         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
987         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
988         section if scan_opd_relocs not yet called.
989         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
990
991 2012-10-12  Alan Modra  <amodra@gmail.com>
992
993         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
994         add_local_ifunc_entry): Revert last change.
995         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
996
997 2012-10-05  Alan Modra  <amodra@gmail.com>
998
999         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1000         do_plt_address_for_global): New functions.
1001         (Output_data_got_powerpc::do_write): Don't segfault when linking
1002         statically.
1003         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1004         add_local_ifunc_entry): Return true on adding entry..
1005         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1006         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1007         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1008         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1009         set up symbols here.
1010         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1011         syms here.  Do so even when no .iplt.  Don't segfault when linking
1012         statically.
1013         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1014         new variants without reloc param.
1015         (Glink_sym_ent::Glink_sym_ent): Likewise.
1016         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1017         reloc when refs will resolve to plt call stub.
1018         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1019         R_PPC_PLTREL24 to resolve locally.
1020         (Target_powerpc::Scan::global): Correct ifunc handling.
1021         (Target_powerpc::Relocate::relocate): Correct local sym glink
1022         lookup.  Don't destroy "value" when we have a plt call stub,
1023         and when checking plt call validity.
1024         (Target_powerpc::do_dynsym_value): Simplify.
1025
1026 2012-10-05  Alan Modra  <amodra@gmail.com>
1027
1028         * i386.cc (Output_data_plt_i386::address_for_global,
1029         address_for_local): Add plt offset to returned value.  Adjust uses.
1030         * sparc.cc (Output_data_plt_sparc::address_for_global,
1031         address_for_local): Likewise.
1032         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1033         address_for_local): Likewise.
1034         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1035         address_for_local): Likewise.
1036         * target.h (Target::plt_address_for_global, plt_address_for_local):
1037         Update comment.
1038         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1039         (Output_data_got::Got_entry::write): Nor here.
1040         * output.h: Comment fix.
1041
1042 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1043
1044         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1045         global_offset_table_ value for larget got.
1046         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1047
1048 2012-09-29  Alan Modra  <amodra@gmail.com>
1049
1050         * powerpc.cc (Target_powerpc::iplt_): New output section.
1051         (Target_powerpc::iplt_section, make_iplt_section,
1052         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1053         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1054         Target_powerpc::plt_entry_count): Count iplt entries too.
1055         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1056         reloc section in constructor.  New params.
1057         (Target_powerpc::make_plt_section): Create reloc section here instead.
1058         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1059         functions.
1060         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1061         (Output_data_glink::add_entry, find_entry): New functions to
1062         deal with local syms.
1063         (Glink_sym_ent): Add support for local syms.
1064         (Output_data_glink::do_write): Handle ifunc plt entries.
1065         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1066         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1067         (Target_powerpc::Relocate::relocate): Likewise.
1068         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1069
1070 2012-09-25  Alan Modra  <amodra@gmail.com>
1071
1072         * object.h (Sized_relobj_file::adjust_local_symbol,
1073         do_adjust_local_symbol): New functions.
1074         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1075         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1076         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1077         and irregular opd entry spacing.
1078         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1079         (Global_symbol_visitor_opd): New functor.
1080         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1081         on deleted opd entries.
1082
1083 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1084
1085         * tilegx.cc: New file.
1086         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1087         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1088         * configure.tgt: Add entries for tilegx*.
1089         * configure.ac: Likewise.
1090         * Makefile.in: Rebuild.
1091         * configure: Likewise.
1092         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1093         tilegx.
1094
1095 2012-09-13  Alan Modra  <amodra@gmail.com>
1096
1097         * target-reloc.h (scan_relocs): Call scan.local for relocs
1098         against symbols in discarded sections.  Pass is_discarded
1099         param.
1100         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1101         Add is_discarded param.
1102         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1103         is_discarded to flag opd entry as discarded.  Don't emit dyn
1104         relocs on such entries.
1105         (Target_powerpc::Scan::global): Similarly detect and handle
1106         such opd entries.
1107         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1108         opd_ent_.  Update all uses.
1109         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1110         (Target_powerpc::relocate_section): Zero out discarded opd
1111         entry relocs.
1112
1113 2012-09-12  Ian Lance Taylor  <iant@google.com>
1114
1115         PR gold/14570
1116         * output.cc: Rename Output_data_got template parameter from size
1117         to got_size for all functions.  Compile all variants of
1118         Output_data_got.
1119         (Output_data_got::Got_entry::write): Correct use of size for
1120         symbol value.  Use local_is_tls rather than casting to
1121         Sized_relobj_file.
1122         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1123         (class Sized_relobj_file): Add do_local_is_tls.
1124         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1125
1126 2012-09-11  Alan Modra  <amodra@gmail.com>
1127
1128         PR gold/14566
1129         * layout.cc (Layout::set_segment_offsets): When using
1130         common-page-size alignment, ensure we are on a new max-page-size
1131         page.
1132         * output.cc (Output_segment::set_section_addresses): Use
1133         abi_pagesize, not common_pagesize for relro boundary.
1134         (Output_segment::set_offset): Likewise.
1135
1136 2012-09-11  Alan Modra  <amodra@gmail.com>
1137
1138         * output.h (Output_data_got::add_global_tls, add_local_tls,
1139         add_local_tls_pair): New functions.
1140         (Output_data_got::add_local_pair_with_rel): Remove second
1141         reloc param.  Expand comment.
1142         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1143         use_plt_or_tls_offset_, similarly for constructor param.
1144         (Output_data_got::Got_entry::write): Add got_index param.
1145         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1146         add_local_tls_pair): New functions.
1147         (Output_data_got::Got_entry::write): Handle tls symbols
1148         with use_plt_or_tls_offset_ set specially.
1149         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1150         (Output_data_got::do_write): Replace iterator with index, pass
1151         index to entry write function.
1152         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1153         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1154         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1155         call.
1156         * i386.cc (Target_i386::Scan::local): Likewise.
1157         * sparc.cc (Target_sparc::Scan::local): Likewise.
1158         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1159         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1160         do_tls_offset_for_global): New functions.
1161         (Target_powerpc::Scan::local): Correct TLS relocations and got
1162         entry values.
1163         (Target_powerpc::Scan::global): Don't emit unnecessary
1164         dynamic relocations on TLS GOT entries.
1165
1166 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1167
1168         * config.in: Disable sanity check for kfreebsd.
1169
1170 2012-09-10  Sterling Augustine  <saugustine@google.com>
1171
1172         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1173         (Gdb_index::pubtypes_read): New parameter.
1174         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1175         to calls.
1176         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1177         pubtypes_object_.
1178
1179 2012-09-09  Alan Modra  <amodra@gmail.com>
1180
1181         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1182         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1183         * gc.h (gc_process_relocs): Call target gc_add_reference.
1184         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1185         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1186         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1187         unnecessary cast.
1188         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1189         to cater for when we don't need code offset.  Update use.
1190         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1191         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1192         set_opd_valid): New functions.
1193         (Target_powerpc::do_gc_add_reference): New function.
1194         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1195         stashed refs.
1196         (Target_powerpc::do_gc_mark_symbol): New function.
1197
1198 2012-09-06  Cary Coutant  <ccoutant@google.com>
1199
1200         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1201         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1202         (Dwarf_die::skip_attributes): Likewise.
1203         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1204         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1205         (main): Call it.
1206         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1207
1208 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1209
1210         * testsuite/script_test_3.t: Add .got.plt output section
1211         statement.
1212         * testsuite/script_test_4.t: Likewise.
1213
1214 2012-09-05  Alan Modra  <amodra@gmail.com>
1215
1216         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1217         update all uses and lose "enum" when using type.
1218
1219 2012-09-05  Alan Modra  <amodra@gmail.com>
1220
1221         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1222         * configure: Regenerate.
1223         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1224         (plugin_final_layout.stdout): Likewise.
1225         (memory_test): Set page sizes to 0x1000.
1226         * testsuite/Makefile.in: Regenerate.
1227         * testsuite/discard_locals_test.sh: Add FIXME comment.
1228         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1229         * testsuite/pr14265.t: Add .got output section statement.
1230         * testsuite/script_test_2.t: Likewise.
1231         * testsuite/script_test_3.t: Likewise.
1232         * testsuite/script_test_4.t: Likewise.
1233         * testsuite/script_test_5.t: Likewise.
1234         * testsuite/script_test_6.t: Likewise.
1235         * testsuite/script_test_7.t: Likewise.
1236         * testsuite/script_test_9.t: Likewise.
1237
1238 2012-09-05  Alan Modra  <amodra@gmail.com>
1239
1240         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1241         (Powerpc_relocate_functions::Status): New typedef.
1242         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1243         (Target_powerpc::Scan::local): Handle REL64.
1244         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1245         for REL32 and REL64.
1246         (Target_powerpc::symval_for_branch): New function, extracted from..
1247         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1248         checks.  Report overflow errors.
1249
1250 2012-09-05  Alan Modra  <amodra@gmail.com>
1251
1252         * object.h (Sized_relobj_file::emit_relocs): Delete.
1253         (Sized_relobj_file::emit_relocs_reltype): Delete.
1254         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1255         relocate_relocs for --emit-relocs.
1256         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1257         * output.h: Update comment.
1258         (Output_segment::first_section): New function.
1259         (Output_segment::first_section_load_address): Use first_section.
1260         * output.cc (Output_segment::first_section): New function extracted..
1261         (Output_segment::first_section_load_address): ..from here.  Delete.
1262         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1263         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1264         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1265         adjust call to target.h function.
1266         * i386.cc (Target_i386): Likewise.
1267         * sparc.cc (Target_sparc): Likewise.
1268         * x86_64.cc (Target_x86_64): Likewise.
1269         * powerpc.cc (Target_powerpc): Likewise.
1270         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1271         first tls section has section symbol for optimised local dynamic
1272         output relocs.
1273         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1274         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1275         optimised tls code.
1276         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1277         Rename to relocate_relocs.  Update error message.
1278
1279 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1280
1281         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1282         --just-symbols.
1283
1284 2012-08-31  Alan Modra  <amodra@gmail.com>
1285
1286         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1287         (Powerpc_relobj::toc_base_offset): New stub function.
1288         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1289         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1290         (Target_powerpc::Relocate::enum skip_tls): New.
1291         (Target_powerpc::call_tls_get_addr_): New var.
1292         (Target_powerpc::is_branch_reloc): Move to file scope.
1293         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1294         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1295         New functions.
1296         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1297         (powerpc_info): Correct common_pagesize for ppc64.
1298         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1299         (Powerpc_relocate_functions): Add overflow check enums and functions.
1300         Add non-shift version of rela, rela_ua.  Delete all rel public
1301         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1302         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1303         addr16_ha3, addr14 functions.
1304         (Output_data_got_powerpc::add_constant_pair): New function.
1305         (Output_data_got_powerpc::got_base_offset): Likewise.
1306         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1307         (instruction constants): Sort, add some more.
1308         (Output_data_glink::do_write): Add and use Address typedef.  Use
1309         object->toc_base_offset() stub for 64-bit.
1310         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1311         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1312         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1313         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1314         Always treat .opd relocs as against locally defined symbol.
1315         Correct condition for RELATIVE relocs.
1316         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1317         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1318         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1319         calculations.  Handle TLS relocs, and more.  Add overflow
1320         checking and adjust for Powerpc_relocate_functions changes.
1321         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1322         Reinstate --emit-relocs code with FIXME.
1323
1324 2012-08-30  Alan Modra  <amodra@gmail.com>
1325
1326         * layout.cc (Layout::set_segment_offsets): Set p_align to
1327         abi_pagesize, not common_pagesize.
1328         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1329         to determine whether file header can go in segment.
1330
1331 2012-08-30  Alan Modra  <amodra@gmail.com>
1332
1333         * output.h (Output_reloc::Output_reloc <output section>): Add
1334         is_relative param.  Adjust calls.
1335         (Output_reloc::add_output_section_relative): New functions.
1336         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1337         is_relative.
1338         (Output_reloc::symbol_value): Handle SECTION_CODE.
1339
1340 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1341
1342         * gold.cc (queue_middle_tasks): Call layout again when unique
1343         segments for sections is desired.
1344         * layout.cc (Layout::Layout): Initialize new members.
1345         (Layout::get_output_section_flags): New function.
1346         (Layout::choose_output_section): Call get_output_section_flags.
1347         (Layout::layout): Make output section for mapping to a unique segment.
1348         (Layout::insert_section_segment_map): New function.
1349         (Layout::attach_allocated_section_to_segment): Make unique segment for
1350         output sections marked so.
1351         (Layout::segment_precedes): Check for unique segments when sorting.
1352         * layout.h (Layout::Unique_segment_info): New struct.
1353         (Layout::Section_segment_map): New typedef.
1354         (Layout::insert_section_segment_map): New function.
1355         (Layout::get_output_section_flags): New function.
1356         (Layout::is_unique_segment_for_sections_specified): New function.
1357         (Layout::set_unique_segment_for_sections_specified): New function.
1358         (Layout::unique_segment_for_sections_specified_): New member.
1359         (Layout::section_segment_map_): New member.
1360         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1361         Rename is_gc_pass_one to is_pass_one.
1362         Rename is_gc_pass_two to is_pass_two.
1363         Rename is_gc_or_icf to is_two_pass.
1364         Check for which pass based on whether symbols data is present.
1365         Make it two pass when unique segments for sections is desired.
1366         * output.cc (Output_section::Output_section): Initialize new
1367         members.
1368         * output.h (Output_section::is_unique_segment): New function.
1369         (Output_section::set_is_unique_segment): New function.
1370         (Output_section::is_unique_segment_): New member.
1371         (Output_section::extra_segment_flags): New function.
1372         (Output_section::set_extra_segment_flags): New function.
1373         (Output_section::extra_segment_flags_): New member.
1374         (Output_section::segment_alignment): New function.
1375         (Output_section::set_segment_alignment): New function.
1376         (Output_section::segment_alignment_): New member.
1377         (Output_segment::Output_segment): Initialize is_unique_segment_.
1378         (Output_segment::is_unique_segment): New function.
1379         (Output_segment::set_is_unique_segment): New function.
1380         (Output_segment::is_unique_segment_): New member.
1381         * plugin.cc (allow_unique_segment_for_sections): New function.
1382         (unique_segment_for_sections): New function.
1383         (Plugin::load): Add new functions to transfer vector.
1384         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1385         * Makefile.in: Regenerate.
1386         * testsuite/plugin_final_layout.sh: Check if unique segment
1387         functionality works.
1388         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1389         are available.
1390         (allow_unique_segment_for_sections): New global.
1391         (unique_segment_for_sections): New global.
1392         (claim_file_hook): Call allow_unique_segment_for_sections.
1393         (all_symbols_read_hook): Call unique_segment_for_sections.
1394
1395 2012-08-22  Cary Coutant  <ccoutant@google.com>
1396
1397         * layout.cc (Layout::include_section): Don't assert on GROUP
1398         sections with --emit-relocs.
1399
1400 2012-08-21  Cary Coutant  <ccoutant@google.com>
1401
1402         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1403         if --export-dynamic-symbol names an undef symbol.
1404
1405 2012-08-18  Alan Modra  <amodra@gmail.com>
1406
1407         * powerpc.cc: Formatting and white space.
1408         (Powerpc_relobj): Rename got2_section_ to special_.
1409         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1410         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1411         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1412         (Target_powerpc): Add Address typedef and invalid_address.  Use
1413         throughout.
1414         (Target_powerpc::is_branch_reloc): New function.
1415         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1416         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1417         for dst_mask, value and addend.
1418         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1419         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1420         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1421         uint16_t for 24-bit offset.  Use get_output_section_offset and
1422         check return.
1423         (Target_powerpc::Scan::local): Handle more relocs.
1424         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1425         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1426         Plug in toc restoring insn after plt calls.  Translate branches
1427         to function descriptor symbols to corresponding entry point.
1428         (Target_powerpc::relocate_for_relocatable): Check return from
1429         get_output_section_offset.
1430         * symtab.h: Comment typo.
1431
1432 2012-08-14  Ian Lance Taylor  <iant@google.com>
1433
1434         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1435         unsupported_relocal_local to call unsupported_reloc_global.
1436
1437 2012-08-14  Nick Clifton  <nickc@redhat.com>
1438
1439         PR ld/14265
1440         * script-sections.cc (Sections_element::output_section_name): Add
1441         keep return parameter.
1442         (Output_section_element::match_name): Add keep return parameter.
1443         Return the value of the keep_ member.
1444         * script-sections.h (class Output_section): Update
1445         output_section_name prototype.
1446         * layout.cc (Layout::keep_input_section): New public member
1447         function.
1448         (Layout::choose_output_section): Pass keep parameter to
1449         output_section_name.
1450         * layout.h (class Layout): Add keep_input_section.
1451         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1452         sections.
1453         * testsuite/Makefile.am: Add a test.
1454         * testsuite/Makefile.in: Regenerate.
1455         * testsuite/pr14265.c: Source file for the test.
1456         * testsuite/pr14265.t: Linker script for the test.
1457         * testsuite/pr14265.sh: Shell script for the test.
1458
1459 2012-08-14  Alan Modra  <amodra@gmail.com>
1460
1461         * target.h (Target::output_section_name): New function.
1462         (Target::do_output_section_name): New function.
1463         * layout.cc (Layout::choose_output_section): Call the above.
1464         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1465
1466 2012-08-14  Alan Modra  <amodra@gmail.com>
1467
1468         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1469         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1470         for replace_constant call.
1471         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1472         (Output_data_glink::do_print_to_mapfile): New function.
1473         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1474         (Target_powerpc::Relocate::relocate): Likewise.
1475
1476 2012-08-14  Alan Modra  <amodra@gmail.com>
1477
1478         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1479         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1480         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1481         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1482         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1483         here.
1484         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1485         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1486         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1487         here.
1488         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1489         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1490
1491 2012-08-12  Alan Modra  <amodra@gmail.com>
1492
1493         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1494         (glink insn constants): Use uint32_t.
1495         (Output_data_glink::add_entry): Use insert, not [] operator.
1496
1497 2012-08-11  Alan Modra  <amodra@gmail.com>
1498
1499         * object.h (Sized_relobj_file::find_shdr): New function.
1500         (Sized_relobj_file::find_special_sections): New function.
1501         * object.cc (Sized_relobj_file::find_shdr): New function.
1502         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1503         (Sized_relobj_file::find_special_sections): New function, split out..
1504         (Sized_relobj_file::do_read_symbols): ..from here.
1505         * output.h (Output_data_got::replace_constant): New function.
1506         (Output_data_got::num_entries): New function.
1507         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1508         (Output_data_got::got_offset): Protected rather than private.
1509         (Output_data_got::replace_got_entry): New function.
1510         * output.cc (Output_data_got::replace_got_entry): New function.
1511         * powerpc.cc (class Powerpc_relobj): New.
1512         (class Powerpc_relocate_functions): Delete all psymval variants or
1513         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1514         Implement _ha functions using corresponding _hi function.
1515         (Powerpc_relobj::find_special_sections): New function.
1516         (Target_powerpc::do_make_elf_object): New function.
1517         (class Output_data_got_powerpc): New.
1518         (class Output_data_glink): New.
1519         (class Powerpc_scan_relocatable_reloc): New.
1520         Many more changes througout file.
1521
1522 2012-08-09  Nick Clifton  <nickc@redhat.com>
1523
1524         * po/vi.po: Updated Vietnamese translation.
1525
1526 2012-08-07  Ian Lance Taylor  <iant@google.com>
1527
1528         * layout.cc (Layout::add_target_dynamic_tags): If
1529         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1530         plt_rel.
1531
1532 2012-07-30  Nick Clifton  <nickc@redhat.com>
1533
1534         * po/gold.pot: Updated template.
1535         * po/es.po: Updated Spanish translation.
1536
1537 2012-07-18  Cary Coutant  <ccoutant@google.com>
1538
1539         PR gold/14344
1540         * configure.ac: Add check for -gpubnames support.
1541         * configure: Regenerate.
1542         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1543         support; force -gno-pubnames.
1544         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1545         support.
1546         (gdb_index_test_4): New test.
1547         * testsuite/Makefile.in: Regenerate.
1548         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1549         * testsuite/gdb_index_test_2.sh: Likewise.
1550         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1551         * testsuite/gdb_index_test_4.sh: New script.
1552         * testsuite/gdb_index_test_comm.sh: New script with common code;
1553         don't look for space after colon.
1554
1555 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1556
1557         * gold.cc (queue_middle_tasks): Update function order only after
1558         deferred objects due to plugins are processed.
1559
1560 2012-07-11  Ian Lance Taylor  <iant@google.com>
1561
1562         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1563         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1564         (Target_arm::scan_reloc_for_stub): Likewise.
1565         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1566         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1567         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1568         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1569         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1570
1571 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1572             Ian Lance Taylor  <iant@google.com>
1573
1574         PR gold/14309
1575         * configure.ac: Test whether std::tr1::hash<off_t> works.
1576         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1577         needed.
1578         * output.h (class Output_fill): Add virtual destructor.
1579         * configure, config.in: Rebuild.
1580
1581 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1582
1583         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1584
1585 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1586
1587         * plugin.cc (Plugin::load): Handle position independent executables.
1588
1589 2012-06-06  Cary Coutant  <ccoutant@google.com>
1590
1591         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1592         add .debug_macro.
1593         (lines_only_debug_sections): Likewise.
1594         (gdb_fast_lookup_sections): New static array.
1595         (is_gdb_debug_section): Rename formal parameter.
1596         (is_lines_only_debug_section): Likewise.
1597         (is_gdb_fast_lookup_section): New function.
1598         (Layout::include_section): Check for ".zdebug_" prefix; pass
1599         section name suffix to is_gdb_debug_section, et al.; check for
1600         fast-lookup sections when building .gdb_index.
1601         * options.h (--strip-debug-gdb): Update GDB version number.
1602
1603 2012-06-06  Cary Coutant  <ccoutant@google.com>
1604
1605         * configure.ac: Add check for fallocate.
1606         * configure: Regenerate.
1607         * config.in: Regenerate.
1608
1609         * options.h (class General_options): Add --mmap-output-file and
1610         --posix-fallocate options.
1611         * output.cc: (posix_fallocate): Remove; replace with...
1612         (gold_fallocate): New function.
1613         (Output_file::map_no_anonymous): Call gold_fallocate.
1614         (Output_file::map): Check --mmap-output-file option.
1615
1616 2012-06-05  Jing Yu  <jingyu@google.com>
1617
1618         * gold.h (textdomain): Add do {} to empty while(0).
1619         (bindtextdomain): Likewise.
1620
1621 2012-06-04  Cary Coutant  <ccoutant@google.com>
1622
1623         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1624         has_dynsym_index.
1625
1626 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1627
1628         * symtab.cc (Symbol_table::define_special_symbol):
1629         Initialize *poldsym to prevent uninitialized variable errors.
1630
1631 2012-05-23  Cary Coutant  <ccoutant@google.com>
1632
1633         * layout.cc (Layout::section_name_mapping): Add rules to handle
1634         exact match on .data.rel.ro.local or .data.rel.ro.
1635         (Layout::output_section_name): Check for exact matches.
1636
1637 2012-05-23  Cary Coutant  <ccoutant@google.com>
1638
1639         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1640         more carefully.
1641
1642 2012-05-22  Cary Coutant  <ccoutant@google.com>
1643
1644         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1645         object before exporting symbol.
1646
1647 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1648
1649         * testsuite/tls_test.cc: Include "config.h" first.
1650         * testsuite/tls_test_c.c: Likewise.
1651
1652 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1653             Nick Clifton  <nickc@redhat.com>
1654
1655         PR 14072
1656         * configure.in: Add check that sysdep.h has been included before
1657         any system header files.
1658         * configure: Regenerate.
1659         * config.in: Regenerate.
1660
1661 2012-05-14  Cary Coutant  <ccoutant@google.com>
1662
1663         * layout.cc (Layout::make_output_section): Mark .tdata section
1664         as RELRO.
1665         * testsuite/relro_test.cc: Add a TLS variable.
1666
1667 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1668
1669         PR gold/14091
1670         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1671         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1672         R_X86_64_64.
1673
1674 2012-05-08  Cary Coutant  <ccoutant@google.com>
1675
1676         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1677         (lines_only_debug_sections): Likewise.
1678
1679 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1680
1681         * nacl.cc: New file.
1682         * nacl.h: New file.
1683         * Makefile.am (CCFILES, HFILES): Add them.
1684         * Makefile.in: Regenerate.
1685         * i386.cc (Output_data_plt_i386_nacl): New class.
1686         (Output_data_plt_i386_nacl_exec): New class.
1687         (Output_data_plt_i386_nacl_dyn): New class.
1688         (Target_i386_nacl): New class.
1689         (Target_selector_i386_nacl): New class.
1690         (target_selector_i386): Use it instead of Target_selector_i386.
1691         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1692         (Target_x86_64_nacl): New class.
1693         (Target_selector_x86_64_nacl): New class.
1694         (target_selector_x86_64, target_selector_x32): Use it instead of
1695         Target_selector_x86_64.
1696         * arm.cc (Output_data_plt_arm_nacl): New class.
1697         (Target_arm_nacl): New class.
1698         (Target_selector_arm_nacl): New class.
1699         (target_selector_arm, target_selector_armbe): Use it instead of
1700         Target_selector_arm.
1701
1702         * target-select.cc (select_target): Take new Input_file* and off_t
1703         arguments, pass them on to recognize method of selector.
1704         * object.cc (make_elf_sized_object): Update caller.
1705         * parameters.cc (parameters_force_valid_target): Likewise.
1706         * incremental.cc (make_sized_incremental_binary): Likewise.
1707         * target-select.h: Update decl.
1708         (Target_selector::recognize): Take new Input_file* argument,
1709         pass it on to do_recognize.
1710         (Target_selector::do_recognize): Take new Input_file* argument.
1711         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1712         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1713         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1714         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1715
1716         * target.h (Target::Target_info): New members isolate_execinstr
1717         and rosegment_gap.
1718         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1719         * arm.cc (Target_arm::arm_info): Update initializer.
1720         * i386.cc (Target_i386::i386_info): Likewise.
1721         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1722         * sparc.cc (Target_sparc::sparc_info): Likewise.
1723         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1724         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1725         * layout.cc (Layout::attach_allocated_section_to_segment):
1726         Take new const Target* argument.  If target->isolate_execinstr(), act
1727         like --rosegment.
1728         (Layout::find_first_load_seg): Take new const Target* argument;
1729         if target->isolate_execinstr(), reject PF_X segments.
1730         (Layout::relaxation_loop_body): Update caller.
1731         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1732         reset file offset to zero when we hit LOAD_SEG, and then do a second
1733         loop over the segments before LOAD_SEG to reassign offsets after
1734         addresses have been determined.  Handle target->rosegment_gap().
1735         (Layout::attach_section_to_segment): Take new const Target* argument;
1736         pass it to attach_allocated_section_to_segment.
1737         (Layout::make_output_section): Update caller.
1738         (Layout::attach_sections_to_segments): Take new const Target* argument;
1739         pass it to attach_section_to_segment.
1740         * gold.cc (queue_middle_tasks): Update caller.
1741         * layout.h (Layout): Update method decls with new arguments.
1742
1743         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1744         Target_info pointer to use.
1745         (Target_arm::do_make_data_plt): New virtual method.
1746         (Target_arm::make_data_plt): New method that calls it.
1747         (Target_arm::make_plt_entry): Use it.
1748         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1749         for the section alignment.
1750         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1751         method.
1752         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1753         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1754         method.
1755         (Output_data_plt_arm::get_plt_entry_size): Call it.
1756         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1757         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1758         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1759         method.
1760         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1761         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1762         method instead of sizeof(plt_entry).
1763         (Output_data_plt_arm::add_entry): Likewise.
1764         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1765         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1766         than static method.
1767         (Target_arm::plt_entry_size): Likewise.
1768         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1769         Move to ...
1770         (Output_data_plt_arm_standard): ... here, new class.
1771         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1772         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1773         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1774
1775         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1776         Take additional argument for the PLT entry size.
1777         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1778         Use get_plt_entry_size method rather than plt_entry_size variable.
1779         (Output_data_plt_x86_64::reserve_slot): Likewise.
1780         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1781         (Output_data_plt_x86_64::add_entry): Likewise.
1782         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1783         (Output_data_plt_x86_64::address_for_global): Likewise.
1784         (Output_data_plt_x86_64::address_for_local): Likewise.
1785         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1786         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1787         Make method non-static.
1788         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1789         method.
1790         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1791         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1792         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1793         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1794         virtual method.
1795         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1796         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1797         virtual method.
1798         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1799         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1800         virtual method.
1801         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1802         (Output_data_plt_x86_64::plt_entry_size)
1803         (Output_data_plt_x86_64::first_plt_entry)
1804         (Output_data_plt_x86_64::plt_entry)
1805         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1806         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1807         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1808         (Output_data_plt_x86_64_standard): ... here, new class.
1809         (Target_x86_64::Target_x86_64): Take optional argument for the
1810         Target_info pointer to use.
1811         (Target_x86_64::do_make_data_plt): New virtual method.
1812         (Target_x86_64::make_data_plt): New method to call it.
1813         (Target_x86_64::init_got_plt_for_update): Use that.
1814         Call this->plt_->add_eh_frame method here.
1815         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1816         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1817         rather than static method.
1818         (Target_x86_64::plt_entry_size): Likewise.
1819         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1820         rather than plt_entry_size variable.  Move guts of PLT filling to...
1821         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1822         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1823         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1824
1825         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1826         additional argument for the section alignment.
1827         Don't do add_eh_frame_for_plt here.
1828         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1829         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1830         variable.
1831         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1832         method.
1833         (Output_data_plt_i386::get_plt_entry_size): Call it.
1834         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1835         (Output_data_plt_i386::add_eh_frame): New method to call it.
1836         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1837         method.
1838         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1839         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1840         method.
1841         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1842         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1843         method instead of plt_entry_size.
1844         (Output_data_plt_i386::plt_entry_size)
1845         (Output_data_plt_i386::plt_eh_frame_fde_size)
1846         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1847         (Output_data_plt_i386_standard): ... here, new class.
1848         (Output_data_plt_i386_exec): New class.
1849         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1850         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1851         (Output_data_plt_i386::exec_plt_entry): Move to ...
1852         (Output_data_plt_i386_exec::plt_entry): ... here.
1853         (Output_data_plt_i386_dyn): New class.
1854         (Output_data_plt_i386::first_plt_entry): Move to ...
1855         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1856         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1857         (Output_data_plt_i386_dyn::plt_entry): ... here.
1858         (Target_i386::Target_i386): Take optional argument for the Target_info
1859         pointer to use.
1860         (Target_i386::do_make_data_plt): New virtual method.
1861         (Target_i386::make_data_plt): New method to call it.
1862         (Target_i386::make_plt_section): Use that.
1863         Call this->plt_->add_eh_frame method here.
1864         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1865         rather than plt_entry_size variable.
1866         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1867         (Output_data_plt_i386::address_for_local): Likewise.
1868         (Output_data_plt_i386::do_write): Likewise.
1869         Move guts of PLT filling to...
1870         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1871         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1872         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1873         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1874
1875 2012-05-01  Cary Coutant  <ccoutant@google.com>
1876
1877         * dwarf_reader.cc (Dwarf_die::read_attributes)
1878         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1879         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1880         * reduced_debug_output.cc
1881         (Output_reduced_debug_info_section::get_die_end): Remove
1882         DW_FORM_GNU_ref_index.  Add default case.
1883
1884 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1885
1886         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1887         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1888         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1889         DW_AT_high_pc as offset from DW_AT_low_pc.
1890
1891         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1892         * testsuite/Makefile.in: Regenerate.
1893         * testsuite/gdb_index_test_3.c: New test source file.
1894         * testsuite/gdb_index_test_3.sh: New test source file.
1895
1896 2012-04-25  Ian Lance Taylor  <iant@google.com>
1897
1898         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1899         pointer.
1900         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1901         as a class, not a struct.
1902         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1903         (Target_arm::apply_cortex_a8_workaround): Likewise.
1904         * gc.h: Declare Reloc_types as a struct, not a class.
1905         * object.h: Declare Symbols_data as a struct.
1906         * reloc.h: Declare Read_relocs_data as a struct.
1907         * target.h: Declare Relocate_info as a struct.
1908
1909 2012-04-24  David S. Miller  <davem@davemloft.net>
1910
1911         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1912         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1913         and R_SPARC_WPLT30.
1914
1915 2012-04-24  Cary Coutant  <ccoutant@google.com>
1916
1917         * incremental-dump.cc (find_input_containing_global): Replace
1918         magic number with symbolic constant.
1919         (dump_incremental_inputs): Update version number.
1920         * incremental.cc (Output_section_incremental_inputs): Update version
1921         number; import symbolic constants from Incremental_inputs_reader.
1922         (Incremental_inputs::create_data_sections): Align relocations
1923         section correctly for 64-bit targets.
1924         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1925         constants; add padding.
1926         (Output_section_incremental_inputs::write_header): Add assert for
1927         header_size.
1928         (Output_section_incremental_inputs::write_input_files): Add assert
1929         for input_entry_size.
1930         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1931         add assert for object_info_size, input_section_entry_size,
1932         global_sym_entry_size.
1933         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1934         for data structure sizes; use them.
1935         (Incremental_input_entry_reader): Import symbolic constants from
1936         Incremental_inputs_reader; use them.
1937
1938 2012-04-23  David S. Miller  <davem@davemloft.net>
1939
1940         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1941         and elf_flags_set_.
1942         (Target_sparc::Target_sparc): Initialize new fields.
1943         (Target_sparc::do_make_elf_object): New function.
1944         (Target_sparc::do_adjust_elf_header): New function.
1945
1946 2012-04-23  Cary Coutant  <ccoutant@google.com>
1947
1948         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1949         CU range table of gdb index.
1950
1951 2012-04-20  David S. Miller  <davem@davemloft.net>
1952
1953         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1954         instead of false.
1955
1956 2012-04-16  David S. Miller  <davem@davemloft.net>
1957
1958         * sparc.cc (Target_sparc::got_address): New function.
1959         (Sparc_relocate_functions::gdop_hix22): New function.
1960         (Sparc_relocate_functions::gdop_lox10): New function.
1961         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1962         relocs.
1963         (Target_sparc::Scan::local): Likewise if the global symbol is not
1964         preemptible and is not IFUNC.
1965         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1966         transformations for local and non-preemptible non-IFUNC global
1967         symbols.
1968
1969         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1970         writing out 64-bit part of ranges.
1971
1972         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1973         -fpic and -fpie respectively.
1974         * Makefile.in: Regenerate.
1975
1976         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1977         (Target_sparc::Target_sparc): Initialize new field.
1978         (Target_sparc::do_plt_section_for_global): New function.
1979         (Target_sparc::do_plt_section_for_local): New function.
1980         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1981         (Target_sparc::make_plt_section): New function, broken out of
1982         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1983         (Target_sparc::make_plt_entry): Call make_plt_section.
1984         (Target_sparc::make_local_ifunc_plt_entry): New function.
1985         (Target_sparc::rela_ifunc_section): New function.
1986         (Target_sparc::plt_section): Remove const.
1987         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1988         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1989         and ifunc_count_ fields.
1990         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1991         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1992         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1993         (Output_data_plt_sparc::rela_ifunc): New function.
1994         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1995         (Output_data_plt_sparc::has_ifunc_section): New function.
1996         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1997         (Output_data_plt_sparc::address_for_global): New function.
1998         (Output_data_plt_sparc::address_for_local): New function.
1999         (Output_data_plt_sparc::plt_index_to_offset): New function.
2000         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2001         and entry_count.
2002         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2003         entry_count.
2004         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2005         R_SPARC_JMP_IREL to switch.
2006         (Target_sparc::Scan::check_non_pic): Likewise.
2007         (Target_sparc::Scan::local): Handle IFUNC symbols.
2008         (Target_sparc::Scan::local): Likewise.
2009         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2010         and plt_address_for_local.
2011         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2012         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2013
2014         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2015         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2016         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2017         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2018         global relocs too.
2019         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2020         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2021         calls.
2022         * sparc.cc (Target_sparc::Scan::global): Likewise.
2023         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2024
2025 2012-04-16  Cary Coutant  <ccoutant@google.com>
2026
2027         * archive.cc (Library_base::should_include_member): Check for
2028         --export-dynamic-symbol.
2029         * options.h (class General_options): Add --export-dynamic-symbol.
2030         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2031         --export-dynamic-symbol.
2032         (Symbol_table::gc_mark_undef_symbols): Likewise.
2033         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2034
2035 2012-04-12  David S. Miller  <davem@davemloft.net>
2036
2037         * sparc.cc (Reloc::wdisp10): New relocation method.
2038         (Reloc::h34): Likewise.
2039         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2040         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2041         R_SPARC_WDISP10.
2042         (Target_sparc::Scan::local): Likewise.
2043         (Target_sparc::Scan::global): Likewise.
2044         (Target_sparc::Relocate::relocate): Likewise.
2045
2046 2012-04-09  Cary Coutant  <ccoutant@google.com>
2047
2048         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2049         low_pc == 0.
2050
2051 2012-04-06  Ian Lance Taylor  <iant@google.com>
2052
2053         * timer.cc: #include <unistd.h>.
2054
2055 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2056
2057         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2058         * config.in: Regenerate.
2059         * configure: Regenerate.
2060
2061 2012-04-05  Nick Clifton  <nickc@redhat.com>
2062
2063         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2064         (AM_LC_MESSAGES): Add.
2065         * aclocal.m4: Regenerate.
2066         * config.in: Regenerate.
2067         * configure: Regenerate.
2068
2069 2012-03-21  Cary Coutant  <ccoutant@google.com>
2070
2071         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2072         * Makefile.in: Regenerate.
2073         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2074         (Sized_elf_reloc_mapper::symbol_section): New function.
2075         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2076         (make_elf_reloc_mapper): New function.
2077         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2078         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2079         (Dwarf_abbrev_table::do_get_abbrev): New function.
2080         (Dwarf_ranges_table::read_ranges_table): New function.
2081         (Dwarf_ranges_table::read_range_list): New function.
2082         (Dwarf_pubnames_table::read_section): New function.
2083         (Dwarf_pubnames_table::read_header): New function.
2084         (Dwarf_pubnames_table::next_name): New function.
2085         (Dwarf_die::Dwarf_die): New function.
2086         (Dwarf_die::read_attributes): New function.
2087         (Dwarf_die::skip_attributes): New function.
2088         (Dwarf_die::set_name): New function.
2089         (Dwarf_die::set_linkage_name): New function.
2090         (Dwarf_die::attribute): New function.
2091         (Dwarf_die::string_attribute): New function.
2092         (Dwarf_die::int_attribute): New function.
2093         (Dwarf_die::uint_attribute): New function.
2094         (Dwarf_die::ref_attribute): New function.
2095         (Dwarf_die::child_offset): New function.
2096         (Dwarf_die::sibling_offset): New function.
2097         (Dwarf_info_reader::check_buffer): New function.
2098         (Dwarf_info_reader::parse): New function.
2099         (Dwarf_info_reader::do_parse): New function.
2100         (Dwarf_info_reader::do_read_string_table): New function.
2101         (Dwarf_info_reader::lookup_reloc): New function.
2102         (Dwarf_info_reader::get_string): New function.
2103         (Dwarf_info_reader::visit_compilation_unit): New function.
2104         (Dwarf_info_reader::visit_type_unit): New function.
2105         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2106         Sized_elf_reloc_mapper.
2107         (Sized_dwarf_line_info::symbol_section): Remove function.
2108         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2109         (Sized_dwarf_line_info::read_line_mappings): Remove object
2110         parameter, adjust callers.
2111         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2112         * dwarf_reader.h: Include <sys/types.h>.
2113         (class Track_relocs): Remove forward declaration.
2114         (class Elf_reloc_mapper): New class.
2115         (class Sized_elf_reloc_mapper): New class.
2116         (class Dwarf_abbrev_table): New class.
2117         (class Dwarf_range_list): New class.
2118         (class Dwarf_ranges_table): New class.
2119         (class Dwarf_pubnames_table): New class.
2120         (class Dwarf_die): New class.
2121         (class Dwarf_info_reader): New class.
2122         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2123         (Sized_dwarf_line_info::symbol_section): Remove member function.
2124         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2125         base class.
2126         * gdb-index.cc: New source file.
2127         * gdb-index.h: New source file.
2128         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2129         and .debug_types sections, call Layout::add_to_gdb_index.
2130         (Sized_relobj_incr::do_section_name): Implement.
2131         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2132         return type; Implement.
2133         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2134         return type.
2135         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2136         parameter list and return type.
2137         (Sized_incr_dynobj::do_section_contents): Likewise.
2138         * layout.cc: Include gdb-index.h.
2139         (Layout::Layout): Initialize gdb_index_data_.
2140         (Layout::init_fixed_output_section): Check for .gdb_index section.
2141         (Layout::add_to_gdb_index): New function. Instantiate.
2142         * layout.h: Add forward declaration for class Gdb_index.
2143         (Layout::add_to_gdb_index): New member function.
2144         (Layout::gdb_index_data_): New data member.
2145         * main.cc: Include gdb-index.h.
2146         (main): Print statistics for gdb index.
2147         * object.cc (Object::section_contents): Move code into
2148         do_section_contents.
2149         (need_decompressed_section): Check for sections needed when building
2150         gdb index.
2151         (build_compressed_section_map): Likewise.
2152         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2153         gdb index.
2154         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2155         sections; call Layout::add_to_gdb_index.
2156         (Sized_relobj_file::do_decompressed_section_contents): Call
2157         do_section_contents directly.
2158         * object.h (Object::do_section_contents): Adjust parameter list and
2159         return type.
2160         (Object::do_decompressed_section_contents): Call do_section_contents
2161         directly.
2162         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2163         return type.
2164         * options.h (class General_options): Add --gdb-index option.
2165         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2166         list and return type.
2167         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2168         * reloc.h (Track_relocs::checkpoint): New function.
2169         (Track_relocs::reset): New function.
2170
2171         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2172         New test cases.
2173         * testsuite/Makefile.in: Regenerate.
2174         * testsuite/gdb_index_test.cc: New test source file.
2175         * testsuite/gdb_index_test_1.sh: New test source file.
2176         * testsuite/gdb_index_test_2.sh: New test source file.
2177
2178 2012-03-19  Doug Kwan  <dougkwan@google.com>
2179
2180         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2181         (Target_arm::do_finalize_sections): Remove code which defines
2182         __exidx_start and __exidx_end.  Make symbol table parameter
2183         anonymous as it is not used.
2184         * gold.cc (queue_middle_tasks): Call target hook to define any
2185         target-specific symbols.
2186         * target.h (Target::define_standard_symbols): New method.
2187         (Target::do_define_standard_symbols): Same.
2188         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2189         * testsuite/Makefile.in: Regenerate.
2190         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2191         and __exidx_end.
2192         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2193         relocations are generated for __exidx_start and __exidx_end.
2194
2195 2012-03-16  Doug Kwan  <dougkwan@google.com>
2196
2197         * testsuite/Makefile.am: Disable test initpri3b.
2198         * testsuite/Makefile.in: Regenerate.
2199
2200 2012-03-15  Doug Kwan  <dougkwan@google.com>
2201
2202         * arm.cc (Target_arm::got_section): Make .got section read-only
2203         if -z now is given.
2204
2205 2012-03-15  Ian Lance Taylor  <iant@google.com>
2206
2207         PR gold/13850
2208         * layout.cc (Layout::make_output_section): Correctly mark
2209         SHT_INIT_ARRAY, et. al., as relro.
2210
2211 2012-03-14  Doug Kwan  <dougkwan@google.com>
2212
2213         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2214         dynamic relocations for protected symbols in shared objects.
2215
2216 2012-03-13  Ian Lance Taylor  <iant@google.com>
2217
2218         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2219         keep the larger alignment.
2220
2221 2012-03-12  Cary Coutant  <ccoutant@google.com>
2222
2223         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2224         handling of DW_LNE_define_file.
2225
2226 2012-03-12  Cary Coutant  <ccoutant@google.com>
2227
2228         * reduced_debug_output.cc
2229         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2230         codes to switch.
2231
2232 2012-02-29  Cary Coutant  <ccoutant@google.com>
2233
2234         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2235
2236 2012-02-29  Cary Coutant  <ccoutant@google.com>
2237
2238         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2239         Call Object::decompressed_section_contents.
2240         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2241         New dtor.
2242         (Sized_dwarf_line_info::buffer_start_): New data member.
2243         * merge.cc (Output_merge_data::do_add_input_section): Call
2244         Object::decompressed_section_contents.
2245         (Output_merge_string::do_add_input_section): Likewise.
2246         * object.cc (need_decompressed_section): New function.
2247         (build_compressed_section_map): Decompress sections needed later.
2248         (Sized_relobj_file::do_decompressed_section_contents): New function.
2249         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2250         * object.h (Object::decompressed_section_contents): New function.
2251         (Object::discard_decompressed_sections): New function.
2252         (Object::do_decompressed_section_contents): New function.
2253         (Object::do_discard_decompressed_sections): New function.
2254         (Compressed_section_info): New type.
2255         (Compressed_section_map): Include decompressed section contents.
2256         (Sized_relobj_file::do_decompressed_section_contents): New function.
2257         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2258
2259 2012-02-16  Cary Coutant  <ccoutant@google.com>
2260
2261         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2262         * testsuite/Makefile.in: Regenerate.
2263
2264 2012-02-14  Cary Coutant  <ccoutant@google.com>
2265
2266         * options.cc (General_options::finalize): Disallow -pie and -static.
2267
2268 2012-02-03  Doug Kwan  <dougkwan@google.com>
2269
2270         * arm.cc (Arm_relocate_functions::abs8,
2271         Arm_relocate_functions::abs16): Use
2272         Bits::has_signed_unsigned_overflow32.
2273         (Arm_relocate_functions::thm_abs8): Correct range of
2274         overflow check.
2275         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2276         in assertions.
2277
2278 2012-02-02  Doug Kwan  <dougkwan@google.com>
2279
2280         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2281         position independent outputs, not just shared objects.
2282
2283 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2284
2285         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2286         * configure: Regenerated.
2287
2288 2012-01-27  Ian Lance Taylor  <iant@google.com>
2289
2290         * reloc.h (Bits): New class with static functions, copied from
2291         namespace utils in arm.cc.
2292         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2293         instead.
2294
2295 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2296
2297         * incremental.cc (write_info_blocks): Correct relocation offset.
2298
2299 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2300
2301         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2302         (Relocate::tls_gd_to_le): Likewise.
2303
2304 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2305
2306         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2307
2308 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2309
2310         * configure.ac: Check if -mcmodel=medium works.
2311         * configure: Regenerated.
2312
2313 2012-01-24  Cary Coutant  <ccoutant@google.com>
2314
2315         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2316         definition and ...
2317         (read_unsigned_LEB_128_x): ... this new function.
2318         (read_signed_LEB_128): Replaced with inline definition and ...
2319         (read_signed_LEB_128_x): ... this new function.
2320         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2321         (read_unsigned_LEB_128): Add inline definition.
2322         (read_signed_LEB_128_x): New function.
2323         (read_signed_LEB_128): Add inline definition.
2324         * testsuite/Makefile.am (leb128_unittest): New unit test.
2325         * testsuite/Makefile.in: Regenerate.
2326         * testsuite/leb128_unittest.cc: New unit test.
2327
2328 2012-01-23  Ian Lance Taylor  <iant@google.com>
2329
2330         PR gold/13617
2331         * i386.cc (Target_i386::do_code_fill): When using a jmp
2332         instruction, pad with nop instructions.
2333         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2334
2335 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2336
2337         * x86_64.cc (gc_process_relocs): Add typename on types used in
2338         template.
2339         (scan_relocs): Likewise.
2340         (relocate_section): Likewise.
2341         (apply_relocation): Likewise.
2342
2343 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2344
2345         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2346         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2347         under x32.
2348
2349 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2350
2351         * x86_64.cc: Initial support for x32.
2352
2353 2012-01-03  Cary Coutant  <ccoutant@google.com>
2354
2355         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2356         Use abstract base class for GOT.
2357         * gold/output.h (class Output_data_got_base): New abstract base class.
2358         (class Output_data_got): Derive from new base class, adjust ctors.
2359         (Output_data_got::reserve_slot): Make virtual; rename to
2360         do_reserve_slot; Adjust callers.
2361         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2362         pointer to abstract base class.
2363         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2364
2365 2011-12-18  Ian Lance Taylor  <iant@google.com>
2366
2367         * object.h (Relobj::local_symbol_value): New function.
2368         (Relobj::local_plt_offset): New function.
2369         (Relobj::local_has_got_offset): New function.
2370         (Relobj::local_got_offset): New function.
2371         (Relobj::set_local_got_offset): New function.
2372         (Relobj::do_local_symbol_value): New pure virtual function.
2373         (Relobj::do_local_plt_offset): Likewise.
2374         (Relobj::do_local_has_got_offset): Likewise.
2375         (Relobj::do_local_got_offset): Likewise.
2376         (Relobj::do_set_local_got_offset): Likewise.
2377         (Sized_relobj::do_local_has_got_offset): Rename from
2378         local_has_got_offset.
2379         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2380         (Sized_relobj::do_set_local_got_offset): Rename from
2381         set_local_got_offset.
2382         (Sized_relobj_file::do_local_plt_offset): Rename from
2383         local_plt_offset.
2384         (Sized_relobj_file::do_local_symbol_value): New function.
2385         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2386         local_plt_offset.
2387         * output.cc (Output_data_got::Got_entry::write): Change object to
2388         Relobj.  Use local_symbol_value.
2389         (Output_data_got::add_global_with_rel): Change rel_dyn to
2390         Output_data_reloc_generic*.  Use add_global_generic.
2391         (Output_data_got::add_global_with_rela): Remove.  Change all
2392         callers to use add_global_with_rel.
2393         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2394         Output_data_reloc_generic*.  Use add_global_generic.
2395         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2396         callers to use add_global_pair_with_rel.
2397         (Output_data_got::add_local): Change object to Relobj*.
2398         (Output_data_got::add_local_plt): Likewise.
2399         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2400         change rel_dyn to Output_data_reloc_generic*.  Use
2401         add_local_generic.
2402         (Output_data_got::add_local_with_rela): Remove.  Change all
2403         callers to use all_local_with_rel.
2404         (Output_data_got::add_local_pair_with_rel): Change object to
2405         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2406         add_output_section_generic.
2407         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2408         callers to use add_local_pair_with_rel.
2409         (Output_data_got::reserve_local): Change object to Relobj*.
2410         * output.h: (class Output_data_reloc_generic): Add pure virtual
2411         declarations for add_global_generic, add_local_generic,
2412         add_output_section_generic.
2413         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2414         functions for Output_data_reloc_generic.  Update declarations for
2415         changes listed in output.cc.
2416         (class Output_data_got): Change template parameter to got_size.
2417         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2418         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2419         function.
2420         (Sized_relobj_incr::do_local_plt_offset): New function.
2421         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2422         add_global_generic.
2423
2424 2011-12-17  Cary Coutant  <ccoutant@google.com>
2425
2426         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2427         * resolve.cc (Symbol_table::resolve): Likewise.
2428         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2429         arrays.
2430         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2431
2432 2011-12-16  Ian Lance Taylor  <iant@google.com>
2433
2434         * output.h (Output_data_reloc_generic::add): Only call
2435         add_dynamic_reloc if this is a dynamic reloc section.
2436
2437 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2438
2439         PR gold/13505
2440         * target-reloc.h (apply_relocation): Replace <64, false> with
2441         <size, big_endian>.
2442
2443 2011-11-25  Nick Clifton  <nickc@redhat.com>
2444
2445         * po/it.po: New Italian translation.
2446
2447 2011-11-17  Sterling Augustine  <saugustine@google.com>
2448
2449         * script.cc (script_include_directive): Implement.
2450         (read_script_file): New local variables name and search_path. Update
2451         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2452         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2453         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2454
2455 2011-11-11  Sterling Augustine  <saugustine@google.com>
2456
2457         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2458         (file_or_sections_cmd): Likewise.
2459
2460 2011-11-11  Doug Kwan  <dougkwan@google.com>
2461
2462         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2463         if --just-symbols is given.
2464
2465 2011-11-10  Doug Kwan  <dougkwan@google.com>
2466
2467         PR gold/13362
2468         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2469         when processing data relocs.
2470         * reloc.h (Relocate_functions::rel_unaligned): New method.
2471         (Relocate_functions::pcrel_unaligned): Ditto.
2472         (Relocate_functions::rel32_unaligned): Ditto.
2473         (Relocate_functions::pcrel32_unaligned): Ditto.
2474
2475 2011-11-09  Doug Kwan  <dougkwan@google.com>
2476
2477         PR gold/13362
2478         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2479         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2480         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2481         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2482         (Relocate_functions::rel_unaligned): New.
2483         (Relocate_functions::rel32_unaligned): New.
2484         * target-reloc.h (relocate_for_relocatable): Add code to handle
2485         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2486         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2487         arm_unaligned_reloc_r): New targets.
2488         * testsuite/Makefile.in: Regenerate.
2489         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2490         linking.
2491
2492 2011-11-02  Ian Lance Taylor  <iant@google.com>
2493
2494         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2495         NATIVE_LINKER.
2496         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2497         * options.cc (General_options::finalize): Use library search path
2498         from configure script if specified.  If not native and no sysroot,
2499         only search TOOLLIBDIR.
2500         * options.h (Search_directory::Search_directory): Change name to
2501         const std::string&.
2502         (General_options::add_to_library_path_with_sysroot): Change arg to
2503         const std::string&.
2504         * configure, Makefile.in, config.in: Rebuild.
2505
2506 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2507
2508         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2509         we are working around the ARM1176 Erratum.
2510         * options.h (General_options::fix_arm1176): Add option.
2511         * testsuite/Makefile.am: Add testcases, and keep current ones
2512         working.
2513         * testsuite/Makefile.in: Regenerate.
2514         * testsuite/arm_fix_1176.s: New file.
2515         * testsuite/arm_fix_1176.sh: Likewise.
2516
2517 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2518
2519         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2520         may_use_blx_.
2521         (Target_arm::may_use_blx): Remove method.
2522         (Target_arm::set_may_use_blx): Likewise.
2523         (Target_arm::may_use_v4t_interworking): New method.
2524         (Target_arm::may_use_v5t_interworking): Likewise.
2525         (Target_arm::may_use_blx_): Remove member variable.
2526         (Arm_relocate_functions::arm_branch_common): Check for v5T
2527         interworking.
2528         (Arm_relocate_functions::thumb_branch_common): Likewise.
2529         (Reloc_stub::stub_type_for_reloc): Likewise.
2530         (Target_arm::do_finalize_sections): Correct interworking checks.
2531         * testsuite/Makefile.am: Add new tests.
2532         * testsuite/Makefile.in: Regenerate.
2533         * testsuite/arm_farcall_arm_arm.s: New test.
2534         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2535         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2536         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2537         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2538         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2539         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2540         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2541
2542 2011-10-31  Cary Coutant  <ccoutant@google.com>
2543
2544         PR gold/13023
2545         * expression.cc (Expression::eval_with_dot): Add
2546         is_section_dot_assignment parameter.
2547         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2548         absolute and assigning to dot within a section.
2549         * script-sections.cc
2550         (Output_section_element_assignment::set_section_addresses): Pass
2551         dot_section to set_if_absolute.
2552         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2553         as is_section_dot_assignment flag to eval_with_dot.
2554         (Output_section_element_dot_assignment::set_section_addresses):
2555         Likewise.
2556         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2557         parameter.  Also set value if relative to dot_section; set the
2558         symbol's output_section.
2559         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2560         parameter.  Adjust all callers.
2561         (Expression::eval_maybe_dot): Likewise.
2562         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2563         Adjust all callers.
2564         * testsuite/script_test_2.t: Test assignment of an absolute value
2565         to dot within an output section element.
2566
2567 2011-10-31  Cary Coutant  <ccoutant@google.com>
2568
2569         * options.h (class General_options): Add --[no-]gnu-unique options.
2570         * symtab.cc (Symbol_table::sized_write_globals): Convert
2571         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2572
2573 2011-10-31  Cary Coutant  <ccoutant@google.com>
2574
2575         PR gold/13359
2576         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2577         unnecessary assertion.
2578         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2579
2580 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2581
2582         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2583         gc_mark_symbol.
2584         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2585         gc_mark_symbol.
2586         Change to just keep the section associated with symbol.
2587         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2588         they are externally visible and --export-dynamic is turned on.
2589         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2590
2591 2011-10-19  Ian Lance Taylor  <iant@google.com>
2592
2593         PR gold/13163
2594         * script-sections.cc
2595         (Output_section_element_dot_assignment::needs_output_section): New
2596         function.
2597
2598 2011-10-19  Ian Lance Taylor  <iant@google.com>
2599
2600         PR gold/13204
2601         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2602         --section-start option was seen.
2603         * options.h (General_options::any_section_start): New function.
2604
2605 2011-10-18  David S. Miller  <davem@davemloft.net>
2606
2607         PR binutils/13301
2608         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2609         member to track relocation locations that have moved during TLS
2610         reloc optimizations.
2611         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2612         (Target_sparc::Relocate::relocate): Adjust view down by 4
2613         bytes if it matches reloc_adjust_addr_.
2614         (Target_sparc::Relocate::relocate_tls): Always move the
2615         __tls_get_addr call delay slot instruction forward 4 bytes when
2616         performing relaxation.
2617
2618 2011-10-18  Cary Coutant  <ccoutant@google.com>
2619
2620         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2621         (Output_file::map_no_anonymous): Check for non-zero
2622         return code from posix_fallocate.
2623
2624 2011-10-17  Cary Coutant  <ccoutant@google.com>
2625
2626         PR gold/13245
2627         * plugin.cc (is_visible_from_outside): Check for symbols
2628         referenced from dynamic objects.
2629         * resolve.cc (Symbol_table::resolve): Don't count references
2630         from dynamic objects as references from real ELF files.
2631         * testsuite/plugin_test_2.sh: Adjust expected result.
2632
2633 2011-10-17  Cary Coutant  <ccoutant@google.com>
2634
2635         * gold.cc: Include timer.h.
2636         (queue_middle_tasks): Stamp time.
2637         (queue_final_tasks): Likewise.
2638         * main.cc (main): Store timer in parameters.  Print timers
2639         for each pass.
2640         * parameters.cc (Parameters::Parameters): Initialize timer_.
2641         (Parameters::set_timer): New function.
2642         (set_parameters_timer): New function.
2643         * parameters.h (Parameters::set_timer): New function.
2644         (Parameters::timer): New function.
2645         (Parameters::timer_): New data member.
2646         (set_parameters_timer): New function.
2647         * timer.cc (Timer::stamp): New function.
2648         (Timer::get_pass_time): New function.
2649         * timer.h (Timer::stamp): New function.
2650         (Timer::get_pass_time): New function.
2651         (Timer::pass_times_): New data member.
2652
2653 2011-10-17  Cary Coutant  <ccoutant@google.com>
2654
2655         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2656         task for members of lib groups.
2657
2658 2011-10-17  Cary Coutant  <ccoutant@google.com>
2659
2660         PR gold/13288
2661         * fileread.cc (File_read::find_view): Add assert.
2662         (File_read::make_view): Move bounds check (replace with assert)...
2663         (File_read::find_or_make_view): ... to here.
2664
2665 2011-10-12  Cary Coutant  <ccoutant@google.com>
2666
2667         * output.cc (Output_file::open_base_file): Handle case where
2668         ::read returns less than requested size.
2669
2670 2011-10-10  Cary Coutant  <ccoutant@google.com>
2671
2672         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2673         Initialize defined_count_.
2674         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2675         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2676         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2677         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2678         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2679         * incremental.h (Sized_relobj_incr::defined_count_): New data
2680         member.
2681         (Sized_incr_dynobj::defined_count_): New data member.
2682         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2683         Return zeroes instead of internal error.
2684
2685 2011-10-10  Cary Coutant  <ccoutant@google.com>
2686
2687         PR gold/13249
2688         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2689         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2690         * output.h (class Output_reloc): Add use_plt_offset flag.
2691         (Output_reloc::type_): Adjust size of bit field.
2692         (Output_reloc::use_plt_offset_): New bit field.
2693         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2694         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2695         flag.  Adjust all callers.
2696         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2697         creating RELATIVE relocations.
2698
2699 2011-10-10  Nick Clifton  <nickc@redhat.com>
2700
2701         * po/es.po: Updated Spanish translation.
2702         * po/fi.po: Updated Finnish translation.
2703
2704 2011-10-03   Diego Novillo  <dnovillo@google.com>
2705
2706         * options.cc (parse_uint): Fix dereference of RETVAL.
2707
2708 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2709
2710         * layout.h (section_order_map_): New member.
2711         (get_section_order_map): New member function.
2712         * output.cc (Output_section::add_input_section): Check for patterns
2713         only when --section-ordering-file is specified.
2714         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2715         output_sections have been formed.
2716         * layout.cc (Layout_Layout): Initialize section_order_map_.
2717         * plugin.cc (update_section_order): Store order in order_map. Do not
2718         update the order.
2719         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2720         * testsuite/Makefile.in: Regenerate.
2721         * testsuite/plugin_section_order.c: New file.
2722         * testsuite/plugin_final_layout.cc: New file.
2723         * testsuite/plugin_final_layout.sh: New file.
2724
2725 2011-09-29  Cary Coutant  <ccoutant@google.com>
2726
2727         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2728         Check for NULL.
2729         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2730         symbols during incremental update.
2731         (Symbol_table::add_from_dynobj): Likewise.
2732
2733 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2734             Ian Lance Taylor  <iant@google.com>
2735
2736         * symtab.cc (Symbol_table::define_special_symbol): Always
2737         canonicalize version string.
2738
2739 2011-09-26  Cary Coutant  <ccoutant@google.com>
2740
2741         * gold.cc (queue_initial_tasks): Move option checks ...
2742         * options.cc (General_options::finalize): ... to here. Disable
2743         some options; make others fatal.
2744
2745 2011-09-26  Cary Coutant  <ccoutant@google.com>
2746
2747         gcc PR lto/47247
2748         * plugin.cc (get_symbols_v2): New function.
2749         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2750         (is_referenced_from_outside): New function.
2751         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2752         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2753         (get_symbols): Pass version parameter.
2754         (get_symbols_v2): New function.
2755         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2756         parameter.
2757         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2758         (onload): Add LDPT_GET_SYMBOLS_V2.
2759         (all_symbols_read_hook): Use get_symbols_v2; check for
2760         LDPR_PREVAILING_DEF_IRONLY_EXP.
2761         * testsuite/plugin_test_3.sh: Update expected results.
2762
2763 2011-09-23  Simon Baldwin  <simonb@google.com>
2764
2765         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2766         configuration options.
2767         * configure: Regenerate.
2768         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2769         * Makefile.in: Regenerate.
2770         * testsuite/Makefile.in: Regenerate.
2771
2772 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2773
2774         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2775
2776 2011-09-19  Cary Coutant  <ccoutant@google.com>
2777
2778         * incremental.cc (can_incremental_update): Fix typo in comment.
2779         * incremental.h (can_incremental_update): Likewise.
2780
2781 2011-09-18  Cary Coutant  <ccoutant@google.com>
2782
2783         * incremental.cc (can_incremental_update): New function.
2784         * incremental.h (can_incremental_update): New function.
2785         * layout.cc (Layout::init_fixed_output_section): Call it.
2786         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2787         * object.cc (Sized_relobj_file::do_layout): Call
2788         can_incremental_update.
2789
2790 2011-09-13  Cary Coutant  <ccoutant@google.com>
2791
2792         * configure.ac: Check for glibc support for gnu_indirect_function
2793         support with static linking, setting automake conditional
2794         IFUNC_STATIC.
2795         * Makefile.in: Regenerate.
2796         * configure: Regenerate.
2797
2798         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2799         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2800         for IFUNC_STATIC.
2801         * testsuite/Makefile.in: Regenerate.
2802
2803 2011-09-13  Cary Coutant  <ccoutant@google.com>
2804
2805         * incremental.cc (Sized_relobj_incr::do_layout): Call
2806         report_comdat_group for kept comdat sections.
2807         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2808         * testsuite/Makefile.in: Regenerate.
2809         * testsuite/incr_comdat_test_1.cc: New source file.
2810         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2811         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2812         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2813
2814 2011-09-13  Ian Lance Taylor  <iant@google.com>
2815
2816         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2817         variable external_symbols_offset.
2818
2819 2011-09-12  Ian Lance Taylor  <iant@google.com>
2820
2821         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2822         triggered if object has no symbols.
2823
2824 2011-09-09  David S. Miller  <davem@davemloft.net>
2825
2826         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2827         (Output_fill_debug_line::do_write): Likewise.
2828
2829 2011-08-29  Cary Coutant  <ccoutant@google.com>
2830
2831         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2832         casts to match formatting specs.
2833         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2834
2835 2011-08-26  Cary Coutant  <ccoutant@google.com>
2836
2837         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2838         remaining hole size when allocating.
2839         (Layout::make_output_section): Set fill methods for debug sections.
2840         * layout.h (Free_list::Free_list_node): Move from private to
2841         public.
2842         (Free_list::set_min_hole_size): New function.
2843         (Free_list::begin, Free_list::end): New functions.
2844         (Free_list::min_hole_): New data member.
2845         * output.cc: Include dwarf.h.
2846         (Output_fill_debug_info::do_minimum_hole_size): New function.
2847         (Output_fill_debug_info::do_write): New function.
2848         (Output_fill_debug_line::do_minimum_hole_size): New function.
2849         (Output_fill_debug_line::do_write): New function.
2850         (Output_section::Output_section): Initialize new data member.
2851         (Output_section::set_final_data_size): Ensure patch space is larger
2852         than minimum hole size.
2853         (Output_section::do_write): Fill holes in debug sections.
2854         * output.h (Output_fill): New class.
2855         (Output_fill_debug_info): New class.
2856         (Output_fill_debug_line): New class.
2857         (Output_section::set_free_space_fill): New function.
2858         (Output_section::free_space_fill_): New data member.
2859         * testsuite/Makefile.am (incremental_test_3): Add
2860         --incremental-patch option.
2861         (incremental_test_4): Likewise.
2862         (incremental_test_5): Likewise.
2863         (incremental_test_6): Likewise.
2864         (incremental_copy_test): Likewise.
2865         (incremental_common_test_1): Likewise.
2866         * testsuite/Makefile.in: Regenerate.
2867
2868 2011-08-26  Nick Clifton  <nickc@redhat.com>
2869
2870         * po/es.po: Updated Spanish translation.
2871
2872 2011-08-01  Cary Coutant  <ccoutant@google.com>
2873
2874         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2875         * gold/testsuite/Makefile.in: Regenerate.
2876         * gold/testsuite/justsyms_exec.c: New source file.
2877         * gold/testsuite/justsyms_lib.c: New source file.
2878
2879 2011-08-01  Cary Coutant  <ccoutant@google.com>
2880
2881         * layout.cc (Layout::set_segment_offsets): Don't realign text
2882         segment if -Ttext was specified.
2883         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2884         file type.
2885         * object.h (Sized_relobj_file::e_type): New function.
2886         (Sized_relobj_file::e_type_): New data member.
2887         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2888         base address for ET_EXEC files.
2889         * target.cc (Target::do_make_elf_object_implementation): Allow
2890         ET_EXEC files with --just-symbols option.
2891
2892 2011-07-28  Cary Coutant  <ccoutant@google.com>
2893
2894         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2895         Add thread_number parameter.
2896         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2897         * workqueue-threads.cc
2898         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2899         current thread if its thread number is greater than desired thread
2900         count.
2901         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2902         Add thread_number parameter.
2903         (Workqueue::should_cancel_thread): Likewise.
2904         (Workqueue::find_runnable_or_wait): Pass thread_number to
2905         should_cancel_thread.
2906         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2907         parameter.
2908
2909 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2910
2911         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2912         only after checking if it cannot be forced local.
2913         * symtab.h (is_externally_visible): Check if the symbol is not forced
2914         local.
2915
2916 2011-07-15  Ian Lance Taylor  <iant@google.com>
2917
2918         * options.h (class General_options): Add --print-output-format.
2919         Move -EL next to -EB, for  better --help output.
2920         * target-select.cc: Include <cstdio>, "options.h", and
2921         "parameters.h".
2922         (Target_selector::do_target_bfd_name): New function.
2923         (print_output_format): New function.
2924         * target-select.h (class Target_selector): Update declarations.
2925         (Target_selector::target_bfd_name): New function.
2926         (print_output_format): Declare.
2927         * main.cc: Include "target-select.h".
2928         (main): Handle --print-output-format.
2929         * gold.cc: Include "target-select.h".
2930         (queue_initial_tasks): Handle --print-output-format when there are
2931         no input files.
2932         * parameters.cc (parameters_force_valid_target): Give a better
2933         error message if -EB/-EL does not match target.
2934         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2935         function.
2936
2937 2011-07-15  Ian Lance Taylor  <iant@google.com>
2938
2939         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2940         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2941         (Output_data_plt_i386::do_write): Write address of .dynamic
2942         section to first entry in .got.plt section.
2943         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2944         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2945         Initialize layout_.
2946         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2947         section to first entry in .got.plt section.
2948         * layout.h (Layout::dynamic_section): New function.
2949
2950 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2951
2952         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2953         to claim_file call.
2954         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2955         input_section_position_, and input_section_glob_.
2956         (read_layout_from_file): Call function section_ordering_specified.
2957         * layout.h (is_section_ordering_specified): New function.
2958         (section_ordering_specified): New function.
2959         (section_ordering_specified_): New boolean member.
2960         * main.cc(main): Call load_plugins after layout object is defined.
2961         * output.cc (Output_section::add_input_section): Use
2962         function section_ordering_specified to check if section ordering is
2963         needed.
2964         * output.cc (Output_section::add_relaxed_input_section): Use
2965         function section_ordering_specified to check if section ordering is
2966         needed.
2967         (Output_section::update_section_layout): New function.
2968         (Output_section::sort_attached_input_sections): Check if input section
2969         must be reordered.
2970         * output.h (Output_section::update_section_layout): New function.
2971         * plugin.cc (get_section_count): New function.
2972         (get_section_type): New function.
2973         (get_section_name): New function.
2974         (get_section_contents): New function.
2975         (update_section_order): New function.
2976         (allow_section_ordering): New function.
2977         (Plugin::load): Add the new interfaces to the transfer vector.
2978         (Plugin_manager::load_plugins): New parameter.
2979         (Plugin_manager::all_symbols_read): New parameter.
2980         (Plugin_manager::claim_file): New parameter. Save the elf object for
2981         unclaimed objects.
2982         (Plugin_manager::get_elf_object): New function.
2983         (Plugin_manager::get_view): Change to directly use the bool to check
2984         if get_view is called from claim_file_hook.
2985         * plugin.h (input_objects): New function
2986         (Plugin__manager::load_plugins): New parameter.
2987         (Plugin_manager::claim_file): New parameter.
2988         (Plugin_manager::get_elf_object): New function.
2989         (Plugin_manager::in_claim_file_handler): New function.
2990         (Plugin_manager::in_claim_file_handler_): New member.
2991         (layout): New function.
2992         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2993         handler with an extra parameter. Make the elf object before calling
2994         claim_file handler.
2995         * testsuite/plugin_test.c (get_section_count): New function pointer.
2996         (get_section_type): New function pointer.
2997         (get_section_name): New function pointer.
2998         (get_section_contents): New function pointer.
2999         (update_section_order): New function pointer.
3000         (allow_section_ordering): New function pointer.
3001         (onload): Check if the new interfaces exist.
3002
3003 2011-07-13  Ian Lance Taylor  <iant@google.com>
3004
3005         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3006         relro section.
3007         * x86_64.cc (Target_x86_64::got_section): Likewise.
3008         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3009         (relro_now_test_SOURCES): New variable.
3010         (relro_now_test_DEPENDENCIES): New variable.
3011         (relro_now_test_LDFLAGS): New variable.
3012         (relro_now_test_LDADD): New variable.
3013         (relro_now_test.so): New target.
3014         * testsuite/Makefile.in: Rebuild.
3015
3016 2011-07-12  Ian Lance Taylor  <iant@google.com>
3017
3018         PR gold/12980
3019         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3020         GLOB_DAT relocation rather than a RELATIVE relocation for a
3021         protected symbol when creating a shared library.
3022         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3023         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3024         * testsuite/protected_main_1.cc (main): Test that protected
3025         function has same address.
3026
3027 2011-07-11  Ian Lance Taylor  <iant@google.com>
3028
3029         PR gold/12979
3030         * options.h (class General_options): Add -Bgroup.
3031         * options.cc (General_options::finalize): If -Bgroup is set,
3032         default to --unresolved-symbols=report-all.
3033         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3034         * target-reloc.h (issue_undefined_symbol_error): Handle
3035         --unresolved-symbols=report-all.
3036
3037 2011-07-08  Ian Lance Taylor  <iant@google.com>
3038
3039         PR gold/11985
3040         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3041         if linker script discards key sections.
3042         (Layout::create_dynamic_symtab): Likewise.
3043         (Layout::assign_local_dynsym_offsets): Likewise.
3044         (Layout::sized_create_version_sections): Likewise.
3045         (Layout::create_interp): Likewise.
3046         (Layout::finish_dynamic_section): Likewise.
3047         (Layout::set_dynamic_symbol_size): Likewise.
3048
3049 2011-07-08  Ian Lance Taylor  <iant@google.com>
3050
3051         PR gold/12386
3052         * options.h (class General_options): Add --unresolved-symbols.
3053         * target-reloc.h (issue_undefined_symbol_error): Check
3054         --unresolved-symbols.  Add comments.
3055
3056 2011-07-08  Ian Lance Taylor  <iant@google.com>
3057
3058         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3059         expression more complex.
3060
3061 2011-07-08  Ian Lance Taylor  <iant@google.com>
3062
3063         PR gold/11317
3064         * target-reloc.h (issue_undefined_symbol_error): New inline
3065         function, broken out of relocate_section.
3066         (relocate_section): Call issue_undefined_symbol_error.
3067         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3068         there is no TLS segment if we are about to issue an undefined
3069         symbol error.
3070         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3071
3072 2011-07-08  Ian Lance Taylor  <iant@google.com>
3073
3074         PR gold/12279
3075         * resolve.cc (Symbol_table::should_override): Add fromtype
3076         parameter.  Change all callers.  Give error when linking together
3077         TLS and non-TLS symbol.
3078         (Symbol_table::should_override_with_special): Add fromtype
3079         parameter.  Change all callers.
3080         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3081         there is no TLS segment if we have reported some errors.
3082         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3083
3084 2011-07-08  Ian Lance Taylor  <iant@google.com>
3085
3086         PR gold/12372
3087         * target.h (Target::plt_address_for_global): New function.
3088         (Target::plt_address_for_local): New function.
3089         (Target::plt_section_for_global): Remove.
3090         (Target::plt_section_for_local): Remove.
3091         (Target::do_plt_address_for_global): New virtual function.
3092         (Target::do_plt_address_for_local): New virtual function.
3093         (Target::do_plt_section_for_global): Remove.
3094         (Target::do_plt_section_for_local): Remove.
3095         (Target::register_global_plt_entry): Add Symbol_table and Layout
3096         parameters.
3097         * output.cc (Output_data_got::Got_entry::write): Use
3098         plt_address_for_global and plt_address_for_local.
3099         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3100         address of output section.
3101         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3102         got_irelative_, and irelative_count_ fields.  Update
3103         declarations.
3104         (Output_data_plt_i386::has_irelative_section): New function.
3105         (Output_data_plt_i386::entry_count): Add irelative_count_.
3106         (Output_data_plt_i386::set_final_data_size): Likewise.
3107         (class Target_i386): Add got_irelative_ and rel_irelative_
3108         fields.  Update declarations.
3109         (Target_i386::Target_i386): Initialize new fields.
3110         (Target_i386::do_plt_address_for_global): New function replacing
3111         do_plt_section_for_global.
3112         (Target_i386::do_plt_address_for_local): New function replacing
3113         do_plt_section_for_local.
3114         (Target_i386::got_section): Create got_irelative_.
3115         (Target_i386::rel_irelative_section): New function.
3116         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3117         fields.  Don't define __rel_iplt_{start,end}.
3118         (Output_data_plt_i386::add_entry): Add symtab and layout
3119         parameters.  Change all callers.  Use different PLT and GOT for
3120         IFUNC symbols.
3121         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3122         layout parameters.  Change all callers.  Use different PLT and
3123         GOT.
3124         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3125         (Output_data_plt_i386::rel_irelative): New function.
3126         (Output_data_plt_i386::address_for_global): New function.
3127         (Output_data_plt_i386::address_for_local): New function.
3128         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3129         IRELATIVE GOT when changing IFUNC GOT entries.
3130         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3131         reloc.
3132         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3133         if we didn't create an IRELATIVE GOT.
3134         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3135         plt_address_for_local.
3136         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3137         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3138         got_irelative_, and irelative_count_ fields.  Update
3139         declarations.
3140         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3141         Initialize new fields.  Remove symtab parameter.  Change all
3142         callers.
3143         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3144         irelative_count_.
3145         (Output_data_plt_x86_64::has_irelative_section): New function.
3146         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3147         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3148         fields.  Update declarations.
3149         (Target_x86_64::Target_x86_64): Initialize new fields.
3150         (Target_x86_64::do_plt_address_for_global): New function replacing
3151         do_plt_section_for_global.
3152         (Target_x86_64::do_plt_address_for_local): New function replacing
3153         do_plt_section_for_local.
3154         (Target_x86_64::got_section): Create got_irelative_.
3155         (Target_x86_64::rela_irelative_section): New function.
3156         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3157         all callers.  Don't create __rel_iplt_{start,end}.
3158         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3159         parameters.  Change all callers.  Use different PLT and GOT for
3160         IFUNC symbols.
3161         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3162         layout parameters.  Change all callers.  Use different PLT and
3163         GOT.
3164         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3165         parameters.  Change all callers.  Use different PLT and GOT for
3166         IFUNC symbols.
3167         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3168         (Output_data_plt_x86_64::rela_irelative): New function.
3169         (Output_data_plt_x86_64::address_for_global): New function.
3170         (Output_data_plt_x86_64::address_for_local): New function.
3171         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3172         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3173         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3174         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3175         parameters.
3176         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3177         reloc.
3178         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3179         symbols if we didn't create an IRELATIVE GOT.
3180         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3181         plt_address_for_local.
3182         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3183         * testsuite/ifuncvar1.c: New test file.
3184         * testsuite/ifuncvar2.c: New test file.
3185         * testsuite/ifuncvar3.c: New test file.
3186         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3187         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3188         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3189         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3190         * testsuite/Makefile.in: Rebuild.
3191
3192 2011-07-07  Cary Coutant  <ccoutant@google.com>
3193
3194         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3195         (two_file_test_1_ndebug.o): Likewise.
3196         (two_file_test_1b_ndebug.o): Likewise.
3197         (two_file_test_2_ndebug.o): Likewise.
3198         (two_file_test_main_ndebug.o): Likewise.
3199         (incremental_test_2): Link with no-debug versions.
3200
3201 2011-07-06  Cary Coutant  <ccoutant@google.com>
3202
3203         * gold/incremental.cc
3204         (Output_section_incremental_inputs::write_info_blocks): Check for
3205         hidden and internal symbols.
3206
3207 2011-07-06  Cary Coutant  <ccoutant@google.com>
3208
3209         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3210         Check disposition for startup file.
3211         (Incremental_inputs::report_command_line): Ignore
3212         --incremental-startup-unchanged option.
3213         * options.cc (General_options::parse_incremental_startup_unchanged):
3214         New function.
3215         (General_options::General_options): Initialize new data member.
3216         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3217         (General_options): Add --incremental-startup-unchanged option.
3218         (General_options::incremental_startup_disposition): New function.
3219         (General_options::incremental_startup_disposition_): New data member.
3220
3221 2011-07-06  Cary Coutant  <ccoutant@google.com>
3222
3223         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3224         input file index to Script_info ctor.
3225         (Sized_incremental_binary::do_file_has_changed): Find the
3226         command-line argument for files named in scripts.
3227         * incremental.h (Script_info::Script_info): New ctor
3228         with input file index.
3229         (Script_info::input_file_index): New function.
3230         (Script_info::input_file_index_): New data member.
3231         (Incremental_binary::get_library): Add const.
3232         (Incremental_binary::get_script_info): Add const.
3233         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3234         * testsuite/Makefile.am (incremental_test_5): New test case.
3235         (incremental_test_6): New test case.
3236         * testsuite/Makefile.in: Regenerate.
3237
3238 2011-07-06  Cary Coutant  <ccoutant@google.com>
3239
3240         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3241         debug output when command lines differ.
3242
3243 2011-07-06  Cary Coutant  <ccoutant@google.com>
3244
3245         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3246         --incremental-patch option.
3247         * layout.cc (Free_list::allocate): Extend allocation beyond original
3248         end if enabled.
3249         (Layout::make_output_section): Mark sections that should get
3250         patch space.
3251         * options.cc (parse_percent): New function.
3252         * options.h (parse_percent): New function.
3253         (DEFINE_percent): New macro.
3254         (General_options): Add --incremental-patch option.
3255         * output.cc (Output_section::Output_section): Initialize new data
3256         members.
3257         (Output_section::add_input_section): Print section name when out
3258         of patch space.
3259         (Output_section::add_output_section_data): Likewise.
3260         (Output_section::set_final_data_size): Add patch space when
3261         doing --incremental-full.
3262         (Output_section::do_reset_address_and_file_offset): Remove patch
3263         space.
3264         (Output_segment::set_section_list_addresses): Print debug output
3265         only if --incremental-update.
3266         * output.h (Output_section::set_is_patch_space_allowed): New function.
3267         (Output_section::is_patch_space_allowed_): New data member.
3268         (Output_section::patch_space_): New data member.
3269         * parameters.cc (Parameters::incremental_full): New function.
3270         * parameters.h (Parameters::incremental_full): New function
3271         * testsuite/Makefile.am (incremental_test_2): Add test for
3272         --incremental-patch option.
3273         * testsuite/Makefile.in: Regenerate.
3274         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3275         (t18): Remove function body.
3276
3277 2011-07-05  Doug Kwan  <dougkwan@google.com>
3278
3279         PR gold/12771
3280         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3281         Arm_Address type for relocation result.
3282         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3283         overflow check.
3284         (Arm_relocate_functions::abs32): Use unaligned access.
3285         (Arm_relocate_functions::rel32): Ditto.
3286         (Arm_relocate_functions::prel31): Ditto.
3287         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3288         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3289         static data relocations.
3290         * testsuite/Makefile.in: Regnerate.
3291         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3292
3293 2011-07-05  Ian Lance Taylor  <iant@google.com>
3294
3295         PR gold/12392
3296         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3297         symbols if necessary.
3298         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3299
3300 2011-07-05  Ian Lance Taylor  <iant@google.com>
3301
3302         PR gold/12952
3303         * resolve.cc (Symbol::override_base_with_special): Simply override
3304         version with special symbol version, ignoring previous version.
3305
3306 2011-07-05  Ian Lance Taylor  <iant@google.com>
3307
3308         * object.cc (Sized_relobj_file::include_section_group): Add
3309         information to comment about signature location.
3310
3311 2011-07-02  Ian Lance Taylor  <iant@google.com>
3312
3313         PR gold/12957
3314         * options.h (class General_options): Add -f and -F.
3315         * options.cc (General_options::finalize): Fatal error if -f/-F
3316         are used without -shared.
3317         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3318
3319 2011-07-02  Ian Lance Taylor  <iant@google.com>
3320
3321         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3322
3323 2011-07-01  Ian Lance Taylor  <iant@google.com>
3324
3325         PR gold/12525
3326         PR gold/12952
3327         * resolve.cc (Symbol::override_base_with_special): Don't override
3328         the version if the overriding symbol has a different name.
3329         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3330         all callers.  If we give an error about an undefined version,
3331         define the base version if necessary.
3332         * dynobj.h (class Versions): Update declaration.
3333         * testsuite/weak_alias_test_5.cc: New file.
3334         * testsuite/weak_alias_test.script: New file.
3335         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3336         and versioned_alias have the right value, and call t2.
3337         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3338         weak_alias_test_5.so.
3339         (weak_alias_test_LDADD): Likewise.
3340         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3341         * testsuite/Makefile.in: Rebuild.
3342
3343 2011-07-01  Ian Lance Taylor  <iant@google.com>
3344
3345         PR gold/12525
3346         * options.h (class General_options): Support -z notext.
3347         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3348         -Wl,-z,notext.
3349         (two_file_shared_nonpic.so): Likewise.
3350         (two_file_shared_mixed.so): Likewise.
3351         (two_file_shared_mixed_1.so): Likewise.
3352         (weak_undef_lib_nonpic.so): Likewise.
3353         (alt/weak_undef_lib_nonpic.so): Likewise.
3354         (tls_test_shared_nonpic.so): Likewise.
3355         * testsuite/Makefile.in: Rebuild.
3356
3357 2011-07-01  Ian Lance Taylor  <iant@google.com>
3358
3359         PR gold/12525
3360         * configure.ac: Test whether static linking works, setting
3361         the automake conditional HAVE_STATIC.
3362         * testsuite/Makefile.am: Disable tests using -static if
3363         HAVE_STATIC is not true.
3364         * configure, testsuite/Makefile.in: Rebuild.
3365
3366 2011-07-01  Ian Lance Taylor  <iant@google.com>
3367
3368         PR gold/12525
3369         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3370         Assert if we see DW_EH_PE_indirect.
3371         * target.h (Target::ehframe_datarel_base): New function.
3372         (Target::do_ehframe_datarel_base): New target function.
3373         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3374         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3375         function.
3376
3377 2011-07-01  Ian Lance Taylor  <iant@google.com>
3378
3379         PR gold/12571
3380         * options.h (class General_options): Add
3381         --ld-generated-unwind-info.
3382         * ehframe.cc (Fde::write): Add address parameter.  Change all
3383         callers.  If associated with PLT, fill in address and size.
3384         (Cie::set_output_offset): Only add merge mapping if there is an
3385         object.
3386         (Cie::write): Add address parameter.  Change all callers.
3387         (Eh_frame::add_ehframe_for_plt): New function.
3388         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3389         input_offset_ fields into union u_, with new plt field.
3390         (Fde::Fde): Adjust for new union field.
3391         (Fde::Fde) [Output_data version]: New constructor.
3392         (Fde::add_mapping): Only add merge mapping if there is an object.
3393         (class Cie): Update declarations.
3394         (class Eh_frame): Declare add_ehframe_for_plt.
3395         * layout.cc (Layout::layout_eh_frame): Break out code into
3396         make_eh_frame_section, and call it.
3397         (Layout::make_eh_frame_section): New function.
3398         (Layout::add_eh_frame_for_plt): New function.
3399         * layout.h (class Layout): Update declarations.
3400         * merge.cc (Merge_map::add_mapping): Add assertion.
3401         * i386.cc: Include "dwarf.h".
3402         (class Output_data_plt_i386): Make first_plt_entry,
3403         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3404         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3405         and plt_eh_frame_fde.
3406         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3407         boundary.  Call add_eh_frame_for_plt if appropriate.
3408         * x86_64.cc: Include "dwarf.h".
3409         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3410         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3411         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3412         and plt_eh_frame_fde.
3413         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3414         appropriate.
3415
3416 2011-06-29  Ian Lance Taylor  <iant@google.com>
3417
3418         PR gold/12629
3419         * object.cc (Sized_relobj_file::layout_section): Change shdr
3420         parameter to be const.
3421         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3422         out of do_layout.
3423         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3424         appropriate.  Call layout_eh_frame_section.
3425         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3426         sections.
3427         * object.h (class Sized_relobj_file): Update declarations.
3428
3429 2011-06-29  Ian Lance Taylor  <iant@google.com>
3430
3431         PR gold/12652
3432         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3433         modifier.
3434         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3435
3436 2011-06-29  Ian Lance Taylor  <iant@google.com>
3437
3438         PR gold/12675
3439         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3440         SHT_X86_64_UNWIND.
3441         * layout.cc (Layout::layout_eh_frame): Likewise.
3442
3443 2011-06-29  Ian Lance Taylor  <iant@google.com>
3444
3445         PR gold/12695
3446         * layout.cc (Layout::symtab_section_shndx): New function.
3447         * layout.h (class Layout): Declare symtab_section_shndx.
3448         * output.cc (Output_section::write_header): Call it.
3449
3450 2011-06-29  Ian Lance Taylor  <iant@google.com>
3451
3452         PR gold/12818
3453         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3454         symbols which are not used in a relocation.
3455
3456 2011-06-28  Ian Lance Taylor  <iant@google.com>
3457
3458         PR gold/12898
3459         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3460         script create indistinguishable segments.
3461         (Layout::set_segment_offsets): Use stable_sort when sorting
3462         segments.  Pass this to Compare_segments constructor.
3463         * layout.h (class Layout): Make segment_precedes non-static.
3464         (class Compare_segments): Change from struct to class.  Add
3465         layout_ field.  Add constructor.
3466         * script-sections.cc
3467         (Script_sections::attach_sections_using_phdrs_clause): Rename
3468         local orphan to is_orphan.  Don't report failure to put empty
3469         section in segment.  On attachment failure, report name of
3470         section, and attach to first PT_LOAD segment.
3471
3472 2011-06-28  Ian Lance Taylor  <iant@google.com>
3473
3474         PR gold/12934
3475         * target-select.cc (Target_selector::Target_selector): Add
3476         emulation parameter.  Change all callers.
3477         (select_target_by_bfd_name): Rename from select_target_by_name.
3478         Change all callers.
3479         (select_target_by_emulation): New function.
3480         (supported_emulation_names): New function.
3481         * target-select.h (class Target_selector): Add emulation_ field.
3482         Update declarations.
3483         (Target_selector::recognize_by_bfd_name): Rename from
3484         recognize_by_name.  Change all callers.
3485         (Target_selector::supported_bfd_names): Rename from
3486         supported_names.  Change all callers.
3487         (Target_selector::recognize_by_emulation): New function.
3488         (Target_selector::supported_emulations): New function.
3489         (Target_selector::emulation): New function.
3490         (Target_selector::do_recognize_by_bfd_name): Rename from
3491         do_recognize_by_name.  Change all callers.
3492         (Target_selector::do_supported_bfd_names): Rename from
3493         do_supported_names.  Change all callers.
3494         (Target_selector::do_recognize_by_emulation): New function.
3495         (Target_selector::do_supported_emulations): New function.
3496         (select_target_by_bfd_name): Change name in declaration.
3497         (select_target_by_emulation): Declare.
3498         (supported_emulation_names): Declare.
3499         * parameters.cc (parameters_force_valid_target): Try to find
3500         target based on emulation from -m option.
3501         * options.h (class General_options): Change doc string for -m.
3502         * options.cc (help): Print emulations.
3503         (General_options::parse_V): Likewise.
3504         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3505         Add emulation parameter.  Change all callers.
3506
3507 2011-06-28  Ian Lance Taylor  <iant@google.com>
3508
3509         * target.h (class Target): Add osabi_ field.
3510         (Target::osabi): New function.
3511         (Target::set_osabi): New function.
3512         (Target::Target): Initialize osabi_.
3513         (Target::do_adjust_elf_header): Make pure virtual.
3514         (Sized_target::do_adjust_elf_header): Declare.
3515         * target.cc (Sized_target::do_adjust_elf_header): New function.
3516         (class Sized_target): Instantiate all versions.
3517         * freebsd.h (class Target_freebsd): Remove.
3518         (Target_selector_freebsd::do_recognize): Call set_osabi on
3519         Target.
3520         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3521         (Target_selector_freebsd::set_osabi): Remove.
3522         * i386.cc (class Target_i386): Inherit from Sized_target rather
3523         than Target_freebsd.
3524         * x86_64.cc (class Target_x86_64): Likewise.
3525
3526 2011-06-28  Ian Lance Taylor  <iant@google.com>
3527
3528         * target.h (Target::can_check_for_function_pointers): Rewrite.
3529         Make non-virtual.
3530         (Target::can_icf_inline_merge_sections): Likewise.
3531         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3532         (Target::Target_info): Add can_icf_inline_merge_sections field.
3533         (Target::do_can_check_for_function_pointers): New virtual
3534         function.
3535         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3536         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3537         from can_check_for_function_pointers, move in file.
3538         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3539         section_may_have_icf_unsafe_poineters, move in file.
3540         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3541         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3542         Rename from can_check_for_function_pointers, move in file.
3543         (Target_i386::can_icf_inline_merge_sections): Remove.
3544         (Target_i386::i386_info): Initialize
3545         can_icf_inline_merge_sections.
3546         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3547         Initialize can_icf_inline_merge_sections.
3548         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3549         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3550         Rename from can_check_for_function_pointers, move in file.
3551         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3552         (Target_x86_64::x86_64_info): Initialize
3553         can_icf_inline_merge_sections.
3554         * testsuite/testfile.cc (Target_test::test_target_info):
3555         Likewise.
3556         * icf.cc (get_section_contents): Correct formatting.
3557
3558 2011-06-27  Ian Lance Taylor  <iant@google.com>
3559
3560         * symtab.cc (Symbol::versioned_name): New function.
3561         (Symbol_table::add_to_final_symtab): Use versioned_name when
3562         appropriate.
3563         (Symbol_table::sized_write_symbol): Likewise.
3564         * symtab.h (class Symbol): Declare versioned_name.
3565         * stringpool.h (class Stringpool_template): Add variant of add
3566         which takes a std::basic_string.
3567         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3568         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3569         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3570         (ver_test_12.o): New target.
3571         * testsuite/Makefile.in: Rebuild.
3572
3573 2011-06-27  Doug Kwan  <dougkwan@google.com>
3574
3575         * arm.cc (Arm_relocate_functions::thm_jump8,
3576         Arm_relocate_functions::thm_jump11): Use a wider signed
3577         type to compute offset.
3578         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3579         arm_thm_jump8.
3580         * testsuite/Makefile.in: Regenerate.
3581         * testsuite/arm_branch_in_range.sh: Check test results of
3582         arm_thm_jump11 and arm_thm_jump8.
3583         * testsuite/arm_thm_jump11.s: New test source file.
3584         * testsuite/arm_thm_jump11.t: New linker script.
3585         * testsuite/arm_thm_jump8.s: New test source file.
3586         * testsuite/arm_thm_jump8.t: New linker script.
3587
3588 2011-06-24  Ian Lance Taylor  <iant@google.com>
3589
3590         * layout.cc: Include "object.h".
3591         (ctors_sections_in_init_array): New static variable.
3592         (Layout::is_ctors_in_init_array): New function.
3593         (Layout::layout): Add entry to ctors_sections_in_init_array if
3594         appropriate.
3595         * layout.h (class Layout): Declare is_ctors_in_init_array.
3596         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3597         is_ctors_reverse_view is set.
3598         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3599         all callers.  Set is_ctors_reverse_view field of View_size.
3600         (Sized_relobj_file::reverse_words): New function.
3601         * object.h (Sized_relobj_file::View_size): Add
3602         is_ctors_reverse_view field.
3603         (class Sized_relobj_file): Update declarations.
3604         * testsuite/initpri3.c: New test.
3605         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3606         initpri3b.
3607         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3608         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3609         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3610         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3611         * testsuite/Makefile.in: Rebuild.
3612
3613 2011-06-24  Cary Coutant  <ccoutant@google.com>
3614
3615         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3616         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3617         (debug_msg_cdebug.err): New targets.
3618         * testsuite/Makefile.in: Regenerate.
3619         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3620         Fix checks for link with shared library.
3621
3622 2011-06-24  Doug Kwan  <dougkwan@google.com>
3623
3624         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3625         skip empty text sections.
3626         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3627
3628 2011-06-22  Ian Lance Taylor  <iant@google.com>
3629
3630         PR gold/12910
3631         * options.h (class General_options): Add --ctors-in-init-array.
3632         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3633         friends as SHT_PROGBITS for merging sections.
3634         (Layout::layout): Remove special handling of .init_array and
3635         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3636         and .dtors if ctors_in_init_array.
3637         (Layout::make_output_section): Force correct section types for
3638         .init_array and friends.  Don't sort if doing relocatable link,
3639         Don't sort .ctors and .dtors if ctors_in_init_array.
3640         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3641         (Layout::output_section_name): Add relobj parameter.  Change all
3642         callers.  Handle .ctors. and .dtors. in code rather than table.
3643         Handle .ctors and .dtors if ctors_in_init_array.
3644         (Layout::match_file_name): New function, moved from output.cc.
3645         * layout.h (class Layout): Update declarations.
3646         * output.cc: Include "layout.h".
3647         (Input_section_sort_entry::get_priority): New function.
3648         (Input_section_sort_entry::match_file_name): Just call
3649         Layout::match_file_name.
3650         (Output_section::Input_section_sort_init_fini_compare::operator()):
3651         Handle .ctors and .dtors.  Sort by explicit priority rather than
3652         by name.
3653         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3654         * testsuite/initpri2.c: New test.
3655         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3656         (check_PROGRAMS): Add initpri2.
3657         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3658         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3659         * configure, testsuite/Makefile.in: Rebuild.
3660
3661 2011-06-19  Ian Lance Taylor  <iant@google.com>
3662
3663         PR gold/12880
3664         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3665         .interp section to a PT_INTERP segment even if we have seen a
3666         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3667         clause in a linker script.
3668         (Layout::finalize): Don't create a .interp section if we've
3669         already create a PT_INTERP segment.
3670         (Layout::create_interp): Always call choose_output_section (revert
3671         patch of 2011-06-17).  Don't create PT_INTERP segment.
3672         * script-sections.cc
3673         (Script_sections::create_note_and_tls_segments): Add a .interp
3674         section to a PT_INTERP segment even if we have seen a
3675         --dynamic-linker option.
3676
3677 2011-06-18  Ian Lance Taylor  <iant@google.com>
3678
3679         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3680         merely because a non-PT_LOAD segment has a dynamic reloc.
3681
3682 2011-06-18  Ian Lance Taylor  <iant@google.com>
3683
3684         * layout.cc (Layout::finish_dynamic_section): Don't create
3685         DT_FLAGS entry if not needed.
3686
3687 2011-06-18  Ian Lance Taylor  <iant@google.com>
3688
3689         PR gold/12745
3690         * layout.cc (Layout::layout_eh_frame): Correct handling of
3691         writable .eh_frame section.
3692
3693 2011-06-17  Ian Lance Taylor  <iant@google.com>
3694
3695         PR gold/12893
3696         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3697         symbol is redefined with the exact same object and value.
3698
3699 2011-06-17  Ian Lance Taylor  <iant@google.com>
3700
3701         PR gold/12880
3702         * layout.h (class Layout): Add interp_segment_ field.
3703         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3704         (Layout::attach_allocated_section_to_segment): If making shared
3705         library, put .interp section in PT_INTERP segment.
3706         (Layout::finalize): Also call create_interp if -dynamic-linker
3707         option was used.
3708         (Layout::create_interp): Assert that there is no PT_INTERP
3709         segment.  If not using a SECTIONS clause, use make_output_section.
3710         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3711         * script-sections.cc
3712         (Script_sections::create_note_and_tls_segments): If making shared
3713         library, put .interp section in PT_INTERP segment.
3714
3715 2011-06-17  Ian Lance Taylor  <iant@google.com>
3716
3717         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3718         when making a shared library.
3719
3720 2011-06-17  Ian Lance Taylor  <iant@google.com>
3721
3722         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3723         parameter.  Change all callers.  Don't issue warning about PC32
3724         against locally defined symbol.
3725
3726 2011-06-16  Ian Lance Taylor  <iant@google.com>
3727
3728         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3729         occurs in same object.
3730
3731 2011-06-14  Alan Modra  <amodra@gmail.com>
3732
3733         * po/POTFILES.in: Regenerate.
3734
3735 2011-06-09  Ian Lance Taylor  <iant@google.com>
3736
3737         * script-sections.cc
3738         (Orphan_output_section::set_section_addresses): For a relocatable
3739         link set address to 0.
3740
3741 2011-06-09  Cary Coutant  <ccoutant@google.com>
3742
3743         PR gold/12804
3744         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3745         used with --compress-debug-sections.
3746         * gold/object.cc (Sized_relobj_file::do_layout): Report
3747         uncompressed size of compressed input sections.
3748
3749 2011-06-08  Cary Coutant  <ccoutant@google.com>
3750
3751         PR gold/12804
3752         * testsuite/two_file_test_2_v1.cc: Change initialization of
3753         v2 to keep it in .data.
3754
3755 2011-06-07  Cary Coutant  <ccoutant@google.com>
3756
3757         * common.cc (Symbol_table::do_allocate_commons_list): Call
3758         gold_fallback.
3759         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3760         (Errors::fallback): New function.
3761         (gold_fallback): New function.
3762         * errors.h (Errors::fallback): New function.
3763         * gold.cc (gold_exit): Change status parameter to enum; adjust
3764         all callers.
3765         (queue_initial_tasks): Call gold_fallback.
3766         * gold.h: Include cstdlib.
3767         (Exit_status): New enum type.
3768         (gold_exit): Change status parameter to enum.
3769         (gold_fallback): New function.
3770         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3771         (Layout::create_symtab_sections): Likewise.
3772         (Layout::create_shdrs): Likewise.
3773         * main.cc (main): Adjust call to gold_exit.
3774         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3775         (Output_data_got::add_got_entry_pair): Likewise.
3776         (Output_section::add_input_section): Likewise.
3777         (Output_section::add_output_section_data): Likewise.
3778         (Output_segment::set_section_list_addresses): Likewise.
3779         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3780
3781 2011-06-07  Cary Coutant  <ccoutant@google.com>
3782
3783         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3784         for incremental links.
3785         * output.cc (Output_segment::set_section_list_addresses): Remove
3786         FIXME and test for TLS or BSS.
3787
3788 2011-06-07  Cary Coutant  <ccoutant@google.com>
3789
3790         * testsuite/Makefile.am: Add incremental_copy_test,
3791         incremental_common_test_1.
3792         * testsuite/Makefile.in: Regenerate.
3793         * testsuite/common_test_1_v1.c: New source file.
3794         * testsuite/common_test_1_v2.c: New source file.
3795         * testsuite/copy_test_v1.cc: New source file.
3796
3797 2011-06-07  Cary Coutant  <ccoutant@google.com>
3798
3799         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3800         update, allocate common from bss section's free list.
3801         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3802         linker-defined symbols.
3803         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3804         Skip GOT and PLT entries that are no longer referenced.
3805         (Output_section_incremental_inputs::write_info_blocks): Mark
3806         linker-defined symbols.
3807         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3808         * output.cc (Output_section::allocate): New function.
3809         * output.h (Output_section::allocate): New function.
3810         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3811         linker-defined symbols.
3812         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3813         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3814         (Symbol::init_base_output_data): Likewise.
3815         (Symbol::init_base_output_segment): Likewise.
3816         (Symbol::init_base_constant): Likewise.
3817         (Sized_symbol::init_output_data): Likewise.
3818         (Sized_symbol::init_output_segment): Likewise.
3819         (Sized_symbol::init_constant): Likewise.
3820         (Symbol_table::do_define_in_output_data): Likewise.
3821         (Symbol_table::do_define_in_output_segment): Likewise.
3822         (Symbol_table::do_define_as_constant): Likewise.
3823         * symtab.h (Symbol::is_predefined): New function.
3824         (Symbol::init_base_output_data): Add is_predefined parameter.
3825         (Symbol::init_base_output_segment): Likewise.
3826         (Symbol::init_base_constant): Likewise.
3827         (Symbol::is_predefined_): New data member.
3828         (Sized_symbol::init_output_data): Add is_predefined parameter.
3829         (Sized_symbol::init_output_segment): Likewise.
3830         (Sized_symbol::init_constant): Likewise.
3831         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3832
3833 2011-06-07  Cary Coutant  <ccoutant@google.com>
3834
3835         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3836         instead of emit_copy_reloc.
3837         (Copy_relocs::emit_copy_reloc): Refactor.
3838         (Copy_relocs::make_copy_reloc): New function.
3839         (Copy_relocs::add_copy_reloc): Remove.
3840         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3841         section.
3842         (Copy_relocs::make_copy_reloc): New function.
3843         (Copy_relocs::add_copy_reloc): Remove.
3844         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3845         unchanged input files.
3846         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3847         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3848         Reserve BSS space for COPY relocations.
3849         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3850         (Output_section_incremental_inputs::write_info_blocks): Record
3851         whether a symbol is copied from a shared object.
3852         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3853         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3854         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3855         (Incremental_input_entry_reader::get_output_symbol_index): Add
3856         is_copy parameter.
3857         (Incremental_binary::emit_copy_relocs): New function.
3858         (Incremental_binary::do_emit_copy_relocs): New function.
3859         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3860         new data member.
3861         (Sized_incremental_binary::add_copy_reloc): New function.
3862         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3863         (Sized_incremental_binary::Copy_reloc): New struct.
3864         (Sized_incremental_binary::Copy_relocs): New typedef.
3865         (Sized_incremental_binary::copy_relocs_): New data member.
3866         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3867         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3868         * target.h (Sized_target::emit_copy_reloc): New function.
3869         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3870
3871 2011-06-02  Cary Coutant  <ccoutant@google.com>
3872
3873         PR gold/12163
3874         * gold/archive.cc (Archive::Archive): Initialize new data member.
3875         (Archive::include_all_members): Return if archive has already been
3876         included.
3877         * gold/archive.h (Archive::include_all_members_): New data member.
3878
3879 2011-06-02  Nick Clifton  <nickc@redhat.com>
3880
3881         * dynobj.h: Fix spelling mistake in comment.
3882         * output.cc: Likewise.
3883
3884 2011-05-31  Doug Kwan  <dougkwan@google.com>
3885             Asier Llano
3886
3887         PR gold/12826
3888         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3889         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3890         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3891         redundant arm_exidx_test.so.
3892         * testsuite/Makefile.in: Regenerate.
3893         (check_SCRIPTS): Add pr12826.sh
3894         (check_DATA): Add pr12826.stdout
3895         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3896         * testsuite/pr12826.sh: New file.
3897         * testsuite/pr12826_1.s: Ditto.
3898         * testsuite/pr12826_1.s: Ditto.
3899
3900 2011-05-30  Ian Lance Taylor  <iant@google.com>
3901
3902         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3903         sections.
3904
3905 2011-05-29  Ian Lance Taylor  <iant@google.com>
3906
3907         PR gold/12804
3908         * testsuite/Makefile.am: Use different file name for two_file_test
3909         temporary file for each incremental test.
3910         * testsuite/Makefile.in: Rebuild.
3911
3912 2011-05-29  Ian Lance Taylor  <iant@google.com>
3913
3914         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3915         binary input file is empty.
3916
3917 2011-05-27  Ian Lance Taylor  <iant@google.com>
3918
3919         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3920         (ver_test_9.so): Likewise.
3921         * testsuite/Makefile.in: Rebuild.
3922
3923 2011-05-26 Cary Coutant  <ccoutant@google.com>
3924
3925         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3926         * incremental.cc (Incremental_inputs::report_input_section): Fix
3927         comment, indentation.
3928         (Incremental_inputs::report_comdat_group): New function.
3929         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3930         of data for incremental input file entry.
3931         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3932         group count, COMDAT group signatures.
3933         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3934         an unchanged input file.
3935         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3936         Initialize new data member.
3937         (Incremental_object_entry::add_comdat_group): New function.
3938         (Incremental_object_entry::get_comdat_group_count): New function.
3939         (Incremental_object_entry::get_comdat_signature_key): New function.
3940         (Incremental_object_entry::groups_): New data member.
3941         (Incremental_inputs::report_comdat_group): New function.
3942         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3943         data for incremental input file entry.
3944         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3945         (Incremental_input_entry_reader::get_input_section): Adjust size of
3946         data for incremental input file entry.
3947         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3948         (Incremental_input_entry_reader::get_comdat_group_signature): New
3949         function.
3950         * object.cc (Sized_relobj::include_section_group): Report kept
3951         COMDAT groups for incremental links.
3952
3953 2011-05-24  David Meyer  <pdox@google.com>
3954
3955         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3956         with name parameter.  Add found_name parameter.
3957         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3958         * dirsearch.h (class Dirsearch): Update declaration.
3959
3960 2011-05-24  Ian Lance Taylor  <iant@google.com>
3961
3962         * archive.cc (Library_base::should_include_member): Pull in object
3963         from archive if it defines the entry symbol.
3964         * parameters.cc (Parameters::entry): New function.
3965         * parameters.h (class Parameters): Declare entry.
3966         * output.h (class Output_file_header): Remove entry_ field.
3967         * output.cc (Output_file_header::Output_file_header): Remove entry
3968         parameter.  Change all callers.
3969         (Output_file_header::entry): Use parameters->entry.
3970         * gold.cc (queue_middle_tasks): Likewise.
3971         * plugin.cc (Plugin_hook::run): Likewise.
3972
3973 2011-05-24 Cary Coutant  <ccoutant@google.com>
3974
3975         * gold.cc (queue_initial_tasks): Pass incremental base filename
3976         to Output_file::open_base_file; don't print error message.
3977         * incremental-dump.cc (main): Adjust call to
3978         Output_file::open_for_modification.
3979         * incremental-dump.cc (main): Likewise.
3980         * incremental.cc (Incremental_inputs::report_command_line):
3981         Ignore --incremental-base option when comparing command lines.
3982         Ignore parameter when given as separate argument.
3983         * options.h (class General_options): Add --incremental-base.
3984         * output.cc (Output_file::Output_file):
3985         (Output_file::open_base_file): Add base_name and writable parameters;
3986         read base file into new file; print error message here.
3987         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3988         callers.
3989         * output.h (Output_file::open_for_modification): Rename to...
3990         (Output_file::open_base_file): ...this; add base_name and
3991         writable parameters; adjust all callers.
3992         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3993         callers.
3994         * testsuite/Makefile.am (incremental_test_4): Test
3995         --incremental-base.
3996         * testsuite/Makefile.in: Regenerate.
3997
3998 2011-05-24 Cary Coutant  <ccoutant@google.com>
3999
4000         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4001         incremental_test_4.
4002         * testsuite/Makefile.in: Regenerate.
4003         * testsuite/two_file_test_1_v1.cc: New test source file.
4004         * testsuite/two_file_test_1b_v1.cc: New test source file.
4005         * testsuite/two_file_test_2_v1.cc: New test source file.
4006
4007 2011-05-24 Cary Coutant  <ccoutant@google.com>
4008
4009         * dynobj.h (Dynobj::do_dynobj): New function.
4010         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4011         flag and soname for shared objects.
4012         * incremental.cc (Incremental_inputs::report_object): Make
4013         either Incremental_object_entry or Incremental_dynobj_entry; add
4014         soname to string table.
4015         (Incremental_inputs::report_input_section): Add assertion.
4016         (Output_section_incremental_inputs::set_final_data_size): Adjust
4017         type of input file entry for shared libraries; adjust size of
4018         shared library info entry.
4019         (Output_section_incremental_inputs::write_input_files): Write
4020         as_needed flag for shared libraries.
4021         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4022         of input file entry for shared libraries; write soname.
4023         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4024         soname from incremental info.
4025         * incremental.h (enum Incremental_input_flags): Add
4026         INCREMENTAL_INPUT_AS_NEEDED.
4027         (Incremental_input_entry::Incremental_input_entry): Initialize new
4028         data member.
4029         (Incremental_input_entry::set_as_needed): New function.
4030         (Incremental_input_entry::as_needed): New function.
4031         (Incremental_input_entry::do_dynobj_entry): New function.
4032         (Incremental_input_entry::as_needed_): New data member.
4033         (Incremental_object_entry::Incremental_object_entry): Don't check
4034         for shared library.
4035         (Incremental_object_entry::do_type): Likewise.
4036         (class Incremental_dynobj_entry): New class.
4037         (Incremental_input_entry_reader::as_needed): New function.
4038         (Incremental_input_entry_reader::get_soname): New function.
4039         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4040         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4041         size of shared library info entry.
4042         * layout.cc (Layout::finish_dynamic_section): Don't test for
4043         incremental link when adding DT_NEEDED entries.
4044         * object.h (Object::Object): Initialize new data member.
4045         (Object::dynobj): New function.
4046         (Object::set_as_needed): New function.
4047         (Object::as_needed): New function.
4048         (Object::do_dynobj): New function.
4049         (Object::as_needed_): New data member.
4050
4051 2011-05-24 Cary Coutant  <ccoutant@google.com>
4052
4053         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4054         info; adjust display of GOT entries.
4055         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4056         vector of input objects; remove file_status_.
4057         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4058         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4059         got_plt reader; call target hooks to reserve GOT entries.
4060         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4061         of input file info header and GOT info entry.
4062         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4063         relocation info.
4064         (Got_plt_view_info::got_descriptor): Remove.
4065         (Got_plt_view_info::sym_index): New data member.
4066         (Got_plt_view_info::input_index): New data member.
4067         (Local_got_offset_visitor::visit): Write input file index.
4068         (Global_got_offset_visitor::visit): Write 0 for input file index.
4069         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4070         with sym_index and input_index.
4071         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4072         incremental info GOT entry; replace got_descriptor with input_index.
4073         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4074         map from input file index to object.
4075         (Sized_relobj_incr::do_layout): Replace direct data member reference
4076         with accessor function.
4077         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4078         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4079         Adjust size of input file info header.
4080         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4081         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4082         (Incremental_input_entry_reader::get_input_section): Adjust size of
4083         input file info header.
4084         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4085         of incremental info GOT entry.
4086         (Incremental_got_plt_reader::get_got_desc): Remove.
4087         (Incremental_got_plt_reader::get_got_symndx): New function.
4088         (Incremental_got_plt_reader::get_got_input_index): New function.
4089         (Sized_incremental_binary::Sized_incremental_binary): Remove
4090         file_status_; add input_objects_.
4091         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4092         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4093         (Sized_incremental_binary::file_is_unchanged): Remove.
4094         (Sized_incremental_binary::set_input_object): New function.
4095         (Sized_incremental_binary::input_object): New function.
4096         (Sized_incremental_binary::file_status_): Remove.
4097         (Sized_incremental_binary::input_objects_): New data member.
4098         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4099         references.
4100         (Sized_relobj_incr::invalid_address): Move to base class.
4101         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4102         class.
4103         (Sized_relobj_incr::do_output_section_offset): Likewise.
4104         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4105         (Sized_relobj_incr::section_offsets_): Likewise.
4106         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4107         function.
4108         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4109         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4110         with accessor function.
4111         (Sized_relobj_file::do_layout): Likewise.
4112         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4113         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4114         (Sized_relobj_file::compute_final_local_value): Replace refs to
4115         section_offsets_ with accessor function.
4116         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4117         * object.h (Relobj::Relobj): Initialize new data members.
4118         (Relobj::add_dyn_reloc): New function.
4119         (Relobj::first_dyn_reloc): New function.
4120         (Relobj::dyn_reloc_count): New function.
4121         (Relobj::first_dyn_reloc_): New data member.
4122         (Relobj::dyn_reloc_count_): New data member.
4123         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4124         references.
4125         (Sized_relobj::Address): New typedef.
4126         (Sized_relobj::invalid_address): Move here from child class.
4127         (Sized_relobj::Sized_relobj): Initialize new data members.
4128         (Sized_relobj::sized_relobj): New function.
4129         (Sized_relobj::is_output_section_offset_invalid): Move here from
4130         child class.
4131         (Sized_relobj::get_output_section_offset): Likewise.
4132         (Sized_relobj::local_has_got_offset): Likewise.
4133         (Sized_relobj::local_got_offset): Likewise.
4134         (Sized_relobj::set_local_got_offset): Likewise.
4135         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4136         (Sized_relobj::clear_got_offsets): New function.
4137         (Sized_relobj::section_offsets): Move here from child class.
4138         (Sized_relobj::do_output_section_offset): Likewise.
4139         (Sized_relobj::do_set_section_offset): Likewise.
4140         (Sized_relobj::Local_got_offsets): Likewise.
4141         (Sized_relobj::local_got_offsets_): Likewise.
4142         (Sized_relobj::section_offsets_): Likewise.
4143         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4144         references.
4145         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4146         class.
4147         (Sized_relobj_file::sized_relobj): New function
4148         (Sized_relobj_file::local_has_got_offset): Move to base class.
4149         (Sized_relobj_file::local_got_offset): Likewise.
4150         (Sized_relobj_file::set_local_got_offset): Likewise.
4151         (Sized_relobj_file::get_output_section_offset): Likewise.
4152         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4153         (Sized_relobj_file::do_output_section_offset): Likewise.
4154         (Sized_relobj_file::do_set_section_offset): Likewise.
4155         (Sized_relobj_file::Local_got_offsets): Likewise.
4156         (Sized_relobj_file::local_got_offsets_): Likewise.
4157         (Sized_relobj_file::section_offsets_): Likewise.
4158         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4159         (all constructors).
4160         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4161         (Output_reloc::get_symbol_index): Likewise.
4162         (Output_reloc::local_section_offset): Likewise.
4163         (Output_reloc::get_address): Likewise.
4164         (Output_reloc::symbol_value): Likewise.
4165         (Output_data_got::reserve_slot): Move to class definition.
4166         (Output_data_got::reserve_local): New function.
4167         (Output_data_got::reserve_slot_for_global): Remove.
4168         (Output_data_got::reserve_global): New function.
4169         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4170         (all constructors, two instantiations).
4171         (Output_reloc::get_relobj): New function (two instantiations).
4172         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4173         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4174         (Output_data_reloc::add_global): Adjust type of relobj.
4175         (Output_data_reloc::add_global_relative): Likewise.
4176         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4177         (Output_data_reloc::add_local): Likewise.
4178         (Output_data_reloc::add_local_relative): Likewise.
4179         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4180         (Output_data_reloc::add_local_section): Likewise.
4181         (Output_data_reloc::add_output_section): Likewise.
4182         (Output_data_reloc::add_absolute): Likewise.
4183         (Output_data_reloc::add_target_specific): Likewise.
4184         (Output_data_got::reserve_slot): Move definition here.
4185         (Output_data_got::reserve_local): New function.
4186         (Output_data_got::reserve_global): New function.
4187         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4188         section_offsets_ with accessor function.
4189         (Sized_relobj_file::write_sections): Likewise.
4190         (Sized_relobj_file::do_relocate_sections): Likewise.
4191         * target.h (Sized_target::reserve_local_got_entry): New function.
4192         (Sized_target::reserve_global_got_entry): New function.
4193         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4194         (Target_x86_64::reserve_global_got_entry): New function.
4195         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4196
4197 2011-05-23 Cary Coutant  <ccoutant@google.com>
4198
4199         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4200         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4201         bit when checking got_type.
4202         * incremental.cc (Sized_incremental_binary::setup_readers):
4203         Store symbol table and string table locations; initialize bit vector
4204         of file status flags.
4205         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4206         unchanged files.
4207         (Sized_incremental_binary::do_process_got_plt): New function.
4208         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4209         (Output_section_incremental_inputs::set_final_data_size): Record
4210         file index for each input file.
4211         (Output_section_incremental_inputs::write_got_plt): Store file index
4212         instead of input entry offset for each GOT entry.
4213         * incremental.h
4214         (Incremental_input_entry::Incremental_input_entry): Initialize new
4215         data member.
4216         (Incremental_input_entry::set_offset): Store file index.
4217         (Incremental_input_entry::get_file_index): New function.
4218         (Incremental_input_entry::file_index_): New data member.
4219         (Incremental_binary::process_got_plt): New function.
4220         (Incremental_binary::do_process_got_plt): New function.
4221         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4222         data members.
4223         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4224         (Sized_incremental_binary::set_file_is_unchanged): New function.
4225         (Sized_incremental_binary::file_is_unchanged): New function.
4226         (Sized_incremental_binary::do_process_got_plt): New function.
4227         (Sized_incremental_binary::file_status_): New data member.
4228         (Sized_incremental_binary::main_symtab_loc_): New data member.
4229         (Sized_incremental_binary::main_strtab_loc_): New data member.
4230         * output.cc (Output_data_got::Got_entry::write): Add case
4231         RESERVED_CODE.
4232         (Output_data_got::add_global): Call add_got_entry.
4233         (Output_data_got::add_global_plt): Likewise.
4234         (Output_data_got::add_global_with_rel): Likewise.
4235         (Output_data_got::add_global_with_rela): Likewise.
4236         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4237         (Output_data_got::add_global_pair_with_rela): Likewise.
4238         (Output_data_got::add_local): Call add_got_entry.
4239         (Output_data_got::add_local_plt): Likewise.
4240         (Output_data_got::add_local_with_rel): Likewise.
4241         (Output_data_got::add_local_with_rela): Likewise.
4242         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4243         (Output_data_got::add_local_pair_with_rela): Likewise.
4244         (Output_data_got::reserve_slot): New function.
4245         (Output_data_got::reserve_slot_for_global): New function.
4246         (Output_data_got::add_got_entry): New function.
4247         (Output_data_got::add_got_entry_pair): New function.
4248         (Output_section::add_output_section_data): Edit FIXME.
4249         * output.h
4250         (Output_section_data_build::Output_section_data_build): New
4251         constructor with size parameter.
4252         (Output_data_space::Output_data_space): Likewise.
4253         (Output_data_got::Output_data_got): Initialize new data member; new
4254         constructor with size parameter.
4255         (Output_data_got::add_constant): Call add_got_entry.
4256         (Output_data_got::reserve_slot): New function.
4257         (Output_data_got::reserve_slot_for_global): New function.
4258         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4259         (Output_data_got::add_got_entry): New function.
4260         (Output_data_got::add_got_entry_pair): New function.
4261         (Output_data_got::free_list_): New data member.
4262         * target.h (Sized_target::init_got_plt_for_update): New function.
4263         (Sized_target::register_global_plt_entry): New function.
4264         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4265         Initialize new data member; call init; add constructor with PLT count.
4266         (Output_data_plt_x86_64::init): New function.
4267         (Output_data_plt_x86_64::add_relocation): New function.
4268         (Output_data_plt_x86_64::reserve_slot): New function.
4269         (Output_data_plt_x86_64::free_list_): New data member.
4270         (Target_x86_64::init_got_plt_for_update): New function.
4271         (Target_x86_64::register_global_plt_entry): New function.
4272         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4273         incremental updates.
4274         (Output_data_plt_x86_64::add_relocation): New function.
4275         * testsuite/object_unittest.cc (Object_test): Set default options.
4276
4277 2011-05-16  Ian Lance Taylor  <iant@google.com>
4278
4279         * options.h (class General_options): Make -i a synonym for -r.
4280
4281 2011-05-16  Ian Lance Taylor  <iant@google.com>
4282
4283         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4284
4285 2011-05-10 Cary Coutant  <ccoutant@google.com>
4286
4287         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4288         strip_all (-s).
4289
4290 2011-05-06  Ian Lance Taylor  <iant@google.com>
4291
4292         * layout.cc (Layout::layout): If the output section flags change,
4293         update the ordering.
4294
4295 2011-04-25 Cary Coutant  <ccoutant@google.com>
4296
4297         * incremental-dump.cc (dump_incremental_inputs): Print local
4298         symbol info for each input file.
4299         * incremental.cc
4300         (Output_section_incremental_inputs::set_final_data_size): Add local
4301         symbol info to input file entries in incremental info.
4302         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4303         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4304         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4305         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4306         implementation.
4307         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4308         (Sized_incr_relobj::do_relocate): Write the local symbols.
4309         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4310         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4311         Adjust size of input file header.
4312         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4313         (Incremental_inputs_reader::get_local_symbol_count): New function.
4314         (Incremental_inputs_reader::get_input_section): Adjust size of input
4315         file header.
4316         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4317         (Sized_incr_relobj::This): New typedef.
4318         (Sized_incr_relobj::sym_size): New const data member.
4319         (Sized_incr_relobj::Local_symbol): New struct.
4320         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4321         (Sized_incr_relobj::do_local_symbol_offset): New function.
4322         (Sized_incr_relobj::local_symbol_count_): New data member.
4323         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4324         (Sized_incr_relobj::local_symbol_index_): New data member.
4325         (Sized_incr_relobj::local_symbol_offset_): New data member.
4326         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4327         (Sized_incr_relobj::local_symbols_): New data member.
4328         * object.h (Relobj::output_local_symbol_count): New function.
4329         (Relobj::local_symbol_offset): New function.
4330         (Relobj::do_output_local_symbol_count): New function.
4331         (Relobj::do_local_symbol_offset): New function.
4332         (Sized_relobj::do_output_local_symbol_count): New function.
4333         (Sized_relobj::do_local_symbol_offset): New function.
4334
4335 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4336
4337         * descriptors.cc (set_close_on_exec): New function.
4338         (Descriptors::open): Use set_close_on_exec.
4339         * output.cc (S_ISLNK): Define if not defined.
4340
4341 2011-04-22 Cary Coutant  <ccoutant@google.com>
4342
4343         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4344         global symbol map.
4345         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4346         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4347         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4348         relocations.
4349         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4350         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4351         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4352         * incremental.h
4353         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4354         function.
4355         (Incremental_binary::apply_incremental_relocs): New function.
4356         (Incremental_binary::do_apply_incremental_relocs): New function.
4357         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4358         data member.
4359         (Sized_incremental_binary::add_global_symbol): New function.
4360         (Sized_incremental_binary::global_symbol): New function.
4361         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4362         (Sized_incremental_binary::symbol_map_): New data member.
4363         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4364         * target.h (Sized_target::apply_relocation): New function.
4365         * target-reloc.h (apply_relocation): New function.
4366         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4367
4368 2011-04-22  Doug Kwan  <dougkwan@google.com>
4369
4370         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4371         flag of a SHT_ARM_EXIDX section.
4372         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4373         * testsuite/Makefile.in: Regenerate.
4374         * testsuite/arm_exidx_test.s: New file.
4375         * testsuite/arm_exidx_test.sh: Same.
4376
4377 2011-04-20 Cary Coutant  <ccoutant@google.com>
4378
4379         PR gold/12689
4380         * archive.h (Incremental_archive_entry::Archive_member):
4381         Initialize arg_serial_ (second constructor).
4382
4383 2011-04-17  Ian Lance Taylor  <iant@google.com>
4384
4385         * object.cc (Relocate_info::location): Simplify location string.
4386         * errors.cc (Errors::error_at_location): Don't print program
4387         name.
4388         (Errors::warning_at_location): Likewise.
4389         (Errors::undefined_symbol): Likewise.
4390         * testsuite/debug_msg.sh: Update accordingly.
4391
4392 2011-04-14 Cary Coutant  <ccoutant@google.com>
4393
4394         * gold/layout.cc (Layout::symtab_section_offset): New function.
4395         * gold/layout.h (Layout::symtab_section_offset): New function.
4396         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4397
4398 2011-04-12  Ian Lance Taylor  <iant@google.com>
4399
4400         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4401         with MREMAP_MAYMOVE.
4402         * output.h (class Output_file): Add map_is_allocated_ field.
4403         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4404         not available, provide stubs.  If mremap is not available, #define
4405         it to gold_mremap.
4406         (MREMAP_MAYMOVE): Define if not defined.
4407         (Output_file::Output_file): Initialize map_is_allocated_.
4408         (Output_file::resize): Check map_is_allocated_.
4409         (Output_file::map_anonymous): If mmap fails, use malloc.
4410         (Output_file::unmap): Don't do anything for an anonymous map.
4411         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4412         is not available, provide stubs.
4413         (File_read::View::~View): Use free rather than delete[].
4414         (File_read::make_view): Use malloc rather than new[].  If mmap
4415         fails, use malloc.
4416         (File_read::find_or_make_view): Use malloc rather than new[].
4417         * gold.h: Remove HAVE_REMAP code.
4418         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4419         exists.  Rename mremap to gold_mremap.  If mmap is not available
4420         don't do anything.
4421         * configure, config.in: Rebuild.
4422
4423 2011-04-11  Ian Lance Taylor  <iant@google.com>
4424
4425         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4426         initialize local variable v.
4427
4428 2011-04-11  Cary Coutant  <ccoutant@google.com>
4429
4430         * archive.cc (Archive::include_member): Adjust call to
4431         report_object.
4432         (Add_archive_symbols::run): Track argument serial numbers.
4433         (Lib_group::include_member): Likewise.
4434         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4435         * archive.h (Incremental_archive_entry::Archive_member):
4436         Initialize arg_serial_.
4437         (Archive_member::arg_serial_): New data member.
4438         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4439         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4440         incremental link.
4441         (Sized_dynobj::do_for_all_local_got_entries): New function.
4442         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4443         function.
4444         * fileread.cc (get_mtime): New function.
4445         * fileread.h (get_mtime): New function.
4446         * gold.cc (queue_initial_tasks): Check for incremental update.
4447         (process_incremental_input): New function.
4448         (queue_middle_tasks): Don't force valid target for incremental
4449         update.
4450         * incremental-dump.cc (find_input_containing_global): Adjust
4451         size of symbol info entry.
4452         (dump_incremental_inputs): Dump argument serial number and
4453         in_system_directory flag; bias shndx by 1; print symbol names
4454         when dumping per-file symbol lists; use new symbol info readers.
4455         * incremental.cc
4456         (Output_section_incremental_inputs:update_data_size): New function.
4457         (Sized_incremental_binary::setup_readers): Setup input readers
4458         for each input file; build maps for files added from libraries
4459         and scripts.
4460         (Sized_incremental_binary::check_input_args): New function.
4461         (Sized_incremental_binary::do_check_inputs): Build map of argument
4462         serial numbers to input arguments.
4463         (Sized_incremental_binary::do_file_has_changed): Rename
4464         do_file_is_unchanged to this; compare file modification times.
4465         (Sized_incremental_binary::do_init_layout): New function.
4466         (Sized_incremental_binary::do_reserve_layout): New function.
4467         (Sized_incremental_binary::do_get_input_reader): Remove.
4468         (Sized_incremental_binary::get_symtab_view): New function.
4469         (Incremental_checker::can_incrementally_link_output_file): Remove.
4470         (Incremental_inputs::report_command_line): Exclude --debug options.
4471         (Incremental_inputs::report_archive_begin): Add parameter; track
4472         argument serial numbers; don't put input file entry for archive
4473         before archive members.
4474         (Incremental_inputs::report_archive_end): Put input file entry
4475         for archive after archive members.
4476         (Incremental_inputs::report_object): Add parameter; track argument
4477         serial numbers and in_system_directory flag.
4478         (Incremental_inputs::report_script): Add parameter; track argument
4479         serial numbers.
4480         (Output_section_incremental_inputs::set_final_data_size): Adjust
4481         size of symbol info entry; check for forwarding symbols.
4482         (Output_section_incremental_inputs::write_input_files): Write
4483         in_system_directory flag and argument serial number.
4484         (Output_section_incremental_inputs::write_info_blocks): Map section
4485         indices between incremental info and original input file; store
4486         input section index for each symbol.
4487         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4488         change operator() to visit().
4489         (class Global_got_offset_visitor): Likewise.
4490         (class Global_symbol_visitor_got_plt):
4491         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4492         classes.
4493         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4494         (Sized_incr_relobj::do_read_symbols): New function.
4495         (Sized_incr_relobj::do_layout): New function.
4496         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4497         (Sized_incr_relobj::do_add_symbols): New function.
4498         (Sized_incr_relobj::do_should_include_member): New function.
4499         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4500         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4501         (Sized_incr_relobj::do_section_size): New function.
4502         (Sized_incr_relobj::do_section_name): New function.
4503         (Sized_incr_relobj::do_section_contents): New function.
4504         (Sized_incr_relobj::do_section_flags): New function.
4505         (Sized_incr_relobj::do_section_entsize): New function.
4506         (Sized_incr_relobj::do_section_address): New function.
4507         (Sized_incr_relobj::do_section_type): New function.
4508         (Sized_incr_relobj::do_section_link): New function.
4509         (Sized_incr_relobj::do_section_info): New function.
4510         (Sized_incr_relobj::do_section_addralign): New function.
4511         (Sized_incr_relobj::do_initialize_xindex): New function.
4512         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4513         (Sized_incr_relobj::do_read_relocs): New function.
4514         (Sized_incr_relobj::do_gc_process_relocs): New function.
4515         (Sized_incr_relobj::do_scan_relocs): New function.
4516         (Sized_incr_relobj::do_count_local_symbols): New function.
4517         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4518         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4519         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4520         (Sized_incr_relobj::do_relocate): New function.
4521         (Sized_incr_relobj::do_set_section_offset): New function.
4522         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4523         (Sized_incr_dynobj::do_read_symbols): New function.
4524         (Sized_incr_dynobj::do_layout): New function.
4525         (Sized_incr_dynobj::do_add_symbols): New function.
4526         (Sized_incr_dynobj::do_should_include_member): New function.
4527         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4528         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4529         (Sized_incr_dynobj::do_section_size): New function.
4530         (Sized_incr_dynobj::do_section_name): New function.
4531         (Sized_incr_dynobj::do_section_contents): New function.
4532         (Sized_incr_dynobj::do_section_flags): New function.
4533         (Sized_incr_dynobj::do_section_entsize): New function.
4534         (Sized_incr_dynobj::do_section_address): New function.
4535         (Sized_incr_dynobj::do_section_type): New function.
4536         (Sized_incr_dynobj::do_section_link): New function.
4537         (Sized_incr_dynobj::do_section_info): New function.
4538         (Sized_incr_dynobj::do_section_addralign): New function.
4539         (Sized_incr_dynobj::do_initialize_xindex): New function.
4540         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4541         (make_sized_incremental_object): New function.
4542         (Incremental_library::copy_unused_symbols): New function.
4543         (Incremental_library::do_for_all_unused_symbols): New function.
4544         * incremental.h (enum Incremental_input_flags): New type.
4545         (class Incremental_checker): Remove.
4546         (Incremental_input_entry::Incremental_input_entry): Add argument
4547         serial number.
4548         (Incremental_input_entry::arg_serial): New function.
4549         (Incremental_input_entry::set_is_in_system_directory): New function.
4550         (Incremental_input_entry::is_in_system_directory): New function.
4551         (Incremental_input_entry::arg_serial_): New data member.
4552         (Incremental_input_entry::is_in_system_directory_): New data member.
4553         (class Script_info): Move here from script.h.
4554         (Script_info::Script_info): Add filename parameter.
4555         (Script_info::filename): New function.
4556         (Script_info::filename_): New data member.
4557         (Incremental_script_entry::Incremental_script_entry): Add argument
4558         serial number.
4559         (Incremental_object_entry::Incremental_object_entry): Likewise.
4560         (Incremental_object_entry::add_input_section): Build list of input
4561         sections with map to original shndx.
4562         (Incremental_object_entry::get_input_section_index): New function.
4563         (Incremental_object_entry::shndx_): New data member.
4564         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4565         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4566         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4567         serial number.
4568         (Incremental_inputs::report_archive_begin): Likewise.
4569         (Incremental_inputs::report_object): Likewise.
4570         (Incremental_inputs::report_script): Likewise.
4571         (class Incremental_global_symbol_reader): New class.
4572         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4573         and store flags and input file type.
4574         (Incremental_input_entry_reader::arg_serial): New function.
4575         (Incremental_input_entry_reader::type): Extract type from flags.
4576         (Incremental_input_entry_reader::is_in_system_directory): New function.
4577         (Incremental_input_entry_reader::get_input_section_count): Call
4578         accessor function for type.
4579         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4580         function for type; adjust size of global symbol entry.
4581         (Incremental_input_entry_reader::get_global_symbol_count): Call
4582         accessor function for type.
4583         (Incremental_input_entry_reader::get_object_count): Likewise.
4584         (Incremental_input_entry_reader::get_object_offset): Likewise.
4585         (Incremental_input_entry_reader::get_member_count): Likewise.
4586         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4587         (Incremental_input_entry_reader::get_member_offset): Likewise.
4588         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4589         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4590         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4591         (Incremental_input_entry_reader::get_global_symbol_reader): New
4592         function.
4593         (Incremental_input_entry_reader::get_output_symbol_index): New
4594         function.
4595         (Incremental_input_entry_reader::type_): Remove.
4596         (Incremental_input_entry_reader::flags_): New data member.
4597         (Incremental_inputs_reader::input_file_offset): New function.
4598         (Incremental_inputs_reader::input_file_index): New function.
4599         (Incremental_inputs_reader::input_file): Call input_file_offset.
4600         (Incremental_inputs_reader::input_file_at_offset): New function.
4601         (Incremental_relocs_reader::get_r_type): Reformat.
4602         (Incremental_relocs_reader::get_r_shndx): Reformat.
4603         (Incremental_relocs_reader::get_r_offset): Reformat.
4604         (Incremental_relocs_reader::data): New function.
4605         (Incremental_binary::Incremental_binary): Initialize new data members.
4606         (Incremental_binary::check_inputs): Add cmdline parameter.
4607         (Incremental_binary::file_is_unchanged): Remove.
4608         (Input_reader::arg_serial): New function.
4609         (Input_reader::get_unused_symbol_count): New function.
4610         (Input_reader::get_unused_symbol): New function.
4611         (Input_reader::do_arg_serial): New function.
4612         (Input_reader::do_get_unused_symbol_count): New function.
4613         (Input_reader::do_get_unused_symbol): New function.
4614         (Incremental_binary::input_file_count): New function.
4615         (Incremental_binary::get_input_reader): Change signature to use
4616         index instead of filename.
4617         (Incremental_binary::file_has_changed): New function.
4618         (Incremental_binary::get_input_argument): New function.
4619         (Incremental_binary::get_library): New function.
4620         (Incremental_binary::get_script_info): New function.
4621         (Incremental_binary::init_layout): New function.
4622         (Incremental_binary::reserve_layout): New function.
4623         (Incremental_binary::output_file): New function.
4624         (Incremental_binary::do_check_inputs): New function.
4625         (Incremental_binary::do_file_is_unchanged): Remove.
4626         (Incremental_binary::do_file_has_changed): New function.
4627         (Incremental_binary::do_init_layout): New function.
4628         (Incremental_binary::do_reserve_layout): New function.
4629         (Incremental_binary::do_input_file_count): New function.
4630         (Incremental_binary::do_get_input_reader): Change signature.
4631         (Incremental_binary::input_args_map_): New data member.
4632         (Incremental_binary::library_map_): New data member.
4633         (Incremental_binary::script_map_): New data member.
4634         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4635         new data members.
4636         (Sized_incremental_binary::output_section): New function.
4637         (Sized_incremental_binary::inputs_reader): Add const.
4638         (Sized_incremental_binary::symtab_reader): Add const.
4639         (Sized_incremental_binary::relocs_reader): Add const.
4640         (Sized_incremental_binary::got_plt_reader): Add const.
4641         (Sized_incremental_binary::get_symtab_view): New function.
4642         (Sized_incremental_binary::Inputs_reader): New typedef.
4643         (Sized_incremental_binary::Input_entry_reader): New typedef.
4644         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4645         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4646         (Sized_incremental_binary::do_file_has_changed): New function.
4647         (Sized_incremental_binary::do_init_layout): New function.
4648         (Sized_incremental_binary::do_reserve_layout): New function.
4649         (Sized_input_reader::Inputs_reader): Remove.
4650         (Sized_input_reader::Input_entry_reader): Remove.
4651         (Sized_input_reader::do_arg_serial): New function.
4652         (Sized_input_reader::do_get_unused_symbol_count): New function.
4653         (Sized_input_reader::do_get_unused_symbol): New function.
4654         (Sized_incremental_binary::do_input_file_count): New function.
4655         (Sized_incremental_binary::do_get_input_reader): Change signature;
4656         use index instead of filename.
4657         (Sized_incremental_binary::section_map_): New data member.
4658         (Sized_incremental_binary::input_entry_readers_): New data member.
4659         (class Sized_incr_relobj): New class.
4660         (class Sized_incr_dynobj): New class.
4661         (make_sized_incremental_object): New function.
4662         (class Incremental_library): New class.
4663         * layout.cc (Free_list::num_lists): New static data member.
4664         (Free_list::num_nodes): New static data member.
4665         (Free_list::num_removes): New static data member.
4666         (Free_list::num_remove_visits): New static data member.
4667         (Free_list::num_allocates): New static data member.
4668         (Free_list::num_allocate_visits): New static data member.
4669         (Free_list::init): New function.
4670         (Free_list::remove): New function.
4671         (Free_list::allocate): New function.
4672         (Free_list::dump): New function.
4673         (Free_list::print_stats): New function.
4674         (Layout_task_runner::run): Resize output file for incremental updates.
4675         (Layout::Layout): Initialize new data members.
4676         (Layout::set_incremental_base): New function.
4677         (Layout::init_fixed_output_section): New function.
4678         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4679         incremental updates.
4680         (Layout::create_gold_note): Do not create gold note section for
4681         incremental updates.
4682         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4683         for incremental updates.
4684         (Layout::set_section_offsets): For incremental updates, allocate space
4685         from free list.
4686         (Layout::create_symtab_sections): Layout with offsets relative to
4687         start of section; for incremental updates, allocate space from free
4688         list.
4689         (Layout::create_shdrs): For incremental updates, allocate space from
4690         free list.
4691         (Layout::finish_dynamic_section): For incremental updates, do not
4692         check --as-needed (fixed in subsequent patch).
4693         * layout.h (class Free_list): New class.
4694         (Layout::set_incremental_base): New function.
4695         (Layout::incremental_base): New function.
4696         (Layout::init_fixed_output_section): New function.
4697         (Layout::allocate): New function.
4698         (Layout::incremental_base_): New data member.
4699         (Layout::free_list_): New data member.
4700         * main.cc (main): Print Free_list statistics.
4701         * object.cc (Relobj::finalize_incremental_relocs): Add
4702         clear_counts parameter; clear counts only when clear_counts is set.
4703         (Sized_relobj::Sized_relobj): Initialize new base class.
4704         (Sized_relobj::do_layout): Don't report special sections.
4705         (Sized_relobj::do_for_all_local_got_entries): New function.
4706         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4707         symtab_off to all symbol table offsets.
4708         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4709         * object.h (class Got_offset_list): Move to top of file.
4710         (Object::Object): Allow case where input_file == NULL.
4711         (Object::~Object): Likewise.
4712         (Object::input_file): Assert that input_file != NULL.
4713         (Object::lock): Allow case where input_file == NULL.
4714         (Object::unlock): Likewise.
4715         (Object::is_locked): Likewise.
4716         (Object::token): Likewise.
4717         (Object::release): Likewise.
4718         (Object::is_incremental): New function.
4719         (Object::get_mtime): New function.
4720         (Object::for_all_local_got_entries): New function.
4721         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4722         (Object::set_is_in_system_directory): New function.
4723         (Object::is_in_system_directory): New function.
4724         (Object::do_is_incremental): New function.
4725         (Object::do_get_mtime): New function.
4726         (Object::do_for_all_local_got_entries): New function.
4727         (Object::is_in_system_directory_): New data member.
4728         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4729         (class Sized_relobj_base): New class.
4730         (class Sized_relobj): Derive from Sized_relobj_base.
4731         (class Sized_relobj::Symbols): Redeclare from base class.
4732         (class Sized_relobj::local_got_offset_list): Remove.
4733         (class Sized_relobj::Output_sections): Redeclare from base class.
4734         (class Sized_relobj::do_for_all_local_got_entries): New function.
4735         (class Sized_relobj::write_local_symbols): Add offset parameter.
4736         (class Sized_relobj::local_symbol_offset_): Update comment.
4737         (class Sized_relobj::local_dynsym_offset_): Update comment.
4738         * options.cc (Input_arguments::add_file): Remove const.
4739         * options.h (Input_file_argument::Input_file_argument):
4740         Initialize arg_serial_ (all constructors).
4741         (Input_file_argument::set_arg_serial): New function.
4742         (Input_file_argument::arg_serial): New function.
4743         (Input_file_argument::arg_serial_): New data member.
4744         (Input_arguments::Input_arguments): Initialize file_count_.
4745         (Input_arguments::add_file): Remove const.
4746         (Input_arguments::number_of_input_files): New function.
4747         (Input_arguments::file_count_): New data member.
4748         (Command_line::number_of_input_files): Call
4749         Input_arguments::number_of_input_files.
4750         * output.cc (Output_segment_headers::Output_segment_headers):
4751         Set current size.
4752         (Output_section::Input_section::current_data_size): New function.
4753         (Output_section::Output_section): Initialize new data members.
4754         (Output_section::add_input_section): Don't do merge sections for
4755         an incremental link; allocate space from free list for an
4756         incremental update.
4757         (Output_section::add_output_section_data): Allocate space from
4758         free list for an incremental update.
4759         (Output_section::update_data_size): New function.
4760         (Output_section::set_fixed_layout): New function.
4761         (Output_section::reserve): New function.
4762         (Output_segment::set_section_addresses): Remove const.
4763         (Output_segment::set_section_list_addresses): Remove const; allocate
4764         space from free list for an incremental update.
4765         (Output_segment::set_offset): Adjust size of RELRO segment for an
4766         incremental update.
4767         * output.h (Output_data::current_data_size): Move here from
4768         child classes.
4769         (Output_data::pre_finalize_data_size): New function.
4770         (Output_data::update_data_size): New function.
4771         (Output_section_headers::update_data_size): new function.
4772         (Output_section_data_build::current_data_size): Move to Output_data.
4773         (Output_data_strtab::update_data_size): New function.
4774         (Output_section::current_data_size): Move to Output_data.
4775         (Output_section::set_fixed_layout): New function.
4776         (Output_section::has_fixed_layout): New function.
4777         (Output_section::reserve): New function.
4778         (Output_section::update_data_size): New function.
4779         (Output_section::has_fixed_layout_): New data member.
4780         (Output_section::free_list_): New data member.
4781         (Output_segment::set_section_addresses): Remove const.
4782         (Output_segment::set_section_list_addresses): Remove const.
4783         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4784         New function.
4785         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4786         New function.
4787         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4788         parameter when calling Add_symbols constructor; store argument
4789         serial number for members of a lib group.
4790         (Add_symbols::locks): Allow case where token == NULL.
4791         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4792         (Read_member::~Read_member): New function.
4793         (Read_member::is_runnable): New function.
4794         (Read_member::locks): New function.
4795         (Read_member::run): New function.
4796         (Check_script::~Check_script): New function.
4797         (Check_script::is_runnable): New function.
4798         (Check_script::locks): New function.
4799         (Check_script::run): New function.
4800         (Check_library::~Check_library): New function.
4801         (Check_library::is_runnable): New function.
4802         (Check_library::locks): New function.
4803         (Check_library::run): New function.
4804         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4805         (Add_symbols::library_): New data member.
4806         (class Read_member): New class.
4807         (class Check_script): New class.
4808         (class Check_library): New class.
4809         * reloc.cc (Read_relocs::is_runnable): Allow case where
4810         token == NULL.
4811         (Read_relocs::locks): Likewise.
4812         (Scan_relocs::locks): Likewise.
4813         (Relocate_task::locks): Likewise.
4814         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4815         to clear counters.
4816         (Sized_relobj::incremental_relocs_scan): Fix comment.
4817         (Sized_relobj::do_relocate): Pass output file offset to
4818         write_local_symbols.
4819         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4820         from class declaration.
4821         * script.cc (read_input_script): Allocate Script_info; pass
4822         argument serial number to report_script.
4823         * script.h (class Script_info): Move to incremental.h.
4824         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4825         * symtab.h (Symbol_table::add_from_incrobj): New function.
4826         (Symbol_table::set_file_offset): New function.
4827
4828 2011-04-05  Cary Coutant  <ccoutant@google.com>
4829
4830         * incremental-dump.cc (dump_incremental_inputs): Change signature
4831         to take a Sized_incremental_binary; change caller.  Use readers
4832         in Sized_incremental_binary.
4833         * incremental.cc
4834         (Sized_incremental_binary::find_incremental_inputs_sections):
4835         Rename do_find_incremental_inputs_sections to this.
4836         (Sized_incremental_binary::setup_readers): New function.
4837         (Sized_incremental_binary::do_check_inputs): Check
4838         has_incremental_info_ flag; move setup code to setup_readers;
4839         use input readers.
4840         (Sized_incremental_binary::do_file_is_unchanged): New function.
4841         (Sized_incremental_binary::do_get_input_reader): New function.
4842         * incremental.h (class Incremental_binary): Move to end of file.
4843         (Incremental_binary::file_is_unchanged): New function.
4844         (Incremental_binary::do_file_is_unchanged): New function.
4845         (Incremental_binary::Input_reader): New class.
4846         (Incremental_binary::get_input_reader): New function.
4847         (class Sized_incremental_binary): Move to end of file.
4848         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4849         input section reader classes.
4850         (Sized_incremental_binary::has_incremental_info): New function.
4851         (Sized_incremental_binary::inputs_reader): New function.
4852         (Sized_incremental_binary::symtab_reader): New function.
4853         (Sized_incremental_binary::relocs_reader): New function.
4854         (Sized_incremental_binary::got_plt_reader): New function.
4855         (Sized_incremental_binary::do_file_is_unchanged): New function.
4856         (Sized_incremental_binary::Sized_input_reader): New class.
4857         (Sized_incremental_binary::get_input_reader): New function.
4858         (Sized_incremental_binary::find_incremental_inputs_sections):
4859         Rename do_find_incremental_inputs_sections to this.
4860         (Sized_incremental_binary::setup_readers): New function.
4861         (Sized_incremental_binary::has_incremental_info_): New data member.
4862         (Sized_incremental_binary::inputs_reader_): New data member.
4863         (Sized_incremental_binary::symtab_reader_): New data member.
4864         (Sized_incremental_binary::relocs_reader_): New data member.
4865         (Sized_incremental_binary::got_plt_reader_): New data member.
4866         (Sized_incremental_binary::current_input_file_): New data member.
4867
4868 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4869
4870         PR gold/12640
4871         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4872         violation.
4873
4874 2011-03-30  Cary Coutant  <ccoutant@google.com>
4875
4876         * archive.cc (Archive::include_member): Adjust call to report_object.
4877         (Add_archive_symbols::run): Add script_info to call to
4878         report_archive_begin.
4879         (Lib_group::include_member): Adjust call to report_object.
4880         (Add_lib_group_symbols::run): Adjust call to report_object.
4881         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4882         blocks.  Add object count for script input files.
4883         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4884         script_info parameter; change all callers.
4885         (Incremental_inputs::report_object): Add script_info parameter;
4886         change all callers.
4887         (Incremental_inputs::report_script): Store backpointer to
4888         incremental info entry.
4889         (Output_section_incremental_inputs::set_final_data_size): Record
4890         additional information for scripts.
4891         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4892         * incremental.h (Incremental_script_entry::add_object): New function.
4893         (Incremental_script_entry::get_object_count): New function.
4894         (Incremental_script_entry::get_object): New function.
4895         (Incremental_script_entry::objects_): New data member; adjust
4896         constructor.
4897         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4898         (Incremental_inputs::report_object): Add script_info parameter.
4899         (Incremental_inputs_reader::get_object_count): New function.
4900         (Incremental_inputs_reader::get_object_offset): New function.
4901         * options.cc (Input_arguments::add_file): Return reference to
4902         new input argument.
4903         * options.h (Input_argument::set_script_info): New function.
4904         (Input_argument::script_info): New function.
4905         (Input_argument::script_info_): New data member; adjust all
4906         constructors.
4907         (Input_file_group::add_file): Return reference to new input argument.
4908         (Input_file_lib::add_file): Likewise.
4909         (Input_arguments::add_file): Likewise.
4910         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4911         * script.cc (Parser_closure::Parser_closure): Add script_info
4912         parameter; adjust all callers.
4913         (Parser_closure::script_info): New function.
4914         (Parser_closure::script_info_): New data member.
4915         (read_input_script): Report scripts earlier to incremental info.
4916         (script_add_file): Set script_info in Input_argument.
4917         (script_add_library): Likewise.
4918         * script.h (Script_options::Script_info): Rewrite class.
4919
4920 2011-03-29  Cary Coutant  <ccoutant@google.com>
4921
4922         * archive.cc (Library_base::should_include_member): Move
4923         method here from class Archive.
4924         (Archive::Archive): Initialize base class.
4925         (Archive::should_include_member): Move to base class.
4926         (Archive::do_for_all_unused_symbols): New function.
4927         (Add_archive_symbols::run): Remove redundant access to
4928         incremental_inputs.
4929         (Lib_group::Lib_group): Initialize base class.
4930         (Lib_group::do_filename): New function.
4931         (Lib_group::include_member): Pass pointer to Lib_group to
4932         report_object.
4933         (Lib_group::do_for_all_unused_symbols): New function.
4934         (Add_lib_group_symbols::run): Report archive information for
4935         incremental links.
4936         * archive.h (class Library_base): New base class.
4937         (class Archive): Derive from Library_base.
4938         (Archive::filename): Move to base class.
4939         (Archive::set_incremental_info): Likewise.
4940         (Archive::incremental_info): Likewise.
4941         (Archive::Should_include): Likewise.
4942         (Archive::should_include_member): Likewise.
4943         (Archive::Armap_entry): Remove.
4944         (Archive::Unused_symbol_iterator): Remove.
4945         (Archive::unused_symbols_begin): Remove.
4946         (Archive::unused_symbols_end): Remove.
4947         (Archive::do_filename): New function.
4948         (Archive::do_get_mtime): New function.
4949         (Archive::do_for_all_unused_symbols): New function.
4950         (Archive::task_): Move to base class.
4951         (Archive::incremental_info_): Likewise.
4952         (class Lib_group): Derive from Library_base.
4953         (Lib_group::do_filename): New function.
4954         (Lib_group::do_get_mtime): New function.
4955         (Lib_group::do_for_all_unused_symbols): New function.
4956         (Lib_group::task_): Move to base class.
4957         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4958         function.
4959         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4960         function.
4961         * incremental.cc (Incremental_inputs::report_archive_begin):
4962         Use Library_base; call library's get_mtime; add incremental inputs
4963         entry before members.
4964         (class Unused_symbol_visitor): New class.
4965         (Incremental_inputs::report_archive_end): Use Library_base; use
4966         visitor class to record unused symbols; don't add incremental inputs
4967         entry after members.
4968         (Incremental_inputs::report_object): Use Library_base.
4969         * incremental.h
4970         (Incremental_archive_entry::Incremental_archive_entry): Remove
4971         unused Archive parameter.
4972         (Incremental_inputs::report_archive_begin): Use Library_base.
4973         (Incremental_inputs::report_archive_end): Likewise.
4974         (Incremental_inputs::report_object): Likewise.
4975         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4976         function.
4977         * object.h (Object::for_all_global_symbols): New function.
4978         (Object::do_for_all_global_symbols): New function.
4979         (Sized_relobj::do_for_all_global_symbols): New function.
4980         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4981         function.
4982         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4983         function.
4984
4985 2011-03-27  Ian Lance Taylor  <iant@google.com>
4986
4987         * archive.cc (Archive::interpret_header): Return -1 if something
4988         goes wrong.  Change callers accordingly.
4989
4990 2011-03-25  Cary Coutant  <ccoutant@google.com>
4991
4992         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4993         * testsuite/Makefile.in: Regenerate.
4994
4995 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4996
4997         * plugin.cc (get_view): New.
4998         (Plugin::load): Pass get_view to the plugin.
4999         (Plugin_manager::get_view): New.
5000
5001 2011-03-21  Ian Lance Taylor  <iant@google.com>
5002
5003         * testsuite/final_layout.sh: Rewrite to not use dc.
5004         * testsuite/relro_test.sh: Fail if dc is not present.
5005
5006 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5007
5008         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5009         Change == to -eq.
5010         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5011         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5012         Change == to -eq.
5013         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5014         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5015
5016 2011-03-14  Ian Lance Taylor  <iant@google.com>
5017
5018         * script-sections.cc (Sort_output_sections::script_compare):
5019         Rename from is_before, change return type.
5020         (Sort_output_sections::operator()): Adjust accordingly.
5021
5022 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5023
5024         PR gold/12572
5025         * testsuite/odr_violation2.cc: Add comment to make all error line
5026         numbers double digits.
5027         * testsuite/debug_msg.sh: Adjust expected errors.
5028
5029 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5030
5031         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5032         but mark earlier ones as non-canonical
5033         (offset_to_iterator): Update search target and example
5034         (do_addr2line): Return extra lines in a vector*
5035         (format_file_lineno): Extract from do_addr2line
5036         (one_addr2line): Add vector* out-param
5037         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5038         when a lineno entry appeared last for its instruction
5039         (Dwarf_line_info): Add vector* out-param
5040         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5041         * symtab.cc (Odr_violation_compare): Include the lineno in the
5042         comparison again.
5043         (linenos_from_loc): New. Combine the canonical line for an
5044         address with its other lines.
5045         (True_if_intersect): New. Helper functor to make
5046         std::set_intersection a query.
5047         (detect_odr_violations): Compare sets of lines instead of just
5048         one line for each function. This became less deterministic, but
5049         has fewer false positives.
5050         * symtab.h: Declarations.
5051         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5052         mix an optimized and non-optimized object in the same binary
5053         (odr_violation2.so): Same.
5054         * testsuite/Makefile.in: Regenerate from Makefile.am.
5055         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5056         * testsuite/debug_msg.sh: Update line numbers and add
5057         assertions.
5058         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5059         non-optimized context.
5060         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5061         isn't inlined, and use OdrDerived in an optimized context.
5062         * testsuite/odr_header1.h: Defines OdrDerived, where
5063         optimization will change the
5064         first-instruction-in-the-destructor's file and line number.
5065         * testsuite/odr_header2.h: Defines OdrBase.
5066
5067 2011-03-09  Ian Lance Taylor  <iant@google.com>
5068
5069         * fileread.cc (File_read::clear_views): Don't delete the whole
5070         file view.
5071
5072 2011-03-08  Ian Lance Taylor  <iant@google.com>
5073
5074         PR gold/12525
5075         * fileread.cc: #include <climits>.
5076         (GOLD_IOV_MAX): Define.
5077         (File_read::read_multiple): Limit number of entries by iov_max.
5078         * fileread.h (class File_read): Always set max_readv_entries to
5079         128.
5080
5081 2011-03-07  Ian Lance Taylor  <iant@google.com>
5082
5083         PR gold/12525
5084         * options.h (class General_options): Add -dy and -dn.
5085
5086 2011-03-02  Cary Coutant  <ccoutant@google.com>
5087
5088         * testsuite/script_test_9.t: Add TLS segment.
5089
5090 2011-03-02  Simon Baldwin  <simonb@google.com>
5091
5092         * configure.ac: Add check for gnu_indirect_function support in
5093         the toolchain building binutils.
5094         * configure: Rebuild.
5095
5096 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5097
5098         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5099         plugin only symbols.
5100         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5101         in plugin files as not needed in the symbol table.
5102
5103 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5104
5105         * output.cc (Output_section::add_input_section): Delay fill
5106         generation for section ordering.
5107
5108 2011-02-09  Ian Lance Taylor  <iant@google.com>
5109
5110         PR gold/12316
5111         * object.h (class Sized_relobj): Remove clear_local_symbols.
5112         * reloc.cc (Sized_relobj::do_relocate): Don't call
5113         clear_local_symbols.
5114
5115 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5116
5117         * plugin.cc (is_visible_from_outside): Return true for symbols
5118         in the -u option.
5119
5120 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5121
5122         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5123         filename.
5124
5125 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5126
5127         * icf.h (is_section_foldable_candidate): Change type of parameter
5128         to std::string.
5129         * icf.cc (Icf::find_identical_sections): Change type of local variable
5130         section_name to be std::string.
5131         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5132
5133 2011-01-25  Ian Lance Taylor  <iant@google.com>
5134
5135         * script.cc (script_add_extern): Rewrite to use
5136         add_symbol_reference.
5137
5138 2011-01-25  Doug Kwan  <dougkwan@google.com>
5139
5140         * icf.cc (get_section_contents): Always lock section's object.
5141
5142 2011-01-24  Ian Lance Taylor  <iant@google.com>
5143
5144         * options.h (class General_options): Accept
5145         --no-detect-odr-violations.
5146
5147 2011-01-24  Ian Lance Taylor  <iant@google.com>
5148
5149         * version.cc (version_string): Bump to 1.11.
5150
5151 2011-01-24  Ian Lance Taylor  <iant@google.com>
5152
5153         * plugin.cc (class Plugin_rescan): Define new class.
5154         (Plugin_manager::claim_file): Set any_claimed_.
5155         (Plugin_manager::save_archive): New function.
5156         (Plugin_manager::save_input_group): New function.
5157         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5158         necessary.
5159         (Plugin_manager::new_undefined_symbol): New function.
5160         (Plugin_manager::rescan): New function.
5161         (Plugin_manager::rescannable_defines): New function.
5162         (Plugin_manager::add_input_file): Set any_added_.
5163         * plugin.h (class Plugin_manager): define new fields rescannable_,
5164         undefined_symbols_, any_claimed_, and any_added_.  Declare
5165         Plugin_rescan as friend.  Declare new functions.
5166         (Plugin_manager::Rescannable): Define type.
5167         (Plugin_manager::Rescannable_list): Define type.
5168         (Plugin_manager::Undefined_symbol_list): Define type.
5169         (Plugin_manager::Plugin_manager): Initialize new fields.
5170         * archive.cc (Archive::defines_symbol): New function.
5171         (Add_archive_symbols::run): Pass archive to plugins if any.
5172         * archive.h (class Archive): Declare defines_symbol.
5173         * readsyms.cc (Input_group::~Input_group): New function.
5174         (Finish_group::run): Pass input_group to plugins if any.
5175         * readsyms.h (class Input_group): Declare destructor.
5176         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5177         any.
5178
5179 2011-01-10  Ian Lance Taylor  <iant@google.com>
5180
5181         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5182         section as relro.
5183         (Layout::set_segment_offsets): Reset increase_relro before calling
5184         set_section_addresses a second time.
5185
5186 2011-01-04  Cary Coutant  <ccoutant@google.com>
5187
5188         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5189         sections before NOBITS sections.
5190
5191 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5192
5193         * version.cc (print_version): Update copyright to 2011.
5194
5195 2010-12-23  Cary Coutant  <ccoutant@google.com>
5196
5197         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5198         of OS to this->add.  Add OD parameter to second form of the function.
5199
5200 2010-12-20  Ian Lance Taylor  <iant@google.com>
5201
5202         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5203         second of two consecutive entries with same offset.
5204
5205 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5206
5207         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5208         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5209         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5210         to avoid unneeded links against $(LDADD).
5211         * testsuite/Makefile.in: Regenerate.
5212
5213 2010-12-15  Ian Lance Taylor  <iant@google.com>
5214
5215         PR gold/12324
5216         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5217         for R_X86_64_32 and R_X86_64_PC32.
5218         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5219         ver_matching_def_pic.o.
5220         (ver_matching_def_pic.o): New target.
5221
5222 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5223
5224         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5225         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5226         Move definition before File_read::View member definitions.
5227         (File_read::View::~View): Initialize and hold lock before
5228         updating current_mapped_bytes.
5229
5230 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5231
5232         * dwarf_reader.cc: Remove outdated comment.
5233         * gold-threads.cc: Fix typo in error message.
5234         * archive.cc: Fix typos in comments.
5235         * archive.h: Likewise.
5236         * arm-reloc-property.cc: Likewise.
5237         * arm-reloc-property.h: Likewise.
5238         * arm-reloc.def: Likewise.
5239         * arm.cc: Likewise.
5240         * attributes.h: Likewise.
5241         * cref.cc: Likewise.
5242         * ehframe.cc: Likewise.
5243         * fileread.h: Likewise.
5244         * gold.h: Likewise.
5245         * i386.cc: Likewise.
5246         * icf.cc: Likewise.
5247         * incremental.h: Likewise.
5248         * int_encoding.cc: Likewise.
5249         * layout.h: Likewise.
5250         * main.cc: Likewise.
5251         * merge.h: Likewise.
5252         * object.cc: Likewise.
5253         * object.h: Likewise.
5254         * options.cc: Likewise.
5255         * readsyms.cc: Likewise.
5256         * reduced_debug_output.cc: Likewise.
5257         * reloc.cc: Likewise.
5258         * script-sections.cc: Likewise.
5259         * sparc.cc: Likewise.
5260         * symtab.h: Likewise.
5261         * target-reloc.h: Likewise.
5262         * target.cc: Likewise.
5263         * target.h: Likewise.
5264         * timer.cc: Likewise.
5265         * timer.h: Likewise.
5266         * x86_64.cc: Likewise.
5267
5268 2010-12-09  Cary Coutant  <ccoutant@google.com>
5269
5270         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5271         stack.
5272         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5273         parameter; change all callers.
5274         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5275         * options.h (warn_execstack): New option.
5276
5277 2010-12-07  Doug Kwan  <dougkwan@google.com>
5278
5279         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5280         like function call relocations.
5281
5282 2010-12-07  Ian Lance Taylor  <iant@google.com>
5283
5284         * archive.cc (Archive::get_elf_object_for_member): Permit
5285         punconfigured to be NULL.
5286         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5287         (Archive::include_member): Pass NULL to get_elf_object_for_member
5288         if we searched for the archive and this is the first included
5289         object.
5290
5291 2010-12-01  Ian Lance Taylor  <iant@google.com>
5292
5293         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5294         track_relocs_type_ field.
5295         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5296         Set track_relocs_type_.
5297         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5298         contents when using RELA relocs.
5299         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5300         reloc_map_.
5301         * reloc.cc (Track_relocs::next_addend): New function.
5302         * reloc.h (class Track_relocs): Declare next_addend.
5303
5304 2010-12-01  Ian Lance Taylor  <iant@google.com>
5305
5306         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5307         virtual destructor.
5308
5309 2010-12-01  Ian Lance Taylor  <iant@google.com>
5310
5311         * README: Update compilers known to work and fail.
5312
5313 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5314
5315         * configure.in: For --enable-gold, handle value `default' instead of
5316         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5317         not the default.
5318         * configure: Regenerate.
5319
5320 2010-11-18  Doug Kwan  <dougkwan@google.com>
5321
5322         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5323         and right_alignment to be zero.  Store result alignment only if it is
5324         greater than existing alignment.
5325
5326 2010-11-16  Cary Coutant  <ccoutant@google.com>
5327
5328         PR gold/12220
5329         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5330         Check for ".zdebug_line".
5331
5332 2010-11-16  Doug Kwan  <dougkwan@google.com>
5333             Cary Coutant  <ccoutant@google.com>
5334
5335         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5336         by reference; adjust all callers.
5337         * output.cc (Output_segment::set_section_addresses): Adjust references
5338         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5339         list is empty.
5340         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5341         end at page boundary.
5342
5343 2010-11-16  Cary Coutant  <ccoutant@google.com>
5344
5345         PR gold/12220
5346         * layout.cc (Layout::choose_output_section): Transform names of
5347         compressed sections even when using a script with a SECTIONS clause.
5348         (Layout::output_section_name): Remove code to transform
5349         compressed debug section names.
5350         * output.cc (Output_section::add_input_section): Use uncompressed
5351         section size when tracking input sections.
5352
5353 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5354
5355         * symtab.h (Symbol::NON_PIC_REF): Remove.
5356         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5357         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5358         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5359         (Symbol::use_plt_offset): Take a flags argument and pass it
5360         directly to needs_dynamic_reloc.  Restrict check for undefined
5361         weak symbols to function calls.
5362         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5363         (Target_arm::Scan::global): Use it.
5364         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5365         (Target_arm::Relocate::relocate): Likewise.
5366         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5367         parameter with an r_type parameter.  Use get_reference_flags
5368         to get the flags.
5369         (Target_arm::Relocate::relocate): Update accordingly.
5370         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5371         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5372         (Target_i386::Scan::global): Likewise.
5373         (Target_i386::Relocate::relocate): Likewise.
5374         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5375         parameter with an r_type parameter.  Use get_reference_flags
5376         to get the flags.
5377         (Target_i386::Relocate::relocate): Update accordingly.
5378         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5379         (Target_powerpc::Scan::global): Use it.
5380         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5381         (Target_powerpc::Relocate::relocate): Likewise.
5382         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5383         (Target_sparc::Scan::global): Use it.
5384         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5385         (Target_sparc::Relocate::relocate): Likewise.
5386         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5387         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5388         (Target_x86_64::Scan::global): Likewise.
5389         (Target_x86_64::Relocate::relocate): Likewise.
5390
5391 2010-11-08  Doug Kwan  <dougkwan@google.com>
5392             Cary Coutant  <ccoutant@google.com>
5393
5394         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5395         (Arm_exidx_merge_section::section_contents_): New data member.
5396         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5397         (Arm_input_section::~Arm_input_section): De-allocate memory.
5398         (Arm_input_section::original_contents_): New data member.
5399         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5400         in parameters instead of calling Object::section_contents without
5401         locking.
5402         (Arm_output_section::group_section): New parameter TASK.  Pass it
5403         to callees that need locking objects.
5404         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5405         to lock EXIDX input sections.  Fix a formatting issue.  Call
5406         Arm_exidx_merged_section::build_contents to create merged section
5407         contents.
5408         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5409         to lock object of stub table owner.
5410         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5411         TEXT_SIZE to initialize data member TEXT_SIZE_.
5412         (Arm_exidx_input_section::addralign): Fix typo in comment.
5413         (Arm_exidx_input_section::text_size): New method.
5414         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5415         that require locking objects.  Lock objects before scanning for stubs
5416         and updating local symbols.
5417         (Arm_input_section<big_endian>::init): Copy contents of original
5418         input section.
5419         (Arm_input_section<big_endian>::do_write): Use saved contents of
5420         original input section instead of calling Object::section_contents
5421         without locking.
5422         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5423         size without calling Object::section_size().
5424         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5425         for size.  Allocate a buffer for merged EXIDX entries.
5426         (Arm_exidx_merged_section::build_contents): New method.
5427         (Arm_exidx_merged_section::do_write): Move merge section contents
5428         building code to Arm_exidx_merged_section::build_contetns.  Write
5429         out contetns in buffer instead of building it on the fly.
5430         (Arm_relobj::make_exidx_input_section): Also pass text section size
5431         to Arm_exidx_input_section constructor.
5432         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5433         (Arm_dynobj::do_read_symbols): Fix memory leak.
5434         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5435         * target.h: (class Task): Add forward declaration.
5436         (Target::relax): Add new parameter TASK and pass it to
5437         Target::do_relax().
5438         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5439
5440 2010-11-05  Cary Coutant  <ccoutant@google.com>
5441
5442         PR gold/10708
5443         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5444         object when reading from the file.
5445         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5446         second layout pass.
5447         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5448         when reading section contents.
5449         (get_section_contents): Likewise.
5450         (icf::find_identical_sections): Likewise.
5451         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5452         object when reading from the file.
5453         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5454         the object when doing deferred section layout.
5455
5456 2010-11-03  Nick Clifton  <nickc@redhat.com>
5457
5458         PR gold/12001
5459         * script.h (class Symbol_assignment: name): New member.  Returns
5460         the name of the symbol.
5461         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5462         Returns true if the given symbol name is on the list of
5463         assignments wating to be processed.
5464         * archive.cc (should_incldue_member): If the symbol is undefined,
5465         check to see if it is on the list of symbols pending assignment.
5466
5467 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5468
5469         * script-sections.cc (Script_sections::find_memory_region): Check
5470         for a NULL output section pointer.
5471
5472 2010-10-29  Doug Kwan  <dougkwan@google.com>
5473
5474         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5475         Output_section::add_relaxed_input_section.
5476         * output.cc (Output_section::add_relaxed_input_section): Add new
5477         arguments LAYOUT and NAME.  Set section order index.
5478         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5479         Copy section order index.
5480         * output.h (Output_section::add_relaxed_input_section): Add new
5481         arguments LAYOUT and NAME.
5482
5483 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5484
5485         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5486         NATIVE_OR_CROSS_LINKER.
5487         * testsuite/Makefile.in: Regenerate.
5488
5489 2010-10-20  Doug Kwan  <dougkwan@google.com>
5490
5491         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5492         without SHF_LINK_ORDER flags.
5493         * layout.cc (Layout::choose_output_section): Do not filter
5494         SHF_LINK_ORDER flag in a relocatable link.
5495
5496 2010-10-17  Cary Coutant  <ccoutant@google.com>
5497
5498         * output.h (Output_segment::set_section_addresses): Change function
5499         signature.  Update all callers.
5500         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5501         sections.
5502         (Output_segment::set_section_addresses): Align after last TLS
5503         section.  Add padding before last relro section instead of after.
5504
5505 2010-10-17  Doug Kwan  <dougkwan@google.com>
5506
5507         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5508         GOT output section to be writable.
5509
5510 2010-10-14  Cary Coutant  <ccoutant@google.com>
5511
5512         * debug.h (DEBUG_INCREMENTAL): New flag.
5513         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5514         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5515         mode.
5516         * incremental.cc (report_command_line): Ignore all forms of
5517         --incremental.
5518         * layout.cc (Layout::Layout): Check parameters for incremental link
5519         mode.
5520         * options.cc (General_options::parse_incremental): New function.
5521         (General_options::parse_no_incremental): New function.
5522         (General_options::parse_incremental_full): New function.
5523         (General_options::parse_incremental_update): New function.
5524         (General_options::incremental_mode_): New data member.
5525         (General_options::finalize): Check incremental_mode_.
5526         * options.h (General_options): Update help text for --incremental.
5527         Add --no-incremental, --incremental-full, --incremental-update.
5528         (General_options::Incremental_mode): New enum type.
5529         (General_options::incremental_mode): New function.
5530         (General_options::incremental_mode_): New data member.
5531         * parameters.cc (Parameters::incremental_mode_): New data member.
5532         (Parameters::set_options): Set incremental_mode_.
5533         (Parameters::set_incremental_full): New function.
5534         (Parameters::incremental): New function.
5535         (Parameters::incremental_update): New function.
5536         (set_parameters_incremental_full): New function.
5537         * parameters.h (Parameters::set_incremental_full): New function.
5538         (Parameters::incremental): New function.
5539         (Parameters::incremental_update): New function.
5540         (Parameters::incremental_mode_): New data member.
5541         (set_parameters_incremental_full): New function.
5542         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5543         incremental link mode.
5544         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5545         (Sized_relobj::do_relocate_sections): Likewise.
5546         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5547         option.
5548         * testsuite/Makefile.in: Regenerate.
5549         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5550
5551 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5552
5553         * script-sections.h (class Script_sections): Make
5554         Sections_elements typedef public.
5555         * script-sections.cc (class Sort_output_sections): Add elements_
5556         field.  Add constructor which sets it; change all callers.
5557         (Sort_output_sections::is_before): New function.
5558         (Sort_output_sections::operator()): Call is_before.
5559         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5560         conditional.
5561         * testsuite/script_test_10.sh: New test. Test script section
5562         order.
5563         * testsuite/script_test_10.t: Likewise.
5564         * testsuite/script_test_10.s: Likewise.
5565         * testsuite/Makefile.am: Wrap the cross linker tests and the
5566         common tests into NATIVE_OR_CROSS_LINKER.
5567         (check_SCRIPTS): Add script_test_10.sh.
5568         (check_DATA): Add script_test_10.stdout.
5569         (script_test_10.o, script_test_10): New targets.
5570         (script_test_10.stdout): New target.
5571         * configure, testsuite/Makefile.in: Regenerate.
5572
5573 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5574
5575         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5576         error for the deprecated relocations.
5577         (Target_arm::Scan::global): Likewise.
5578         (Target_arm::Relocate::relocate): Likewise.
5579
5580 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5581
5582         * fileread.cc (Input_file::find_file): Initialize *found_name
5583         and *namep when using the fallback search for case 4.
5584
5585 2010-10-11  Cary Coutant  <ccoutant@google.com>
5586
5587         * options.h (class General_options): Redefine -z lazy as an alias for
5588         the negation of -z now.
5589
5590 2010-10-11  Ian Lance Taylor  <iant@google.com>
5591
5592         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5593         binding.
5594
5595 2010-10-06  Nick Clifton  <nickc@redhat.com>
5596
5597         * script-sections.cc(class Memory_region): Remove
5598         current_lma_offset_ field.  Rename current_vma_offset_ to
5599         current_offset_.  Add last_section_ field.
5600         (Memory_region::get_current_vma_address): Rename to
5601         get_current_address.
5602         (Memory_region::get_current_lma_address): Delete.
5603         (Memory_region::increment_vma_offset): Rename to
5604         increment_offset.
5605         (Memory_region::increment_lma_offset): Delete.
5606         (Memory_region::attributes_compatible): New method.  Returns
5607         true if the provided section is compatible with the region.
5608         (Memory_region::get_last_section): New method.  Returns the last
5609         section to use the region.
5610         (Memory_region::set_last_section): New method.  Stores the last
5611         section to use the region.
5612         (Script_sections::block_in_region): New method.  Returns true if
5613         a block of memory is contained within a region.
5614         (Script_sections::find_memory_region): New method.  Locates a
5615         memory region to be used to set a VMA or LMA address.
5616         (Output_section_definition::set_section_addresses): Add code to
5617         check for addresses set by memory regions.
5618         (Output_segment::set_section_addresses): Remove memory region
5619         walking code.
5620         (Script_sections::create_segment): Add a warning if a header
5621         segment is created outside of any region.
5622         * script-sections.h (class Script_sections): Add prototypes for
5623         find_memory_region and block_in_region methods.
5624         * testsuite/memory_test.s: Use .long instead of .word.
5625         * testsuite/memory_test.t: Add some more output sections.
5626         * testsuite/memory_test.sh: Update expected output.
5627
5628 2010-10-02  Doug Kwan  <dougkwan@google.com>
5629
5630         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5631         defintion to symtab.h
5632         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5633         declaration to defintion.
5634
5635 2010-10-01  Nick Clifton  <nickc@redhat.com>
5636
5637         * expression.cc (eval): Replace dummy argument with NULL.
5638         (eval_maybe_dot): Check for a NULL result section pointer.
5639         (Symbol_expression::value): Likewise.
5640         (Dot_expression::value): Likewise.
5641         (BINARY_EXPRESSION): Likewise.
5642         (Max_expression::value): Likewise.
5643         (Min_expression::value): Likewise.
5644         (Absolute_expression::value): Likewise.
5645         (Addr_expression::value_from_output_section): Likewise.
5646         (Loaddddr_expression::value_from_output_section): Likewise.
5647         (Segment_start_expression::value): Likewise.
5648         * script-sections.cc
5649         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5650         argument with NULL.
5651         (Sections_elememt_dot_assignment::set_section_addresses):
5652         Likewise.
5653         (Output_data_expression::do_write_to_buffer): Likewise.
5654         (Output_section_definition::finalize_symbols): Likewise.
5655         (Output_section_definition::set_section_addresses): Likewise.
5656
5657 2010-09-30  Doug Kwan  <dougkwan@google.com>
5658
5659         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5660
5661 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5662
5663         * target.h (Target::can_icf_inline_merge_sections): New virtual
5664         function.
5665         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5666         virtual function.
5667         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5668         virtual function.
5669         * icf.cc (get_section_contents): Inline merge sections only when
5670         target allows it.
5671
5672 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5673
5674         * configure: Regenerate.
5675
5676 2010-09-17  Ian Lance Taylor  <iant@google.com>
5677
5678         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5679         * testsuite/Makefile.am (memory_test.o): New target.
5680         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5681         memory_test.t.
5682         * testsuite/Makefile.in: Rebuild.
5683
5684 2010-09-17  Doug Kwan  <dougkwan@google.com>
5685
5686         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5687         defintion if relocation uses GOT entries of the symbol.
5688         * testsuite/icf_safe_test.sh: Fix test.
5689         * testsuite/icf_safe_so_test.sh: Fix test.
5690
5691 2010-09-16  Cary Coutant  <ccoutant@google.com>
5692
5693         * script_sections.cc (class Memory_region): Remove "NULL" from
5694         vector initializations.
5695
5696 2010-09-15  Cary Coutant  <ccoutant@google.com>
5697
5698         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5699         Resolve forwarding symbols.
5700
5701 2010-09-15  Doug Kwan  <dougkwan@google.com>
5702
5703         * gold/testsuite/script_test_3.t: Add ARM special sections.
5704         * gold/testsuite/script_test_4.t: Same.
5705         * gold/testsuite/script_test_5.t: Same.
5706         * gold/testsuite/script_test_6.t: Same.
5707         * gold/testsuite/script_test_7.t: Same.
5708         * gold/testsuite/script_test_7.t: Same.
5709         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5710
5711 2010-09-14  Cary Coutant  <ccoutant@google.com>
5712
5713         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5714         (Target_x86_64::Relocate::relocate_tls): Replace check for
5715         saw_tls_block_reloc_ with test for executable section.
5716
5717 2010-09-12  Cary Coutant  <ccoutant@google.com>
5718
5719         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5720         position-independent executables to shared libraries need dynamic
5721         relocations.
5722         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5723         position-independent executables.
5724         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5725         * testsuite/Makefile.in: Regenerate.
5726
5727 2010-09-10  Nick Clifton  <nickc@redhat.com>
5728
5729         PR gold/11997
5730         * testsuite/memory_test.t: Discard any sections that are not
5731         needed.
5732
5733 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5734
5735         PR gold/11996
5736         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5737         "This::" to work around a bug in gcc 4.2.
5738
5739         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5740
5741 2010-09-09  Rafael Espindola  <espindola@google.com>
5742
5743         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5744         sections with different PF_X flags in the same segment.
5745         (Layout::find_first_load_seg): Search all segments to find the first
5746         one.
5747         * options.h (rosegment): New.
5748
5749 2010-09-08  Rafael Espindola  <espindola@google.com>
5750
5751         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5752
5753 2010-09-08  Doug Kwan  <dougkwan@google.com>
5754
5755         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5756         (Arm_relobj::do_relocate_sections): Add new parameter for output
5757         file to match the parent.
5758         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5759         of local symbols instead of input values.  Update code to track
5760         changes in gold::relocate_section.
5761         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5762         (Sized_relobj::compute_final_local_value_internal): New methods.
5763         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5764         body into private version of Sized_relobj::compute_final_local_value.
5765         Call the inline method.
5766         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5767         merged symbol value if there is one.
5768         (Symbol_value::has_output_value): New method defintiion.
5769         (Sized_relobj::Compute_final_local_value_status): New enum type.
5770         (Sized_relobj::compute_final_local_value): New methods.
5771         (Sized_relobj::compute_final_local_value_internal): New methods.
5772         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5773         and arm_cortex_a8.sh.
5774         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5775         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5776         New tests.
5777         * Makefile.in: Regenerate.
5778         * testsuite/arm_bl_out_of_range.s: Update test.
5779         * testsuite/thumb_bl_out_of_range.s: Ditto.
5780         * testsuite/thumb_blx_out_of_range.s: Ditto.
5781         * testsuite/arm_branch_out_of_range.sh: New file.
5782         * testsuite/arm_cortex_a8.sh: Ditto.
5783         * testsuite/arm_cortex_a8_b.s: Ditto.
5784         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5785         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5786         * testsuite/arm_cortex_a8_bl.s: Ditto.
5787         * testsuite/arm_cortex_a8_blx.s: Ditto.
5788         * testsuite/arm_cortex_a8_local.s: Ditto.
5789         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5790         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5791
5792 2010-09-08  Rafael Espindola  <espindola@google.com>
5793
5794         * Makefile.am (memory_test.stdout): Run readelf with -W.
5795         * Makefile.in: Regenerate.
5796         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5797         64 bit output.
5798
5799 2010-09-08  Rafael Espindola  <espindola@google.com>
5800
5801         * script-sections.cc (Script_sections::add_memory_region): Convert
5802         field precision to int.
5803         * script.cc (script_set_section_region, script_set_section_region):
5804         Convert field precision to int.
5805
5806 2010-09-08  Rafael Espindola  <espindola@google.com>
5807
5808         * arm.cc (do_finalize_sections): Create the __exidx_start and
5809         __exdix_end symbols even when the section is missing.
5810
5811 2010-09-08  Nick Clifton  <nickc@redhat.com>
5812
5813         * README: Remove claim that MEMORY is not supported.
5814         * expression.cc (script_exp_function_origin)
5815         (script_exp_function_length): Move from here to ...
5816         * script.cc: ... here.
5817         (script_set_section_region, script_add_memory)
5818         (script_parse_memory_attr, script_include_directive): New
5819         functions.
5820         * script-sections.cc
5821         (class Memory_region): New class.
5822         (class Output_section_definition): Add set_memory_region,
5823         set_section_vma, set_section_lma and get_section_name methods.
5824         (class Script_Sections): Add add_memory_region,
5825         find_memory_region, find_memory_region_origin,
5826         find_memory_region_length and set_memory_region methods.
5827         Have set_section_addresses method walk the list of set memory
5828         regions.
5829         Extend the print methos to display memory regions.
5830         * script-sections.h: Add prototypes for new methods.
5831         Add enum for MEMORY region attributes.
5832         * yyscript.y: Add support for parsing MEMORY regions.
5833         * script-c.h: Add prototypes for new functions.
5834         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5835         * testsuite/Makefile.in: Regenerate.
5836         * testsuite/memory_test.sh: New script.
5837         * testsuite/memory_test.s: New assembler source file.
5838         * testsuite/memory_test.t: New linker script.
5839
5840 2010-08-27  Doug Kwan  <dougkwan@google.com>
5841
5842         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5843         reference override an existing dynamic weak reference.
5844         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5845         * testsuite/Makefile.in: Regenerate.
5846         * testsuite/dyn_weak_ref.sh: New file.
5847         * testsuite/dyn_weak_ref_1.c: Ditto.
5848         * testsuite/dyn_weak_ref_2.c: Ditto.
5849
5850 2010-08-27  Ian Lance Taylor  <iant@google.com>
5851
5852         * incremental.h (class Incremental_input_entry): Add virtual
5853         destructor.
5854
5855 2010-08-27  Ian Lance Taylor  <iant@google.com>
5856
5857         * testsuite/start_lib_test_3.c: Mark t3 as used.
5858
5859 2010-08-27  Nick Clifton  <nickc@redhat.com>
5860
5861         * options.cc (version_script): Fix small typo in previous
5862         whitespace tidyup.
5863
5864 2010-08-25  Nick Clifton  <nickc@redhat.com>
5865
5866         * archive.cc: Formatting fixes: Remove whitespace between
5867         typename and following asterisk.  Remove whitespace between
5868         function name and opening parenthesis.
5869         * archive.h: Likewise.
5870         * arm.cc: Likewise.
5871         * attributes.cc: Likewise.
5872         * attributes.h: Likewise.
5873         * common.cc: Likewise.
5874         * copy-relocs.cc: Likewise.
5875         * dirsearch.h: Likewise.
5876         * dynobj.cc: Likewise.
5877         * ehframe.cc: Likewise.
5878         * ehframe.h: Likewise.
5879         * expression.cc: Likewise.
5880         * fileread.cc: Likewise.
5881         * fileread.h: Likewise.
5882         * gc.h: Likewise.
5883         * gold-threads.cc: Likewise.
5884         * gold.cc: Likewise.
5885         * i386.cc: Likewise.
5886         * icf.h: Likewise.
5887         * incremental-dump.cc: Likewise.
5888         * incremental.cc: Likewise.
5889         * layout.cc: Likewise.
5890         * layout.h: Likewise.
5891         * main.cc: Likewise.
5892         * merge.cc: Likewise.
5893         * merge.h: Likewise.
5894         * object.cc: Likewise.
5895         * object.h: Likewise.
5896         * options.cc: Likewise.
5897         * options.h: Likewise.
5898         * output.cc: Likewise.
5899         * output.h: Likewise.
5900         * plugin.cc: Likewise.
5901         * plugin.h: Likewise.
5902         * powerpc.cc: Likewise.
5903         * reloc.cc: Likewise.
5904         * script-c.h: Likewise.
5905         * script-sections.cc: Likewise.
5906         * script.cc: Likewise.
5907         * stringpool.cc: Likewise.
5908         * symtab.cc: Likewise.
5909         * symtab.h: Likewise.
5910         * target.cc: Likewise.
5911         * timer.cc: Likewise.
5912         * timer.h: Likewise.
5913         * version.cc: Likewise.
5914         * x86_64.cc: Likewise.
5915
5916 2010-08-24  Nick Clifton  <nickc@redhat.com>
5917
5918         PR 11899
5919         * layout.cc (segment_precedes): Sort segments by their physical
5920         addresses, if they have been set.
5921
5922 2010-08-23  Cary Coutant  <ccoutant@google.com>
5923
5924         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5925         symbols data.
5926         (Lib_group::include_member): Unlock object after deleting its
5927         symbols data.
5928         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5929         the bug fixed here.
5930
5931 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5932             Cary Coutant  <ccoutant@google.com>
5933
5934         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5935         constructor, and set_blocker.
5936         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5937         readsyms_blocker_.
5938         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5939         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5940         * testsuite/Makefile.am (start_lib_test): New test case.
5941         * testsuite/Makefile.in: Regenerate.
5942         * testsuite/start_lib_test_main.c: New file.
5943         * testsuite/start_lib_test_1.c: New file.
5944         * testsuite/start_lib_test_2.c: New file.
5945         * testsuite/start_lib_test_3.c: New file.
5946
5947 2010-08-19  Ian Lance Taylor  <iant@google.com>
5948
5949         * Makefile.in: Rebuild with automake 1.11.1.
5950         * aclocal.m4: Likewise.
5951         * testsuite/Makefile.in: Likewise.
5952
5953 2010-08-19  Ian Lance Taylor  <iant@google.com>
5954
5955         PR 10893
5956         * i386.cc (class Output_data_plt_i386): Update declarations.
5957         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5958         local_ifuncs_ fields.
5959         (Target_i386::do_plt_section_for_global): New function.
5960         (Target_i386::do_plt_section_for_local): New function.
5961         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5962         parameter; change all callers.  Initialize global_ifuncs_ and
5963         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5964         __rel_iplt_end.
5965         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5966         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5967         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5968         symbols.
5969         (Target_i386::make_plt_section): New function, broken out of
5970         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5971         (Target_i386::make_plt_entry): Call make_plt_section.
5972         (Target_i386::make_local_ifunc_plt_entry): New function.
5973         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5974         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5975         R_386_IRELATIVE to switch.
5976         (Target_i386::Scan::global): Likewise.
5977         (Target_i386::Relocate::relocate): Likewise.
5978         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5979         switch.
5980         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5981         (Target_x86_64::do_plt_section_for_global): New function.
5982         (Target_x86_64::do_plt_section_for_local): New function.
5983         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5984         parameter; change all callers.  If doing a static link define
5985         __rela_iplt_start and __rela_iplt_end.
5986         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5987         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5988         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5989         to point to .plt.
5990         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5991         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5992         switch.
5993         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5994         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5995         R_X86_64_IRELATIVE to switch.
5996         (Target_x86_64::Scan::global): Likewise.
5997         (Target_x86_64::Relocate::relocate): Likewise.
5998         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5999         switch.
6000         * target.h (class Target): Add plt_section_for_global and
6001         plt_section_for_local functions.  Add do_plt_section_for_global
6002         and do_plt_section_for_local virtual functions.
6003         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6004         clarifying comments.
6005         (Symbol::use_plt_offset): Handle IFUNC symbol.
6006         * object.cc (Sized_relobj::Sized_relobj): Initialize
6007         local_plt_offsets_.
6008         (Sized_relobj::local_has_plt_offset): New function.
6009         (Sized_relobj::local_plt_offset): New function.
6010         (Sized_relobj::set_local_plt_offset): New function.
6011         (Sized_relobj::do_count): Handle IFUNC symbol.
6012         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6013         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6014         is_ifunc_symbol functions.
6015         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6016         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6017         local_plt_offsets_ field.
6018         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6019         * output.h (class Output_section_data): Add non-const
6020         output_section function.
6021         (class Output_data_got): Update declarations.
6022         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6023         Add use_plt_offset parameter to global and local constructors.
6024         Change all callers.  Change local_sym_index_ field to 31 bits.
6025         Change GSYM_CODE and CONSTANT_CODE accordingly.
6026         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6027         doing a static link don't set sh_link field.
6028         (Output_data_got::Got_entry::write): Use PLT offset if
6029         appropriate.
6030         (Output_data_got::add_global_plt): New function.
6031         (Output_data_got::add_local_plt): New function.
6032         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6033         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6034         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6035         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6036         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6037         IFUNC conditional.
6038         * testsuite/ifunc-sel.h: New file.
6039         * testsuite/ifuncmain1.c: New file.
6040         * testsuite/ifuncmain1vis.c: New file.
6041         * testsuite/ifuncmod1.c: New file.
6042         * testsuite/ifuncdep2.c: New file.
6043         * testsuite/ifuncmain2.c: New file.
6044         * testsuite/ifuncmain3.c: New file.
6045         * testsuite/ifuncmod3.c: New file.
6046         * testsuite/ifuncmain4.c: New file.
6047         * testsuite/ifuncmain5.c: New file.
6048         * testsuite/ifuncmod5.c: New file.
6049         * testsuite/ifuncmain6pie.c: New file.
6050         * testsuite/ifuncmod6.c: New file.
6051         * testsuite/ifuncmain7.c: New file.
6052         * configure, testsuite/Makefile.in: Rebuild.
6053
6054 2010-08-18  Ian Lance Taylor  <iant@google.com>
6055
6056         * incremental.cc
6057         (Output_section_incremental_inputs::write_input_files): Add cast
6058         to avoid signed/unsigned comparison warning.
6059         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6060
6061 2010-08-12  Cary Coutant  <ccoutant@google.com>
6062
6063         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6064
6065 2010-08-13  Ian Lance Taylor  <iant@google.com>
6066
6067         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6068
6069 2010-08-12  Cary Coutant  <ccoutant@google.com>
6070             Doug Kwan  <dougkwan@google.com>
6071
6072         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6073         defintion overrides non-weak undef, remember that the original undef
6074         is not weak.
6075         * symtab.cc (Symbol_table::sized_write_global): For undef without
6076         an original weak binding, set binding to global in output.
6077         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6078         * testsuite/Makefile.in: Regenerate.
6079         * testsuite/strong_ref_weak_def.sh: New file.
6080         * testsuite/strong_ref_weak_def_1.c: Ditto.
6081         * testsuite/strong_ref_weak_def_2.c: Ditto.
6082
6083 2010-08-12  Cary Coutant  <ccoutant@google.com>
6084
6085         * testsuite/incremental_test.sh: Rewrite.
6086         * testsuite/incremental_test_1.c: Rewrite.
6087         * testsuite/incremental_test_2.c: Rewrite.
6088
6089 2010-08-12  Cary Coutant  <ccoutant@google.com>
6090
6091         * arm.cc (Target_arm::got_size): Add const.
6092         (Target_arm::got_entry_count): New function.
6093         (Target_arm::plt_entry_count): New function.
6094         (Target_arm::first_plt_entry_offset): New function.
6095         (Target_arm::plt_entry_size): New function.
6096         (Output_data_plt_arm::entry_count): New function.
6097         (Output_data_plt_arm::first_plt_entry_offset): New function.
6098         (Output_data_plt_arm::get_plt_entry_size): New function.
6099         * i386.cc (Target_i386::got_size): Add const.
6100         (Target_i386::got_entry_count): New function.
6101         (Target_i386::plt_entry_count): New function.
6102         (Target_i386::first_plt_entry_offset): New function.
6103         (Target_i386::plt_entry_size): New function.
6104         (Output_data_plt_i386::entry_count): New function.
6105         (Output_data_plt_i386::first_plt_entry_offset): New function.
6106         (Output_data_plt_i386::get_plt_entry_size): New function.
6107         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6108         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6109         * incremental.cc: Include target.h.
6110         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6111         parameter.  Adjust all callers.  Find incremental_got_plt section.
6112         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6113         section.
6114         (Output_section_incremental_inputs::set_final_data_size): Calculate
6115         size of incremental_got_plt section.
6116         (Output_section_incremental_inputs::do_write): Write the
6117         incremental_got_plt section.
6118         (Got_plt_view_info): New struct.
6119         (Local_got_offset_visitor): New class.
6120         (Global_got_offset_visitor): New class.
6121         (Global_symbol_visitor_got_plt): New class.
6122         (Output_section_incremental_inputs::write_got_plt): New function.
6123         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6124         Add parameter.  Adjust all callers.
6125         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6126         (Incremental_inputs::got_plt_section): New function.
6127         (Incremental_inputs::got_plt_section_): New data member.
6128         (Incremental_got_plt_reader): New class.
6129         * layout.cc (Layout::create_incremental_info_sections): Add the
6130         incremental_got_plt section.
6131         * object.h (Got_offset_list::get_list): New function.
6132         (Got offset_list::for_all_got_offsets): New function.
6133         (Sized_relobj::local_got_offset_list): New function.
6134         * powerpc.cc (Target_powerpc::got_size): Add const.
6135         (Target_powerpc::got_entry_count): New function.
6136         (Target_powerpc::plt_entry_count): New function.
6137         (Target_powerpc::first_plt_entry_offset): New function.
6138         (Target_powerpc::plt_entry_size): New function.
6139         (Output_data_plt_powerpc::entry_count): New function.
6140         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6141         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6142         * sparc.cc (Target_sparc::got_size): Add const.
6143         (Target_sparc::got_entry_count): New function.
6144         (Target_sparc::plt_entry_count): New function.
6145         (Target_sparc::first_plt_entry_offset): New function.
6146         (Target_sparc::plt_entry_size): New function.
6147         (Output_data_plt_sparc::entry_count): New function.
6148         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6149         (Output_data_plt_sparc::get_plt_entry_size): New function.
6150         * symtab.h (Symbol::got_offset_list): New function.
6151         (Symbol_table::for_all_symbols): New function.
6152         * target.h (Sized_target::got_entry_count): New function.
6153         (Sized_target::plt_entry_count): New function.
6154         (Sized_target::plt_entry_size): New function.
6155         * x86_64.cc (Target_x86_64::got_size): Add const.
6156         (Target_x86_64::got_entry_count): New function.
6157         (Target_x86_64::plt_entry_count): New function.
6158         (Target_x86_64::first_plt_entry_offset): New function.
6159         (Target_x86_64::plt_entry_size): New function.
6160         (Output_data_plt_x86_64::entry_count): New function.
6161         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6162         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6163
6164 2010-08-12  Cary Coutant  <ccoutant@google.com>
6165
6166         * archive.cc: Include incremental.h.
6167         (Archive::Archive): Initialize incremental_info_.
6168         (Archive::include_member): Record archive members in incremental info.
6169         (Add_archive_symbols::run): Record begin and end of an archive in
6170         incremental info.
6171         (Lib_group::include_member): Record objects in incremental info.
6172         * archive.h (Incremental_archive_entry): Forward declaration.
6173         (Archive::set_incremental_info): New member function.
6174         (Archive::incremental_info): New member function.
6175         (Archive::Unused_symbol_iterator): New class.
6176         (Archive::unused_symbols_begin): New member function.
6177         (Archive::unused_symbols_end): New member function.
6178         (Archive::incremental_info_): New data member.
6179         * incremental-dump.cc (find_input_containing_global): New function.
6180         (dump_incremental_inputs): Dump new incremental info sections.
6181         * incremental.cc: Include symtab.h.
6182         (Output_section_incremental_inputs): New class.
6183         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6184         new incremental info sections.
6185         (Sized_incremental_binary::do_check_inputs): Likewise.
6186         (Incremental_inputs::report_archive): Remove.
6187         (Incremental_inputs::report_archive_begin): New function.
6188         (Incremental_inputs::report_archive_end): New function.
6189         (Incremental_inputs::report_object): New function.
6190         (Incremental_inputs::finalize_inputs): Remove.
6191         (Incremental_inputs::report_input_section): New function.
6192         (Incremental_inputs::report_script): Rewrite.
6193         (Incremental_inputs::finalize): Do nothing but finalize string table.
6194         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6195         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6196         (Incremental_inputs::create_data_sections): New function.
6197         (Incremental_inputs::relocs_entsize): New function.
6198         (Output_section_incremental_inputs::set_final_data_size): New function.
6199         (Output_section_incremental_inputs::do_write): New function.
6200         (Output_section_incremental_inputs::write_header): New function.
6201         (Output_section_incremental_inputs::write_input_files): New function.
6202         (Output_section_incremental_inputs::write_info_blocks): New function.
6203         (Output_section_incremental_inputs::write_symtab): New function.
6204         * incremental.h (Incremental_script_entry): Forward declaration.
6205         (Incremental_object_entry): Forward declaration.
6206         (Incremental_archive_entry): Forward declaration.
6207         (Incremental_inputs): Forward declaration.
6208         (Incremental_inputs_header_data): Remove.
6209         (Incremental_inputs_header): Remove.
6210         (Incremental_inputs_header_write): Remove.
6211         (Incremental_inputs_entry_data): Remove.
6212         (Incremental_inputs_entry): Remove.
6213         (Incremental_inputs_entry_write): Remove.
6214         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6215         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6216         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6217         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6218         Likewise.
6219         (Incremental_input_entry): New class.
6220         (Incremental_script_entry): New class.
6221         (Incremental_object_entry): New class.
6222         (Incremental_archive_entry): New class.
6223         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6224         (Incremental_inputs::report_inputs): Remove.
6225         (Incremental_inputs::report_archive): Remove.
6226         (Incremental_inputs::report_archive_begin): New function.
6227         (Incremental_inputs::report_archive_end): New function.
6228         (Incremental_inputs::report_object): Change prototype.
6229         (Incremental_inputs::report_input_section): New function.
6230         (Incremental_inputs::report_script): Change prototype.
6231         (Incremental_inputs::get_reloc_count): New function.
6232         (Incremental_inputs::set_reloc_count): New function.
6233         (Incremental_inputs::create_data_sections): New function.
6234         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6235         (Incremental_inputs::inputs_section): New function.
6236         (Incremental_inputs::symtab_section): New function.
6237         (Incremental_inputs::relocs_section): New function.
6238         (Incremental_inputs::get_stringpool): Add const.
6239         (Incremental_inputs::command_line): Add const.
6240         (Incremental_inputs::inputs): Remove.
6241         (Incremental_inputs::command_line_key): New function.
6242         (Incremental_inputs::input_file_count): New function.
6243         (Incremental_inputs::input_files): New function.
6244         (Incremental_inputs::relocs_entsize): New function.
6245         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6246         (Incremental_inputs::finalize_inputs): Remove.
6247         (Incremental_inputs::Input_info): Remove.
6248         (Incremental_inputs::lock_): Remove.
6249         (Incremental_inputs::inputs_): Change type.
6250         (Incremental_inputs::inputs_map_): Remove.
6251         (Incremental_inputs::current_object_entry_): New data member.
6252         (Incremental_inputs::inputs_section_): New data member.
6253         (Incremental_inputs::symtab_section_): New data member.
6254         (Incremental_inputs::relocs_section_): New data member.
6255         (Incremental_inputs::reloc_count_): New data member.
6256         (Incremental_inputs_reader): New class.
6257         (Incremental_symtab_reader): New class.
6258         (Incremental_relocs_reader): New class.
6259         * layout.cc (Layout::finalize): Move finalization of incremental info
6260         and creation of incremental info sections to follow finalization of
6261         symbol table.  Set offsets for postprocessing sections.
6262         (Layout::create_incremental_info_sections): Call
6263         Incremental_inputs::create_data_sections.  Add incremental symtab
6264         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6265         sections to layout after input sections.
6266         * layout.h (struct Timespec): Forward declaration.
6267         (Layout::incremental_inputs): Add const.
6268         (Layout::create_incremental_info_sections): Add parameter.
6269         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6270         * object.cc: Include incremental.h.
6271         (Relobj::finalize_incremental_relocs): New function.
6272         (Sized_relobj::do_layout): Record input sections in incremental info.
6273         * object.h (Object::output_section): New function.
6274         (Object::output_section_offset): Moved from Relobj.
6275         (Object::get_incremental_reloc_base): New function.
6276         (Object::get_incremental_reloc_count): New function.
6277         (Object::do_output_section): New function.
6278         (Object::do_output_section_offset): Moved from Relobj.
6279         (Object::do_get_incremental_reloc_base): New function.
6280         (Object::do_get_incremental_reloc_count): New function.
6281         (Object::Object): Initialize new data members.
6282         (Relobj::output_section): Renamed do_output_section and moved to
6283         protected.
6284         (Relobj::output_section_offset): Moved to Object.
6285         (Relobj::do_get_incremental_reloc_base): New function.
6286         (Relobj::do_get_incremental_reloc_count): New function.
6287         (Relobj::allocate_incremental_reloc_counts): New function.
6288         (Relobj::count_incremental_reloc): New function.
6289         (Relobj::finalize_incremental_relocs): New function.
6290         (Relobj::next_incremental_reloc_index): New function.
6291         (Relobj::reloc_counts_): New data member.
6292         (Relobj::reloc_bases_): New data member.
6293         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6294         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6295         (Sized_relobj::incremental_relocs_scan): New function.
6296         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6297         (Sized_relobj::incremental_relocs_write): New function.
6298         (Sized_relobj::incremental_relocs_write_reltype): New function.
6299         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6300         incremental link.
6301         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6302         archives and object files elsewhere.
6303         (Add_symbols::run): Report object files here.
6304         (Finish_group::run): Report end of archive at end of group.
6305         * reloc.cc: Include layout.h, incremental.h.
6306         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6307         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6308         (Sized_relobj::incremental_relocs_scan): New function.
6309         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6310         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6311         (Sized_relobj::incremental_relocs_write): New function.
6312         (Sized_relobj::incremental_relocs_write_reltype): New function.
6313         * script.cc (read_input_script): Rewrite test for incremental link.
6314         Change call to Incremental_inputs::report_script.
6315         * symtab.h (Symbol_table::first_global_index): New function.
6316         (Symbol_table::output_count): New function.
6317
6318 2010-08-12  Doug Kwan  <dougkwan@google.com>
6319
6320         * arm.cc (Target_arm::merge_object_attributes): Check command line
6321         options --no-wchar-size-warning and --no-enum-size-warning.
6322         * options.h (General_options): Add ld-compatible options
6323         --no-enum-size-warning and --no-wchar-size-warning.
6324
6325 2010-08-04  Ian Lance Taylor  <iant@google.com>
6326
6327         * x86_64.cc (Target_x86_64::Scan::local): Use
6328         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6329         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6330         (Target_x86_64::Scan::global): Likewise.
6331         (Target_x86_64::Relocate::relocate): Likewise.
6332         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6333         Likewise.
6334
6335 2010-08-03  Cary Coutant  <ccoutant@google.com>
6336
6337         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6338         to reserve space in merged_strings vector. Keep total input size
6339         for stats.
6340         (Output_merge_string::do_print_merge_stats): Print total input size.
6341         * merge.h (Output_merge_string): Add input_size_ field.
6342         * stringpool.cc (Stringpool_template::string_length): Move
6343         implementations out of Stringpool_template class and place in
6344         stringpool.h.
6345         * stringpool.h (string_length): Move out of Stringpool_template.
6346
6347 2010-08-03  Ian Lance Taylor  <iant@google.com>
6348
6349         PR 11712
6350         * layout.cc (relaxation_loop_body): If address of load segment is
6351         set, adjust address to include headers if possible.
6352
6353 2010-08-03  Ian Lance Taylor  <iant@google.com>
6354
6355         * version.cc (version_string): Bump to 1.10.
6356
6357 2010-08-03  Ian Lance Taylor  <iant@google.com>
6358
6359         PR 11805
6360         * layout.h (enum Output_section_order): Define.
6361         (class Layout): Update declarations.
6362         * layout.cc (Layout::get_output_section): Add order parameter.
6363         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6364         is_first_non_relro parameters.  Change all callers.
6365         (Layout::choose_output_section): Likewise.
6366         (Layout::add_output_section_data): Likewise.
6367         (Layout::make_output_section): Likewise.  Set order.
6368         (Layout::default_section_order): New function.
6369         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6370         * output.cc (Output_section::Output_section): Initialize order_.
6371         Don't initialize deleted fields.
6372         (Output_segment::Output_segment): Don't initialize deleted
6373         fields.
6374         (Output_segment::add_output_section_to_load): New function
6375         replacing add_output_section.  Change all callers to call this or
6376         add_output_section_to_nonload.
6377         (Output_segment::add_output_section_to_nonload): New function.
6378         (Output_segment::remove_output_section): Rewrite.
6379         (Output_segment::add_initial_output_data): Likewise.
6380         (Output_segment::has_any_data_sections): Likewise.
6381         (Output_segment::is_first_section_relro): Likewise.
6382         (Output_segment::maximum_alignment): Likewise.
6383         (Output_segment::has_dynamic_reloc): New function replacing
6384         dynamic_reloc_count.  Change all callers.
6385         (Output_segment::has_dynamic_reloc_list): New function replacing
6386         dynamic_reloc_count_list.  Change all callers.
6387         (Output_segment::set_section_addresses): Rewrite.
6388         (Output_segment::set_offset): Rewrite.
6389         (Output_segment::find_first_and_last_list): Remove.
6390         (Output_segment::set_tls_offsets): Rewrite.
6391         (Output_segment::first_section_load_address): Likewise.
6392         (Output_segment::output_section_count): Likewise.
6393         (Output_segment::section_with_lowest_load_address): Likewise.
6394         (Output_segment::write_section_headers): Likewise.
6395         (Output_segment::print_sections_to_map): Likewise.
6396         * output.h (class Output_data): Remove dynamic_reloc_count_
6397         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6398         (Output_data::add_dynamic_reloc): Rewrite.
6399         (Output_data::has_dynamic_reloc): New function.
6400         (Output_data::dynamic_reloc_count): Remove.
6401         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6402         is_last_relro_, is_first_non_relro_, is_interp_,
6403         is_dynamic_linker_section_ fields.  Add order and set_order
6404         functions.  Remove is_relro_local, set_is_relro_local,
6405         is_last_relro, set_is_last_relro, is_first_non_relro,
6406         set_is_first_non_relro functions, is_interp, set_is_interp,
6407         is_dynamic_linker_section, and set_is_dynamic_linker_section
6408         functions.
6409         (class Output_segment): Change Output_data_list from std::list to
6410         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6411         output_bss_ fields.  Update declarations.
6412
6413 2010-08-02  Ian Lance Taylor  <iant@google.com>
6414
6415         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6416         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6417         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6418
6419 2010-08-02  Ian Lance Taylor  <iant@google.com>
6420
6421         PR 11855
6422         * script.cc (Script_options::Script_options): Initialize
6423         symbol_definitions_ and symbol_references_.
6424         (Script_options::add_symbol_assignment): Update
6425         symbol_definitions_ and symbol_references_.
6426         (Script_options::add_symbol_reference): New function.
6427         (script_symbol): New function.
6428         * script.h (class Script_options): Add symbol_definitions_ and
6429         symbol_references_ fields.
6430         (Script_options::referenced_const_iterator): New type.
6431         (Script_options::referenced_begin): New function.
6432         (Script_options::referenced_end): New function.
6433         (Script_options::is_referenced): New function.
6434         (Script_options::any_unreferenced): New function.
6435         * script-c.h (script_symbol): Declare.
6436         * yyscript.y (exp): Call script_symbol.
6437         * symtab.cc: Include "script.h".
6438         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6439         Change all callers.  Check symbols referenced by scripts.
6440         (Symbol_table::add_undefined_symbols_from_command_line): Add
6441         layout parameter.  Change all callers.
6442         (Symbol_table::do_add_undefined_symbols_from_command_line):
6443         Likewise.  Break out loop body.  Check symbols referenced by
6444         scripts.
6445         (Symbol_table::add_undefined_symbol_from_command_line): New
6446         function broken out of
6447         do_add_undefined_symbols_from_command_line.
6448         * symtab.h (class Symbol_table): Update declarations.
6449         * archive.cc: Include "layout.h".
6450         (Archive::should_include_member): Add layout parameter.  Change
6451         all callers.  Check for symbol mentioned in expression.
6452         * archive.h (class Archive): Update declaration.
6453         * object.cc (Sized_relobj::do_should_include_member): Add layout
6454         parameter.
6455         * object.h (Object::should_include_member): Add layout parameter.
6456         Change all callers.
6457         (Object::do_should_include_member): Add layout parameter.
6458         (class Sized_relobj): Update declaration.
6459         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6460         parameter.
6461         * dynobj.h (class Sized_dynobj): Update declaration.
6462         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6463         layout parameter.
6464         * plugin.h (class Sized_pluginobj): Update declaration.
6465
6466 2010-08-02  Ian Lance Taylor  <iant@google.com>
6467
6468         PR 11866
6469         * output.cc (Output_segment::set_offset): Search for the first and
6470         last sections rather than assuming that the list is in order.
6471         (Output_segment::find_first_and_last_list): New function.
6472         * output.h (class Output_segment): Update declarations.
6473         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6474         (relro_strip_test_SOURCES): New variable.
6475         (relro_strip_test_DEPENDENCIES): New variable.
6476         (relro_strip_test_LDFLAGS): New variable.
6477         (relro_strip_test_LDADD): New variable.
6478         (relro_strip_test.so): New target.
6479
6480 2010-08-02  Ian Lance Taylor  <iant@google.com>
6481
6482         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6483         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6484         (Target_i386::got_tlsdesc_section): New function.
6485         (Target_i386::got_section): Create space for GOT entries for
6486         TLSDESC relocations.
6487         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6488         R_386_TLS_GOTDESC.
6489         (Target_i386::Scan::global): Likewise.
6490         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6491         using TLSDESC GOT.
6492         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6493         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6494         (Target_x86_64::got_tlsdesc_section): New function.
6495         (Target_x86_64::got_section): Create space for GOT entries for
6496         TLSDESC relocations.
6497         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6498         R_386_TLS_GOTDESC.
6499         (Target_x86_64::Scan::global): Likewise.
6500         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6501         using TLSDESC GOT.
6502
6503 2010-08-02  Ian Lance Taylor  <iant@google.com>
6504
6505         * testsuite/final_layout.sh: Use dc to convert from hex to
6506         decimal.
6507
6508 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6509
6510         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6511         paramter to the call to gold::gc_process_relocs.
6512         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6513         paramter to the call to gold::gc_process_relocs.
6514         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6515         parameter to the call to gold::gc_process_relocs.
6516         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6517         template parameter to the call to gold::gc_process_relocs.
6518         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6519         paramter to the call to gold::gc_process_relocs.
6520         * gc.h (get_embedded_addend_size): New function.
6521         (gc_process_relocs): Save the size of the reloc for use by ICF.
6522         * icf.cc (get_section_contents): Get the addend from the text section
6523         for SHT_REL relocation sections.
6524         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6525         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6526         * int_encoding.h (read_from_pointer): New overloaded function.
6527         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6528         * testsuite/icf_sht_rel_addend_test.sh: New file.
6529         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6530         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6531
6532 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6533
6534         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6535         * Makefile.in: Regenerate.
6536         * testsuite/Makefile.in: Regenerate.
6537
6538 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6539
6540         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6541         * gold/testsuite/debug_msg.cc: Likewise.
6542         * gold/testsuite/odr_violation1.cc
6543         * gold/testsuite/odr_violation2.cc
6544
6545 2010-07-21  Cary Coutant  <ccoutant@google.com>
6546
6547         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6548         string, and length fields.
6549         (Output_merge_string::Merged_strings_list): New type.
6550         (Output_merge_string::Merged_strings_lists): New typedef.
6551         (Output_merge_string): Replace merged_strings_ with
6552         merged_strings_lists_.
6553         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6554         Merged_strings_list per input object and section.  Don't store pointer
6555         to the string.  Don't store length with each merged string entry.
6556         (Output_merge_string::finalize_merged_data): Loop over list of merged
6557         strings lists.  Recompute length of each merged string.
6558
6559 2010-07-15  Cary Coutant  <ccoutant@google.com>
6560
6561         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6562         here.
6563
6564 2010-07-14  Ian Lance Taylor  <iant@google.com>
6565
6566         * descriptors.cc (Descriptors::open): Report correct name in error
6567         message.
6568
6569 2010-07-13  Doug Kwan  <dougkwan@google.com>
6570
6571         * arm.cc (Arm_input_section::Arm_input_section): For a
6572         SHT_ARM_EXIDX section, always keeps the input sections.
6573         (Arm_input_section::set_exidx_section_link): New method.
6574         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6575         has_errors_ to false.
6576         (Arm_exidx_input_section::has_errors,
6577         Arm_exidx_input_section::set_has_errors): New methods.
6578         (Arm_exidx_input_section::has_errors_): New data member.
6579         (Arm_relobj::get_exidx_shndx_list): New method.
6580         (Arm_output_section::append_text_sections_to_list): Do not skip
6581         section without SHF_EXECINSTR.
6582         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6583         errors.
6584         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6585         section header.  Make error messages more verbose.  Check for
6586         a non-executable section linked to an EXIDX section.
6587         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6588         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6589         check that there is no deferred EXIDX section if we exit early.
6590         Instead of not making an EXIDX section in case of an error, make one
6591         and set the has_errors flag of it.
6592         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6593         in a relocatable link.
6594         (Target_arm::do_relax): Look for the EXIDX output section instead of
6595         assuming that it is called .ARM.exidx.
6596         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6597         section list.  Do not check for SHF_EXECINSTR section flags but
6598         skip any input section with errors.
6599         * output.cc (Output_section::Output_section): Initialize
6600         always_keeps_input_sections_ to false.
6601         (Output_section::add_input_section): Check for
6602         always_keeps_input_sections_.
6603         *  output.h (Output_section::always_keeps_input_sections,
6604         Output_section::set_always_keeps_input_sections): New methods.
6605         (Output_section::always_keeps_input_sections): New data member.
6606
6607 2010-07-13  Rafael Espindola  <espindola@google.com>
6608
6609         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6610         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6611
6612 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6613             Ian Lance Taylor  <iant@google.com>
6614
6615         * output.h (Output_section_lookup_maps::add_merge_section):
6616         Correct check of whether value was inserted.
6617         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6618         (Output_section_lookup_maps::add_relaxed_input_section):
6619         Likewise.
6620         * arm.cc (Target_arm::got_section): Remove used local os.
6621         * i386.cc (Target_i386::got_section): Likewise.
6622         * x86_64.cc (Target_x86_64::got_section): Likewise.
6623         * sparc.cc (Target_sparc::got_section): Likewise.
6624         (Target_sparc::relocate): Remove unused local have_got_offset.
6625         * powerpc.cc (Target_powerpc::relocate): Likewise.
6626
6627 2010-07-13  Ian Lance Taylor  <iant@google.com>
6628
6629         * compressed_output.cc (zlib_decompress): Fix signature in
6630         !HAVE_ZLIB_H case.
6631
6632         * archive.cc (Archive::include_member): Unlock an external member
6633         of a thin archive.  Don't bother to delete an object we know is
6634         NULL.
6635
6636 2010-07-12  Cary Coutant  <ccoutant@google.com>
6637
6638         * compressed_output.cc (zlib_decompress): New function.
6639         (get_uncompressed_size): New function.
6640         (decompress_input_section): New function.
6641         * compressed_output.h (get_uncompressed_size): New function.
6642         (decompress_input_section): New function.
6643         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6644         Handle compressed debug sections.
6645         * layout.cc (is_compressed_debug_section): New function.
6646         (Layout::output_section_name): Map compressed section names to
6647         canonical names.
6648         * layout.h (is_compressed_debug_section): New function.
6649         (is_debug_info_section): Recognize compressed debug sections.
6650         * merge.cc: Include compressed_output.h.
6651         (Output_merge_data::do_add_input_section): Handle compressed
6652         debug sections.
6653         (Output_merge_string::do_add_input_section): Handle compressed
6654         debug sections.
6655         * object.cc: Include compressed_output.h.
6656         (Sized_relobj::Sized_relobj): Initialize new data members.
6657         (build_compressed_section_map): New function.
6658         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6659         * object.h (Object::section_is_compressed): New method.
6660         (Object::do_section_is_compressed): New method.
6661         (Sized_relobj::Compressed_section_map): New type.
6662         (Sized_relobj::do_section_is_compressed): New method.
6663         (Sized_relobj::compressed_sections_): New data member.
6664         * output.cc (Output_section::add_input_section): Handle compressed
6665         debug sections.
6666         * reloc.cc: Include compressed_output.h.
6667         (Sized_relobj::write_sections): Handle compressed debug sections.
6668
6669 2010-07-08  Cary Coutant  <ccoutant@google.com>
6670
6671         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6672         weak when resolving to a dynamic def.
6673         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6674         for weak undef/dynamic def cases. Adjust callers.
6675         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6676         undef_binding_weak_.
6677         (Symbol_table::sized_write_globals): Adjust symbol binding.
6678         (Symbol_table::sized_write_symbol): Add binding parameter.
6679         * symtab.h (Symbol::set_undef_binding): New method.
6680         (Symbol::is_undef_binding_weak): New method.
6681         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6682         (Symbol_table::should_override): Add new parameter.
6683         (Symbol_table::sized_write_symbol): Add new parameter.
6684
6685         * testsuite/weak_undef_file1.cc: Add new test case.
6686         * testsuite/weak_undef_file2.cc: Fix header comment.
6687         * testsuite/weak_undef_test.cc: Add new test case.
6688
6689 2010-06-29  Doug Kwan  <dougkwan@google.com>
6690
6691         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6692         Initialize USE_SYMBOL_.
6693         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6694         definition.
6695         (Arm_reloc_property::uses_symbol_): New data member declaration.
6696         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6697         uses symbol value and symbol is undefined but not weakly undefined.
6698
6699 2010-06-28  Rafael Espindola  <espindola@google.com>
6700
6701         * plugin.cc (Plugin::load): Use dlerror.
6702
6703 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6704
6705         * symtab.cc (detect_odr_violations): When reporting an ODR
6706         violation, report an object where the symbol is defined.
6707
6708 2010-06-25  Doug Kwan  <dougkwan@google.com>
6709
6710         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6711         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6712         definition.
6713         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6714         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6715         target hook to detect function points.
6716         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6717         * icf.h (Icf::check_section_for_function_pointers): Change type of
6718         parameter SECTION_NAME to const reference to std::string.  Use
6719         target hook to determine if section may have unsafe pointers.
6720         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6721         method definition.
6722
6723 2010-06-21  Rafael Espindola  <espindola@google.com>
6724
6725         * fileread.cc (Input_file::find_fie): New
6726         (Input_file::open): Use Input_file::find_fie.
6727         * fileread.h (Input_file::find_fie): New
6728         * plugin.cc (set_extra_library_path): New.
6729         (Plugin::load): Add set_extra_library_path to the transfer vector.
6730         (Plugin_manager::set_extra_library_path): New.
6731         (Plugin_manager::add_input_file): Use the extra search path if set.
6732         (set_extra_library_path(): New.
6733         * plugin.h (Plugin_manager): Add set_extra_library_path and
6734         extra_search_path_.
6735
6736 2010-06-19  Cary Coutant  <ccoutant@google.com>
6737
6738         * layout.cc (gdb_sections): Add .debug_types.
6739         (lines_only_debug_sections): Likewise.
6740
6741 2010-06-18  Rafael Espindola  <espindola@google.com>
6742
6743         * plugin.cc (add_input_file,add_input_library)
6744         (Plugin_manager::add_input_file): Make filename arguments const.
6745         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6746         const.
6747
6748 2010-06-16  Doug Kwan  <dougkwan@google.com>
6749
6750         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6751         .ARM.attributes section if we have not merged any input
6752         attributes sections.
6753
6754 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6755
6756         * arm.cc: Allow combining objects with no EABI version
6757         information.
6758
6759 2010-06-15  Rafael Espindola  <espindola@google.com>
6760
6761         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6762
6763 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6764
6765         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6766         (struct iovec): Correct !HAVE_READV definition.
6767
6768 2010-06-10  Cary Coutant  <ccoutant@google.com>
6769
6770         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6771         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6772         reloc sections.
6773         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6774
6775         PR 11683
6776         * symtab.h (Symbol::is_placeholder): New member function.
6777         * target-reloc.h (relocate_section): Check for placeholder symbols.
6778
6779         * testsuite/Makefile.am (plugin_test_8): New test.
6780         (plugin_test_9): New test.
6781         * testsuite/Makefile.in: Regenerate.
6782
6783 2010-06-09  Nick Clifton  <nickc@redhat.com>
6784
6785         * yyscript.y (input_list_element): Allow strings prefixed with
6786         the '-' character.  Treat these as libraries.
6787         * script.cc (script_add_library): New function.  Adds a library
6788         specified by "-l<name>" found in an input script.
6789         * script-c.h: Add prototype for script_add_library.
6790
6791 2010-06-07  Doug Kwan  <dougkwan@google.com>
6792
6793         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6794         Restrict stub-group size to be within long conditional branch
6795         range when working around cortex-A8 erratum.
6796
6797 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6798
6799         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6800         #ifdef typo.
6801
6802 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6803
6804         PR gold/11658
6805         * output.cc
6806         (Output_section::Input_section_sort_entry::compare_section_ordering):
6807         Change to return non-zero correctly.
6808         (Output_section::Input_section_sort_section_order_index_compare
6809         ::operator()): Change to fix ambiguity in comparisons.
6810
6811 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6812
6813         * gold.h (is_wildcard_string): New function.
6814         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6815         (Layout::layout_eh_frame): Ditto.
6816         (Layout::find_section_order_index): New method.
6817         (Layout::read_layout_from_file): New method.
6818         * layout.h (Layout::find_section_order_index): New method.
6819         (Layout::read_layout_from_file): New method.
6820         (Layout::input_section_position_): New private member.
6821         (Layout::input_section_glob_): New private member.
6822         * main.cc (main): Call read_layout_from_file here.
6823         * options.h (--section-ordering-file): New option.
6824         * output.cc (Output_section::input_section_order_specified_): New
6825         member.
6826         (Output_section::Output_section): Initialize new member.
6827         (Output_section::add_input_section): Add new parameter.
6828         Keep input sections when --section-ordering-file is used.
6829         (Output_section::set_final_data_size): Sort input sections when
6830         section ordering file is specified.
6831         (Output_section::Input_section_sort_entry): Add new parameter.
6832         Check sorting type.
6833         (Output_section::Input_section_sort_entry::compare_section_ordering):
6834         New method.
6835         (Output_section::Input_section_sort_compare::operator()): Change to
6836         consider section_order_index.
6837         (Output_section::Input_section_sort_init_fini_compare::operator()):
6838         Change to consider section_order_index.
6839         (Output_section::Input_section_sort_section_order_index_compare
6840         ::operator()): New method.
6841         (Output_section::sort_attached_input_sections): Change to sort
6842         according to section order when specified.
6843         (Output_section::add_input_section<32, true>): Add new parameter.
6844         (Output_section::add_input_section<64, true>): Add new parameter.
6845         (Output_section::add_input_section<32, false>): Add new parameter.
6846         (Output_section::add_input_section<64, false>): Add new parameter.
6847         * output.h (Output_section::add_input_section): Add new parameter.
6848         (Output_section::input_section_order_specified): New
6849         method.
6850         (Output_section::set_input_section_order_specified): New method.
6851         (Input_section::Input_section): Initialize section_order_index_.
6852         (Input_section::section_order_index): New method.
6853         (Input_section::set_section_order_index): New method.
6854         (Input_section::section_order_index_): New member.
6855         (Input_section::Input_section_sort_section_order_index_compare): New
6856         struct.
6857         (Output_section::input_section_order_specified_): New member.
6858         * script-sections.cc (is_wildcard_string): Delete and move modified
6859         method to gold.h.
6860         (Output_section_element_input::Output_section_element_input): Modify
6861         call to is_wildcard_string.
6862         (Output_section_element_input::Input_section_pattern
6863         ::Input_section_pattern): Ditto.
6864         (Output_section_element_input::Output_section_element_input): Ditto.
6865         * testsuite/Makefile.am (final_layout): New test case.
6866         * testsuite/Makefile.in: Regenerate.
6867         * testsuite/final_layout.cc: New file.
6868         * testsuite/final_layout.sh: New file.
6869
6870 2010-06-01  Rafael Espindola  <espindola@google.com>
6871
6872         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6873
6874 2010-06-01  Rafael Espindola  <espindola@google.com>
6875
6876         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6877         visibility of symbols.
6878
6879 2010-05-27  Doug Kwan  <dougkwan@google.com>
6880
6881         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6882         from start of output section instead of address for a local symbol
6883         in a merged or relaxed section when doing a relocatable link.
6884
6885 2010-05-26  Rafael Espindola  <espindola@google.com>
6886
6887         PR 11604
6888         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6889         adding sections the garbage collector removed.
6890         * gold/testsuite/Makefile.am: Add test.
6891         * gold/testsuite/Makefile.in: Regenerate.
6892         * gold/testsuite/plugin_test_7.sh: New.
6893         * gold/testsuite/plugin_test_7_1.c: New.
6894         * gold/testsuite/plugin_test_7_2.c: New.
6895
6896 2010-05-26  Rafael Espindola  <espindola@google.com>
6897
6898         * script-sections.cc (Output_section_definition::set_section_addresses):
6899         Check for --section-start.
6900
6901 2010-05-26  Doug Kwan  <dougkwan@google.com>
6902
6903         * arm.cc (Arm_scan_relocatable_relocs): New class.
6904         (Target_arm::relocate_special_relocatable): New method.
6905         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6906         (Arm_relocate_functions::thumb_branch_common): Same.
6907         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6908         instead of Default_scan_relocatable_relocs.
6909         * target-reloc.h (relocate_for_relocatable): Let target handle
6910         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6911         * target.h (Sized_target::relocate_special_relocatable): New method.
6912
6913 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6914
6915         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6916
6917 2010-05-23  Doug Kwan  <dougkwan@google.com>
6918
6919         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6920         instead of a cast.
6921         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6922         with a direct branch, not a conditional branch, to a stub.
6923         * merge.cc (Output_merge_base::record_input_section): New method
6924         defintion.
6925         (Output_merge_data::do_add_input_section): Record input section if
6926         keeps-input-sections flag is set.
6927         (Output_merge_string::do_add_input_section): Ditto.
6928         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6929         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6930         INPUT_SECTIONS_.
6931         (Output_merge_base::keeps_input_sections,
6932         Output_merge_base::set_keeps_input_sections,
6933         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6934         method definitions.
6935         (Output_merge_base::Input_sections): New type declaration.
6936         (Output_merge_base::input_sections_begin,
6937         Output_merge_base::input_sections_end,
6938         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6939         (Output_merge_base::bool keeps_input_sections_,
6940         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6941         Output_merge_base::input_sections_): New data members.
6942         (Output_merge_data::do_set_keeps_input_sections): New method
6943         defintion.
6944         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6945         * output.cc (Output_section::Input_section::relobj): Move method
6946         defintion from class declaration to here and handle merge sections.
6947         (Output_section::Input_section::shndx): Ditto.
6948         (Output_section::Output_section): Remove initializations of removed
6949         data members and initialize new data member LOOKUP_MAPS_.
6950         (Output_section::add_input_section): Set keeps-input-sections flag
6951         for a newly created merge output section as appropriate.  Adjust code
6952         to use Output_section_lookup_maps class.
6953         (Output_section::add_relaxed_input_section): Adjst code for lookup
6954         maps code refactoring.
6955         (Output_section::add_merge_input_section): Add a new parameter
6956         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6957         class.  If adding input section to a newly created merge output
6958         section fails, remove the new merge section.
6959         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6960         Adjust code for use of the Output_section_lookup_maps class.
6961         (Output_section::find_merge_section): Ditto.
6962         (Output_section::build_lookup_maps): New method defintion.
6963         (Output_section::find_relaxed_input_section): Adjust code to use
6964         Output_section_lookup_maps class.
6965         (Output_section::get_input_sections): Export merge sections.  Adjust
6966         code to use Output_section_lookup_maps class.
6967         (Output_section:::add_script_input_section): Adjust code to use
6968         Output_section_lookup_maps class.  Update lookup maps for merge
6969         sections also.
6970         (Output_section::discard_states): Use Output_section_lookup_maps.
6971         (Output_section::restore_states): Same.
6972         * output.h (Merge_section_properties): Move class defintion out of
6973         Output_section.
6974         (Output_section_lookup_maps): New class.
6975         (Output_section::Input_section::is_merge_section): New method
6976         defintion.
6977         (Output_section::Input_section::relobj): Move defintion out of class
6978         defintion.  Declare method only.
6979         (Output_section::Input_section::shndx): Ditto.
6980         (Output_section::Input_section::output_merge_base): New method defintion.
6981         (Output_section::Input_section::u2_.pomb): New union field.
6982         (Output_section::Merge_section_by_properties_map,
6983         Output_section::Output_section_data_by_input_section_map,
6984         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6985         Remove types.
6986         (Output_section::add_merge_input_section): Add new parameter
6987         KEEPS_INPUT_SECTIONS.
6988         (Output_section::build_lookup_maps): New method declaration.
6989         (Output_section::merge_section_map_,
6990         Output_section::merge_section_by_properties_map_,
6991         Output_section::relaxed_input_section_map_,
6992         Output_section::is_relaxed_input_section_map_valid_): Remove data
6993         members.
6994         (Output_section::lookup_maps_): New data member.
6995
6996 2010-05-21  Doug Kwan  <dougkwan@google.com>
6997
6998         PR gold/11619
6999         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7000         avoid a compilation error.
7001
7002 2010-05-19  Rafael Espindola  <espindola@google.com>
7003
7004         * script-sections.cc (Output_section_definition::allocate_to_segment):
7005         Update the phdrs_list even when the output section is NULL.
7006         * testsuite/Makefile.am: Add test.
7007         * testsuite/Makefile.in: Regenerate.
7008         * testsuite/script_test_9.cc: New.
7009         * testsuite/script_test_9.sh: New.
7010         * testsuite/script_test_9.t: New.
7011
7012 2010-05-19  Doug Kwan  <dougkwan@google.com>
7013
7014         * arm.cc (Arm_input_section::original_size): New method.
7015         (Arm_input_section::do_addralign): Add a cast.
7016         (Arm_input_section::do_output_offset): Remove static cast.
7017         (Arm_input_section::original_addralign,
7018          Arm_input_section::original_size_): Change type to uint32_t.
7019         (Arm_input_section::init): Add safe casts for section alignment
7020         and size.
7021         (Arm_input_section::set_final_data_size): Do not set address and
7022         offset of stub table.
7023         (Arm_output_section::fix_exidx_coverage): Change use of of
7024         Output_section::Simple_input_section to that of
7025         Output_section::Input_section.
7026         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7027         except for the first pass.
7028         * output.cc (Output_section::get_input_sections): Change type of
7029         input_sections to std::list<Input_section>.
7030         (Output_section::add_script_input_section): Rename from
7031         Output_section::add_simple_input_section.  Change type of SIS
7032         parameter from Simple_input_section to Input_section.
7033         * output.h (Output_section::Simple_input_section): Remove class.
7034         (Output_section::Input_section): Change class visibility to public.
7035         (Output_section::Input_section::addralign): Use stored alignments
7036         for special input sections if set.
7037         (Output_section::Input_section::set_addralign): New method.
7038         (Output_section::get_input_sections): Change parameter type from
7039         list of Simple_input_section to list of Input_section.
7040         (Output_section::add_script_input_section): Rename from
7041         Output_section::add_simple_input_section. Change first parameter's
7042         type from Simple_input_section to Input_section and remove the
7043         second and third parameters.
7044         * script-sections.cc (Input_section::Input_section_list): Change
7045         type to list of Output_section::Input_section/
7046         (Input_section_info::Input_section_info): Change parameter type of
7047         INPUT_SECTION to Output_section::Input_section.
7048         (Input_section_info::input_section): Change return type.
7049         (Input_section_info::input_section_): Change type to
7050         Output_section::Input_section.
7051         (Output_section_element_input::set_section_addresses): Adjust code
7052         to use Output_section::Input_section instead of
7053         Output_section::Simple_input_section.  Adjust code for renaming
7054         of Output_section::add_simple_input_section.
7055         (Orphan_output_section::set_section_addresses): Ditto.
7056
7057 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7058
7059         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7060         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7061
7062 2010-05-18  Rafael Espindola  <espindola@google.com>
7063
7064         * options.cc (General_options::finalize): Handle -nostdlib.
7065         * options.h (nostdlib): New option.
7066         * script.cc (script_add_search_dir): Handle -nostdlib.
7067
7068 2010-05-12  Doug Kwan  <dougkwan@google.com>
7069
7070         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7071         attributes section only if there no attributes section after merging.
7072         (Target_arm::merge_object_attributes): Move value of
7073         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7074         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7075         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7076         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7077         and arm_attr_merge_7.stdout.
7078         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7079         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7080         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7081         arm_attr_merge_7b.o): New rules.
7082         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7083         arm_attr_merge_7
7084         * testsuite/Makefile.in: Regenerate.
7085         * testsuite/arm_attr_merge.sh: New file.
7086         * testsuite/arm_attr_merge_[67][ab].s: Same.
7087
7088 2010-05-05  Nick Clifton  <nickc@redhat.com>
7089
7090         * po/es.po: Updated Spanish translation.
7091
7092 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7093
7094         * Makefile.am (install-exec-local): Properly install gold as
7095         default cross linker.
7096         * Makefile.in: Regenerated.
7097
7098 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7099             Nick Clifton  <nickc@redhat.com>
7100
7101         * configure.ac (install_as_default): Define and set to false
7102         unless --enable-gold or --enable-gold=both/gold has been
7103         specified.
7104         * configure: Regenerate.
7105
7106         * Makefile.am (install-exec-local): Install the executable as
7107         'ld.gold'.  If install_as_default is true then also install it as
7108         'ld'.
7109         * Makefile.in: Regenerated.
7110
7111 2010-04-24  Ian Lance Taylor  <iant@google.com>
7112
7113         * layout.cc (Layout::layout_reloc): In relocatable link don't
7114         combine reloc sections for grouped sections.
7115
7116 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7117
7118         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7119         sections that are not ordinary to icf.
7120         * icf.cc (get_section_contents): Handle relocation pointing to section
7121         with no object or shndx information.
7122         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7123         * testsuite/Makefile.in: Regenerate.
7124         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7125         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7126
7127 2010-04-22  Ian Lance Taylor  <iant@google.com>
7128
7129         * expression.cc (Expression::Expression_eval_info): Add
7130         result_alignment_pointer field.
7131         (Expression::eval_with_dot): Add result_alignment_pointer
7132         parameter.  Change all callers.
7133         (Expression::eval_maybe_dot): Likewise.
7134         (class Binary_expression): Add alignment_pointer parameter to
7135         left_value and right_value.  Change all callers.
7136         (BINARY_EXPRESSION): Set result alignment.
7137         (class Trinary_expression): Add alignment_pointer parameter to
7138         arg2_value and arg3_value.  Change all callers.
7139         (Trinary_cond::value): Set result alignment.
7140         (Max_expression::value, Min_expression::value): Likewise.
7141         (Align_expression::value): Likewise.
7142         * script-sections.cc (class Sections_element): Add dot_alignment
7143         parameter to set_section_addresses virtual function.  Update
7144         instantiations.
7145         (class Output_section_element): Likewise.
7146         (Script_sections::create_segments): Add dot_alignment parameter.
7147         Change all callers.
7148         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7149         (Script_sections::set_phdrs_clause_addresses): Likewise.
7150         * script-sections.h: Update declarations.
7151         * script.h: Update declarations.
7152         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7153         min_p_align.
7154         * testsuite/script_test_3.t: Set large alignment.
7155         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7156         segment has expected alignment.
7157
7158 2010-04-22  Nick Clifton  <nickc@redhat.com>
7159
7160         * po/gold.pot: Updated by the Translation project.
7161         * po/vi.po: Updated Vietnamese translation.
7162
7163 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7164
7165         * testsuite/Makefile.am (check_PROGRAMS): Add
7166         icf_virtual_function_folding_test.
7167         * testsuite/Makefile.in: Regenerated.
7168
7169 2010-04-15  Andrew Haley  <aph@redhat.com>
7170
7171         * options.h (merge_exidx_entries): New option.
7172         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7173         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7174         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7175         (Target_arm::merge_exidx_entries): New function.
7176         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7177         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7178         to Arm_exidx_fixup constructor.
7179         Add new arg, merge_exidx_entries.
7180         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7181         Arm_output_section::fix_exidx_coverage.
7182
7183 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7184
7185         * icf.cc (get_section_contents): Check for preemptible functions.
7186         Ignore addend when appropriate.
7187         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7188         section folded.
7189         (add_from_relobj): Check for section folded.
7190         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7191         * symtab.h (should_add_dynsym_entry): Add new parameter.
7192         * target-reloc.h (scan_relocs): Check for section folded.
7193         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7194         Check reloc types for function pointers in shared objects.
7195         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7196         case.
7197         (icf_preemptible_functions_test): New test case.
7198         (icf_string_merge_test): New test case.
7199         * testsuite.Makefile.in: Regenerate.
7200         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7201         bar_glob.  Refactor code.
7202         * testsuite/icf_preemptible_functions_test.cc: New file.
7203         * testsuite/icf_preemptible_functions_test.sh: New file.
7204         * testsuite/icf_string_merge_test.cc: New file.
7205         * testsuite/icf_string_merge_test.sh: New file.
7206         * testsuite/icf_virtual_function_folding_test.cc: New file.
7207         * testsuite/icf_virtual_function_folding_test.sh: New file.
7208
7209 2010-04-14  Doug Kwan  <dougkwan@google.com>
7210
7211         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7212         for local symbol recounting if we remove a section due to ICF.
7213         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7214         there are no regular objects in input.
7215
7216 2010-04-13  Doug Kwan  <dougkwan@google.com>
7217
7218         * arm.cc (Arm_input_section::set_final_data_size): Compute
7219         accurate final data size instead of using current data size.
7220
7221 2010-04-09  Doug Kwan  <dougkwan@google.com>
7222
7223         * layout.cc (Layout::choose_output_section): Handle script section
7224         types.
7225         (Layout::make_output_section_for_script): Add section type parameter.
7226         Handle script section types.
7227         * layout.h (Layout::make_output_section_for_script): Add section
7228         type parameter.
7229         * output.cc (Output_section::Output_section): Initialize data member
7230         is_noload_.
7231         (Output_section::do_reset_address_and_file_offset): Do not set address
7232         to 0 if section is a NOLOAD section.
7233         * output.h (Output_section::is_noload): New method.
7234         (Output_section::set_is_noload): Ditto.
7235         (Output_section::is_noload_): New data member.
7236         * script-c.h (Script_section_type): New enum type.
7237         (struct Parser_output_section_header): Add new file section_type.
7238         * script-sections.cc (Sections_element::output_section_name): Add
7239         parameter for returning script section type.
7240         (Output_section_definition::output_section_name): Ditto.
7241         (Output_section_definition::section_type)P; New method.
7242         (Output_section_definiton::script_section_type_name): Ditto.
7243         (Output_section_definition::script_section_type_): New data member.
7244         (Output_section_definition::Output_section_definition): Initialize
7245         data member Output_section_definition::script_section_type_.
7246         (Output_section_definition::create_sections): Pass script section type
7247         to Layout::make_output_section_for_script.
7248         (Output_section_definition::output_section_name): Return script
7249         section type to caller.
7250         (Output_section_definition::set_section_address): Do not advance
7251         dot value and load address if section type is NOLOAD.  Set address
7252         of NOLOAD sections regardless of section flags.
7253         (Output_section_definition::print): Print section type if it is
7254         not SCRIPT_SECTION_TYPE_NONE.
7255         (Output_section_definition::section_type): New method.
7256         (Output_section_definition::script_section_type_name): Ditto.
7257         (Script_sections::output_section_name): Add new parameter
7258         PSECTION_TYPE for returning script section type.  Pass it to
7259         section elements.  Handle discard sections.
7260         (Sort_output_sections::operator()): Handle NOLOAD sections.
7261         * script-sections.h (Script_sections::Section_type): New enum type.
7262         (Script_sections::output_section_name): Add a new parameter for
7263         returning script section type.
7264         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7265         INFO and NOLOAD.
7266         * yyscript.y (union): Add new field SECTION_TYPE.
7267         (COPY, DSECT, INFO, NOLOAD): New tokens.
7268         (opt_address_and_section_type): Change type to output_section_header.
7269         (section_type): New non-terminal
7270         (section_header): Handle section type.
7271         (opt_address_and_section_type): Return section type value.
7272
7273 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7274
7275         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7276         * testsuite/plugin_common_test_2.c (foo): Likewise.
7277
7278 2010-04-08  Doug Kwan  <dougkwan@google.com>
7279
7280         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7281         Output_merge_data.
7282         * output.cc (Output_section::add_merge_input_section): Simplify
7283         code and return status of Output_merge_base::add_input_section.
7284         Update merge section map only if Output_merge_base::add_input_section
7285         returns true.
7286
7287 2010-04-07  Doug Kwan  <dougkwan@google.com>
7288
7289         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7290         if section is marked as containing instructions but has no mapping
7291         symbols.
7292         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7293         correct section index.
7294         (Arm_relobj::find_linked_text_section): Ditto.
7295
7296 2010-04-07  Cary Coutant  <ccoutant@google.com>
7297
7298         * archive.cc (include_member): Destroy Read_symbols_data object before
7299         releasing file.
7300         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7301         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7302         (Read_symbols_data::~Read_symbols_data) New destructor.
7303         (Section_relocs::Section_relocs) New constructor.
7304         (Section_relocs::~Section_relocs) New destructor.
7305         (Read_relocs_data::Read_relocs_data) New constructor.
7306         (Read_relocs_data::~Read_relocs_data) New destructor.
7307         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7308         pointers to NULL after deleting.
7309
7310 2010-04-07  Doug Kwan  <dougkwan@google.com>
7311
7312         * arm.cc: Replace "endianity" with "endianness" in comments.
7313         (Arm_exidx_cantunwind): Ditto.
7314         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7315         (Arm_relobj::merge_flags_and_attributes): New method.
7316         (Arm_relobj::merge_flags_and_attributes_): New data member.
7317         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7318         (Arm_relobj::scan_sections_for_stubs): Ditto.
7319         (Arm_relobj::do_read_symbols): Check to see if we really want to
7320         merge processor-specific flags and attributes.  Exit early if
7321         an object is empty except for section names and the undefined symbol.
7322         (Target_arm::do_finalize_sections): Move check for ELF format to
7323         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7324         attributes from a regular object only when we have determined that
7325         it is aapropriate.  Do not create an .ARM.attributes section in
7326         output if there is no regular input object.
7327         (Target_arm::merge_processor_specific_flags): Check
7328         --warn-mismatch before printing any error.
7329         (Target_arm::merge_object_attributes): Ditto.
7330         * gold.cc (queue_middle_tasks): Handle the case in which there is
7331         no regular object in input.
7332         * options.cc (General_options::parse_EB): New method.
7333         (General_options::parse_EL): Same.
7334         (General_options::General_options): Initialize endianness_.
7335         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7336         New options.
7337         (General_options::Endianness): New enum.
7338         (General_options::endianness): New method.
7339         (General_options::endianness_): New data member.
7340         * parameters.cc (Parameters::set_options): Check target endianness.
7341         (Parameters::set_target_once): Ditto.
7342         (Parameters::check_target_endianness): New method.
7343         (parameters_force_valid_target): If either -EL or -EB is specified,
7344         use it to define endianness of default target.
7345         * parameters.h (Parameters::check_target_endianness): New method
7346         declaration.
7347         * target.h (class Target): Change "endianity" to "endianness"
7348         in comments.
7349
7350 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7351
7352         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7353         * configure: Regenerate.
7354         * Makefile.in: Regenerate.
7355         * testsuite/Makefile.in: Regenerate.
7356
7357 2010-04-06  Cary Coutant  <ccoutant@google.com>
7358
7359         gcc PR lto/42757
7360         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7361         prevailing definitions of common symbols.
7362         * testsuite/plugin_test_6.sh: New test case.
7363         * testsuite/plugin_common_test_1.c: New test case.
7364         * testsuite/plugin_common_test_2.c: New test case.
7365         * testsuite/Makefile.am (plugin_test_6): New test case.
7366         * testsuite/Makefile.in: Regenerate.
7367
7368 2010-04-06  Nick Clifton  <nickc@redhat.com>
7369
7370         * po/vi.po: New Vietnamese translation.
7371
7372 2010-03-30  Doug Kwan  <dougkwan@google.com>
7373
7374         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7375
7376 2010-03-25  Doug Kwan  <dougkwan@google.com>
7377
7378         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7379         to avoid a conversion warning on a 32-bit host.
7380
7381 2010-03-24  Ian Lance Taylor  <iant@google.com>
7382
7383         * testsuite/script_test_3.t: Add a TLS segment.
7384         * testsuite/Makefile.am (check_PROGRAMS): Add
7385         tls_phdrs_script_test.
7386         (tls_phdrs_script_test_SOURCES): Define.
7387         (tls_phdrs_script_test_DEPENDENCIES): Define.
7388         (tls_phdrs_script_test_LDFLAGS): Define.
7389         (tls_phdrs_script_test_LDADD): Define.
7390         * testsuite/Makefile.in: Rebuild.
7391
7392 2010-03-23  Cary Coutant  <ccoutant@google.com>
7393
7394         * fileread.cc (find_or_make_view): Fix comment.
7395
7396 2010-03-23  Ian Lance Taylor  <iant@google.com>
7397
7398         * script-sections.cc (class Orphan_section_placement): Define
7399         PLACE_TLS and PLACE_TLS_BSS.
7400         (Orphan_section_placement::Orphan_section_placement): Initialize
7401         new places.
7402         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7403         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7404         (tls_script_test_SOURCES): Define.
7405         (tls_script_test_DEPENDENCIES): Define.
7406         (tls_script_test_LDFLAGS): Define.
7407         (tls_script_test_LDADD): Define.
7408         * testsuite/Makefile.in: Rebuild.
7409
7410 2010-03-22  Doug Kwan  <dougkwan@google.com>
7411
7412         * arm.cc (Arm_relocate_functions::abs8,
7413         Arm_relocate_functions::abs16): Use correct check for overflow
7414         specified in the ARM ELF specs.
7415         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7416         target of a BLX instruction specially.
7417         (Reloc_stub::stub_type_for_reloc): Ditto.
7418         (Relocate::relocate): Use symbolic names instead of numeric relocation
7419         codes to report error.
7420         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7421         workaround.
7422         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7423         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7424         thumb2_blx_out_of_range.stdout
7425         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7426         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7427         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7428         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7429         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7430         thumb2_blx_in_range, thumb2_blx_in_range.o,
7431         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7432         thumb2_blx_out_of_range.o): New rules.
7433         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7434         thumb2_blx_in_range and thumb2_blx_out_of_range.
7435         * testsuite/Makefile.in: Regenerate.
7436         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7437         * testsuite/thumb_blx_in_range.s: New file.
7438         * testsuite/thumb_blx_out_of_range.s: New file.
7439
7440 2010-03-22  Rafael Espindola  <espindola@google.com>
7441
7442         * archive.cc (Should_include): Move to archive.h.
7443         (should_include_member): Make it a member of Archive.
7444         (Lib_group): New.
7445         (Add_lib_group_symbols): New.
7446         * archive.h: Include options.h.
7447         (Archive_member): Moved from Archive.
7448         (Should_include): Moved from archive.cc.
7449         (Lib_group): New.
7450         (Add_lib_group_symbols): New.
7451         * dynobj.cc (do_should_include_member): New.
7452         * dynobj.h (do_should_include_member): New.
7453         * gold.cc (queue_initial_tasks): Update call to queue.
7454         * main.cc (main): Print lib group stats.
7455         * object.cc (do_should_include_member): New.
7456         * object.h: Include archive.h.
7457         (Object::should_include_member): New.
7458         (Object::do_should_include_member): New.
7459         (Sized_relobj::do_should_include_member): New.
7460         * options.cc (General_options::parse_start_lib): New.
7461         (General_options::parse_end_lib): New.
7462         (Input_arguments::add_file): Handle lib groups.
7463         (Input_arguments::start_group): Check we are not in a lib.
7464         (Input_arguments::start_lib): New.
7465         (Input_arguments::end_lib): New.
7466         * options.h (General_options): Add start_lib and end_lib.
7467         (Input_argument::lib_): New.
7468         (Input_argument::lib): New.
7469         (Input_argument::is_lib): New.
7470         (Input_file_lib): New.
7471         (Input_arguments::in_lib_): New.
7472         (Input_arguments::in_lib): New.
7473         (Input_arguments::start_lib): New.
7474         (Input_arguments::end_lib_): New.
7475         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7476         in unused members as preempted.
7477         (Sized_pluginobj::do_should_include_member): New.
7478         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7479         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7480         return the blocker.
7481         (Read_symbols::do_whole_lib_group): New.
7482         (Read_symbols::do_lib_group): New.
7483         (Read_symbols::do_read_symbols): Handle lib groups.
7484         (Read_symbols::get_name): Handle lib groups.
7485         * readsyms.h (Read_symbols): Add an archive member pointer.
7486         (Read_symbols::do_whole_lib_group): New.
7487         (Read_symbols::do_lib_group): New.
7488         (Read_symbols::member_): New.
7489         * script.cc (read_input_script): Update call to queue_soon.
7490
7491 2010-03-19  Doug Kwan  <dougkwan@google.com>
7492
7493         * arm.cc (Stub_table::Stub_table): Initialize new data members
7494         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7495         (Stub_table::add_reloc_stub): Assign stub offset and update
7496         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7497         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7498         New data members.
7499         (Stub_table::update_data_size_and_addralign): Use
7500         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7501         instead of going over all reloc stubs.
7502         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7503         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7504         Stringpool_template::offset_ to size of Stringpool_char.
7505         (Stringpool_template::new_key_offset): Remove code to initialize
7506         Stringpool_template::offset_.
7507         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7508         Stringpool_template::offset_ to zero.
7509
7510 2010-03-15  Doug Kwan  <dougkwan@google.com>
7511
7512         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7513         offset_.
7514         (Stringpool_template::new_key_offset): New method.
7515         (Stringpool_template::add_string): Assign offsets when adding new
7516         strings.
7517         (Stringpool_template::set_string_offsets): Do not set string offsets
7518         when not optimizing.
7519         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7520         member size_.
7521         (Chunked_vector::clear): Clear size_.
7522         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7523         (Chunked_vector::size): Return size_.
7524         (Chunked_vector::push_back): Use size_ to find insert position.
7525         (Chunked_vector::size_): New data member.
7526         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7527         (Stringpool_template::new_key_offset): New method declaration.
7528         (Stringpool_template::offset_): New data member.
7529
7530 2010-03-15   Rafael Espindola  <espindola@google.com>
7531
7532         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7533         Add_symbols' constructor.
7534         * readsyms.h (Add_symbols): Remove the input_group member.
7535
7536 2010-03-10  Ian Lance Taylor  <iant@google.com>
7537
7538         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7539         target to ask whether a reference to a symbol requires a stack
7540         split.
7541         * target.h (Target::is_call_to_non_split): New function.
7542         (Target::do_is_call_to_non_split): Declare virtual function.
7543         * target.cc: Include "symtab.h".
7544         (Target::do_is_call_to_non_split): New function.
7545         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7546
7547 2010-03-10  Cary Coutant  <ccoutant@google.com>
7548
7549         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7550         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7551         (File_read::open[2]): Add whole_file_view_ to list of views.
7552         (File_read::make_view): Remove test of whole_file_view_.
7553         (File_read::find_or_make_view): Create whole_file_view_ if
7554         necessary.
7555         (File_read::clear_views): Replace bool parameter with enum;
7556         adjust all callers.  Don't delete views with permanent data;
7557         do delete cached views and views from archives if
7558         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7559         if clearing the corresponding view.
7560         * fileread.h (File_read::Clear_views_mode): New enum.
7561         (File_read::View::is_permanent_view): New method.
7562         (File_read::clear_views): Replace bool parameter
7563         with enum; adjust all callers.
7564         * options.h (General_options): Change keep_files_mapped option;
7565         add map_whole_files.
7566         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7567         releasing the file.
7568         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7569         the file.
7570
7571 2010-03-10  David S. Miller  <davem@davemloft.net>
7572
7573         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7574
7575 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7576
7577         * icf.cc (get_section_contents): Add '@' marker after processing the
7578         merge reloc.
7579
7580 2010-03-08  Doug Kwan  <dougkwan@google.com>
7581
7582         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7583         due to a conversion warning.
7584         (Arm_relobj::update_output_local_symbol_count): Check for local
7585         symbol with unset output index.
7586
7587 2010-03-05  Ian Lance Taylor  <iant@google.com>
7588
7589         * options.h (class General_options): Add --spare-dynamic-tags.
7590         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7591         --spare-dynamic-tags.
7592
7593 2010-03-05  Ian Lance Taylor  <iant@google.com>
7594
7595         * incremental.cc: Include "libiberty.h".
7596
7597 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7598
7599         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7600         function, is_info_ member.
7601         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7602         (Versions::Versions): Update caller.
7603         (Versions::define_base_version): Likewise.
7604         (Versions::add_def): Likewise.
7605
7606 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7607
7608         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7609         (Scan::possible_function_pointer_reloc): New function.
7610         (Scan::local_reloc_may_be_function_pointer): Change to call
7611         possible_function_pointer_reloc.
7612         (Scan::global_reloc_may_be_function_pointer): Ditto.
7613         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7614         relocations in ".data.rel.ro._ZTV" section.
7615         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7616         * testsuite/icf_safe_so_test.cc: Ditto.
7617         * testsuite/icf_safe_test.cc: Ditto.
7618         * testsuite/icf_safe_test.sh: Ditto.
7619
7620 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7621             Ian Lance Taylor  <iant@google.com>
7622
7623         * target-reloc.h (relocate_section): Check the symbol table index
7624         for -1U before setting the local symbol index.
7625         (scan_relocatable_relocs): If copying the relocation, record that
7626         the local symbol is required.
7627         * object.h (Symbol_value::is_output_symtab_index_set): New
7628         function.
7629         (Symbol_value::may_be_discarded_from_output_symtab): New
7630         function.
7631         (Symbol_value::has_output_symtab_entry): New function.
7632         (Symbol_value::needs_output_symtab_entry): Remove.
7633         (Symbol_value::output_symtab_index): Make sure the symbol index is
7634         set.
7635         (Symbol_value::set_output_symtab_index): Make sure the symbol
7636         index is not set.  Make sure the new index is valid.
7637         (Symbol_value::set_must_have_output_symtab_entry): New function.
7638         (Symbol_value::has_output_dynsym_entry): New function.
7639         (Symbol_value::set_output_dynsym_index): Make sure the new index
7640         is valid.
7641         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7642         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7643         local symbol if permitted.
7644         (Sized_relobj::do_finalize_local_symbols): Call
7645         is_output_symtab_index_set rather than needs_output_symtab_entry.
7646         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7647         rather than needs_output_symtab_entry.  Call
7648         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7649         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7650         is_output_symtab_index_set rather than needs_output_symtab_entry.
7651         * testsuite/discard_locals_relocatable_test.c: New file.
7652         * testsuite/discard_locals_test.sh: Test -r.
7653         * testsuite/Makefile.am (check_DATA): Add
7654         discard_locals_relocatable_test1.syms,
7655         discard_local_relocatable_test2.syms.
7656         (MOSTLYCLEANFILES): Likewise.  Also add
7657         discard_locals_relocatable_test1.lout and
7658         discard_locals_relocatable_test2.out.
7659         (discard_locals_relocatable_test1.syms): New target.
7660         (discard_locals_relocatable_test.o): New target.
7661         (discard_locals_relocatable_test1.out): New target.
7662         (discard_locals_relocatable_test2.syms): New target.
7663         (discard_locals_relocatable_test2.out): New target.
7664         (various): Add missing ../ld-new dependencies.
7665         * testsuite/Makefile.in: Rebuild.
7666
7667 2010-03-03  Nick Clifton  <nickc@redhat.com>
7668
7669         * po/fi.po: New Finnish translation.
7670
7671 2010-03-01  Doug Kwan  <dougkwan@google.com>
7672
7673         * layout.cc (Layout::Layout): Force section types of .init_array*,
7674         .preinit_array* and .fini_array* sections.
7675         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7676         Fix check of return value of std::string::find.().
7677         (Output_section::Input_section_sort_compare::operator()): Remove
7678         comment about .init_array.
7679         (Output_section::Input_section_sort_init_fini_compare::operator()):
7680         New method.
7681         (Output_section::sort_attached_input_sections): Handle .init_array
7682         and .fini_array specially.
7683         * output.h (Output_section::Inut_section_sort_compare): Update
7684         comment.
7685         (Output_section::Input_section_sort_init_fini_compare): New struct.
7686
7687 2010-02-26  Doug Kwan  <dougkwan@google.com>
7688
7689         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7690         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7691         * testsuite/debug_msg.sh: Avoid matching source line number for
7692         use of global variable undef_int.
7693
7694 2010-02-26  Doug Kwan  <dougkwan@google.com>
7695
7696         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7697         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7698         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7699         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7700         * options.cc (General_options::General_options): Initialize member
7701         fix_v4bx_.
7702         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7703         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7704         and rm_no_fix_v4bx.stdout
7705         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7706         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7707         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7708         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7709         and arm_no_fix_v4bx.
7710         * Makefile.in: Regenerate.
7711         * testsuite/arm_fix_v4bx.s: New file.
7712         * testsuite/arm_fix_v4bx.sh: Ditto.
7713
7714 2010-02-24  Doug Kwan  <dougkwan@google.com>
7715
7716         * arm.cc (Target_arm::got_section): Make the .got section the first
7717         non RELRO section in the data segment.
7718         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7719         suffixes of section names.
7720
7721 2010-02-24  Doug Kwan  <dougkwan@google.com>
7722
7723         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7724         flags and attributes merging if an input file is a binary file.
7725         * fileread.cc (Input_file::open): Record format of original file.
7726         * fileread.h (Input_file::Format): New enum type.
7727         (Input_file::Input_file): Initialize data member format_.
7728         (Input_file::format): New method definition.
7729         (Input_file::format_):: New data member.
7730
7731 2010-02-24  Doug Kwan  <dougkwan@google.com>
7732
7733         * arm.cc (Arm_output_data_got): New class.
7734         (ARM_TCB_SIZE): New constant
7735         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7736         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7737         If user uses a script with a SECTIONS clause, issue only a warning
7738         for a misplaced EXIDX input section.  Otherwise, issue an error.
7739         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7740         garbage collection.
7741         (Target_arm::got_mode_index_entry): Handle static linking.
7742         (Target_arm::Scan::local): Ditto.
7743         (Target_arm::Scan::global): Ditto.
7744         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7745         all incorrectly implemented relocations.
7746         (Target_arm::fix_exidx_coverage): Pass layout to
7747         Arm_output_section::fix_exidx_coverage.
7748         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7749         from ".ARM.exidx." and ".ARM.extab.".
7750
7751 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7752
7753         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7754         section if it does not already exist.
7755         * attributes.cc (Attributes_section_data::Attributes_section_data):
7756         Don't crash if size is zero.
7757
7758 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7759             Ian Lance Taylor  <iant@google.com>
7760
7761         * gold.cc (queue_middle_tasks): If no input files were opened,
7762         exit.
7763         * workqueue.h (Task_function::Task_function): Assert that there is
7764         a blocker.
7765
7766 2010-02-22  Doug Kwan  <dougkwan@google.com>
7767
7768         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7769         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7770         types to avoid warnings due to different uint64_t implementations
7771         on different hosts.
7772
7773 2010-02-21  Doug Kwan  <dougkwan@google.com>
7774
7775         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7776         handling of the maximum backward branch offset.
7777         (Arm_relocate_functions::thumb_branch_common): Ditto.
7778         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7779         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7780         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7781         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7782         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7783         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7784         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7785         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7786         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7787         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7788         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7789         thumb2_bl_out_of_range.o): New rules.
7790         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7791         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7792         thumb2_bl_out_of_range
7793         * testsuite/Makefile.in: Regenerate.
7794         * testsuite/arm_bl_in_range.s: New file.
7795         * testsuite/arm_bl_out_of_range.s: Ditto.
7796         * testsuite/arm_branch_in_range.sh: Ditto.
7797         * testsuite/arm_branch_range.t: Ditto.
7798         * testsuite/thumb2_branch_range.t: Ditto.
7799         * testsuite/thumb_bl_in_range.s: Ditto.
7800         * testsuite/thumb_bl_out_of_range.s: Ditto.
7801         * testsuite/thumb_branch_range.t: Ditto.
7802
7803 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7804
7805         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7806         Add reloc offset information.
7807         * icf.cc (get_section_contents): Change iterators to point to the new
7808         vectors. Add reloc offset information to the contents.
7809         * icf.h (Icf::Sections_reachable_info): New typedef.
7810         (Icf::Sections_reachable_list): New typedef.
7811         (Icf::Offset_info): New typedef.
7812         (Icf::Reloc_info): New struct typedef.
7813         (Icf::Reloc_info_list): New typedef.
7814         (Icf::symbol_reloc_list): Delete method.
7815         (Icf::addend_reloc_list): Delete method.
7816         (Icf::section_reloc_list): Delete method.
7817         (Icf::reloc_info_list): New method.
7818         (Icf::reloc_info_list_): New member.
7819
7820 2010-02-19  Doug Kwan  <dougkwan@google.com>
7821
7822         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7823         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7824         * arm.cc (Arm_relocation_functions): New forward declaration.
7825         (Target_arm::Target_arm): Initialize new data members
7826         got_mod_index_offset_ and tls_base_symbol_defined_.
7827         (Target_arm::Relocate::relocate_tls): New method.
7828         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7829          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7830         New methods.
7831         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7832         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7833         (Target_arm::got_mod_index_offset_,
7834         Target_arm::tls_base_symbol_defined_): New data members.
7835         (Target_arm::Scan::local, Target::Scan::global,
7836         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7837         relocations.
7838
7839 2010-02-18  Doug Kwan  <dougkwan@google.com>
7840
7841         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7842         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7843         text section as a parameter becuase some broken tools may not set
7844         the link in section header.
7845         (Target_arm::has_got_section): New method.
7846         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7847         without any mapping symbol as data only.  Remove warning.
7848         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7849         link in its section header, try to discover the link by inspecting the
7850         REL31 relocation at the beginning of the section.
7851         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7852         in error message.
7853         (Target_arm::Scan::global): Treat any reference to the symbol
7854         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7855
7856 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7857
7858         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7859         (Scan::global_reloc_may_be_function_pointer): New function.
7860         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7861         (Scan::global_reloc_may_be_function_pointer): New function.
7862         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7863         (Scan::global_reloc_may_be_function_pointer): New function.
7864         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7865         (Scan::global_reloc_may_be_function_pointer): New function.
7866         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7867         (Scan::global_reloc_may_be_function_pointer): New function.
7868         (Scan::possible_function_pointer_reloc): New function.
7869         (Target_x86_64::can_check_for_function_pointers): New function.
7870         * gc.h (gc_process_relocs): Scan relocation types to determine if
7871         function pointers were taken for targets that support it.
7872         * icf.cc (Icf::find_identical_sections): Include functions for
7873         folding in safe ICF whose pointer is not taken.
7874         * icf.h (Secn_fptr_taken_set): New typedef.
7875         (fptr_section_id_): New member.
7876         (section_has_function_pointers): New function.
7877         (set_section_has_function_pointers): New function.
7878         (check_section_for_function_pointers): New function.
7879         * options.h: Fix comment for safe ICF option.
7880         * target.h (can_check_for_function_pointers): New function.
7881         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7882         Modify icf_safe_test for X86-64.
7883         * testsuite/Makefile.in: Regenerate.
7884         * testsuite/icf_safe_so_test.cc: New file.
7885         * testsuite/icf_safe_so_test.sh: New file.
7886         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7887         (main): Change to take pointer to function kept_func_3.
7888         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7889         folding is done correctly for X86-64.
7890
7891 2010-02-12  David S. Miller  <davem@davemloft.net>
7892
7893         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7894         is_symbolless parameter.
7895         (Output_reloc<SHT_REL>::is_symbolless): New.
7896         (Output_reloc<SHT_REL>::is_symbolless_): New.
7897         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7898         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7899         (Output_reloc<SHT_RELA>::is_symbolless): New.
7900         (Output_data_reloc::add_global): Handle is_symbolless.
7901         (Output_data_reloc::add_global_relative): Likewise.
7902         (Output_data_reloc::add_local): Likewise.
7903         (Output_data_reloc::add_local_relative): Likewise.
7904         (Output_data_reloc::add_symbolless_global_addend): New.
7905         (Output_data_reloc::add_symbolless_local_addend): New.
7906         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7907         is_symbolless.
7908         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7909         instead of ->is_relative_
7910         (Output_reloc::write): Likewise.
7911         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7912         (Output_reloc::write_rel): Simplify.
7913
7914         * sparc.cc (Target_sparc::Scan::local): Use
7915         ->add_symbolless_local_addend as needed.
7916         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7917         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7918         based upon relocation offset.
7919
7920 2010-02-11  Doug Kwan  <dougkwan@google.com>
7921
7922         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7923         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7924         beginning of function.
7925         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7926         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7927         parameter is_32bit in calls to should_apply_static_reloc.
7928         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7929         (check_DATA): Add arm_abs_global.stdout.
7930         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7931         arm_abs_global.stdout): New rules.
7932         (MOSTLLYCLEANFILES): Add arm_abs_global
7933         * Makefile.in: Regenerate.
7934         * testsuite/arm_abs_global.s: New file.
7935         * testsuite/arm_abs_global.sh: Ditto.
7936         * testsuite/arm_abs_lib.s: Ditto.
7937
7938 2010-02-11  Ian Lance Taylor  <iant@google.com>
7939
7940         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7941         Read_relocs task.
7942         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7943         Allocate_commons_task first.
7944         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7945         task, rather than symtab_lock_.
7946         (Gc_process_relocs::~Gc_process_relocs): New function.
7947         (Gc_process_relocs::is_runnable): Check this_blocker_.
7948         (Gc_process_relocs::locks): Use next_blocker_ rather than
7949         blocker_.
7950         (Scan_relocs::~Scan_relocs): New function.
7951         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7952         symtab_lock_.
7953         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7954         next_blocker_.
7955         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7956         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7957         constructor accordingly.
7958         (class Gc_process_relocs): Likewise.
7959         (class Scan_relocs): Likewise.
7960         * common.h (class Allocate_commons_task): Remove symtab_lock_
7961         field, and corresponding constructor parameter.
7962         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7963         symtab_lock_.
7964         (Allocate_commons_task::locks): Likewise.
7965
7966 2010-02-11  Ian Lance Taylor  <iant@google.com>
7967
7968         * gold-threads.h (class Once): Define.
7969         (class Initialize_lock): Rewrite as child of Once.
7970         * gold-threads.cc (class Once_initialize): Define.
7971         (once_pointer_control): New static variable.
7972         (once_pointer, once_arg): New static variables.
7973         (c_run_once): New static function.
7974         (Once::Once, Once::run_once, Once::internal_run): New functions.
7975         (class Initialize_lock_once): Remove.
7976         (initialize_lock_control): Remove.
7977         (initialize_lock_pointer): Remove.
7978         (initialize_lock_once): Remove.
7979         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7980         (Initialize_lock::initialize): Rewrite.
7981         (Initialize_lock::do_run_once): New function.
7982         * archive.cc (Archive::interpret_header): Only clear name if it is
7983         not already empty.
7984         * fileread.cc: Include "gold-threads.h"
7985         (file_counts_lock): New static variable.
7986         (file_counts_initialize_lock): Likewise.
7987         (File_read::release): Only increment counts when using --stats.
7988         Use a lock around the increment.
7989         * parameters.cc (class Set_parameters_target_once): Define.
7990         (set_parameters_target_once): New static variable.
7991         (Parameters::Parameters): Move here from parameters.h.
7992         (Parameters::set_target): Rewrite.
7993         (Parameters::set_target_once): New function.
7994         (Parameters::clear_target): Move here and rewrite.
7995         * parameters.h (class Parameters): Update declarations.  Add
7996         set_parameters_target_once_ field.
7997         (Parameters::Parameters): Move to parameters.cc.
7998         (Parameters::clear_target): Likewise.
7999         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8000         task.
8001         (Start_group::~Start_group): New function.
8002         (Start_group::is_runnable): New function.
8003         (Start_group::locks, Start_group::run): New functions.
8004         (Finish_group::run): Change saw_undefined to size_t.
8005         * readsyms.h (class Start_group): Define.
8006         (class Finish_group): Change saw_undefined_ field to size_t.
8007         (Finish_group::Finish_group): Remove saw_undefined and
8008         this_blocker parameters.  Change all callers.
8009         (Finish_group::set_saw_undefined): New function.
8010         (Finish_group::set_blocker): New function.
8011         * symtab.h (class Symbol_table): Change saw_undefined to return
8012         size_t.  Change saw_undefined_ field to size_t.
8013         * target-select.cc (Set_target_once::do_run_once): New function.
8014         (Target_selector::Target_selector): Initialize set_target_once_
8015         field.  Don't initialize lock_ and initialize_lock_ fields.
8016         (Target_selector::instantiate_target): Rewrite.
8017         (Target_selector::set_target): New function.
8018         * target-select.h (class Set_target_once): Define.
8019         (class Target_selector): Update declarations.  Make
8020         Set_target_once a friend.  Remove lock_ and initialize_lock_
8021         fields.  Add set_target_once_ field.
8022
8023 2010-02-10  Ian Lance Taylor  <iant@google.com>
8024
8025         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8026         queueing any tasks.
8027         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8028         (queue_middle_tasks): Add all blockers before queueing any tasks.
8029         (queue_final_tasks): Likewise.
8030         * token.h (Task_token::add_blockers): New function.
8031         * object.h (Input_objects::number_of_relobjs): New function.
8032
8033 2010-02-10  Ian Lance Taylor  <iant@google.com>
8034
8035         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8036         shared, not if not position independent.
8037         * x86_64.cc (Relocate::relocate_tls): Likewise.
8038         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8039         (tls_pie_pic_test): New target.
8040         * testsuite/Makefile.in: Rebuild.
8041
8042         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8043         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8044         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8045         * testsuite/Makefile.in: Rebuild.
8046
8047 2010-02-09  David S. Miller  <davem@davemloft.net>
8048
8049         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8050         R_SPARC_RELATIVE using ->add_local_relative().
8051         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8052
8053         * output.h (Output_data_dynamic::add_section_size): New method
8054         that takes two Output_data objects.
8055         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8056         entry param.  Handle it in initializers.
8057         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8058         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8059         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8060         arg.
8061         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8062         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8063         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8064         for dynrel_includes_plt.
8065         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8066         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8067         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8068         before .rela.plt
8069         (Target_sparc::do_finalize_sections): Update to pass true for
8070         dynrel_includes_plt.
8071         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8072         output before .rela.plt
8073         (Target_powerpc::do_finalize_sections): Update to pass true for
8074         dynrel_includes_plt when 32-bit.
8075
8076 2010-02-08  Doug Kwan  <dougkwan@google.com>
8077
8078         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8079         method.
8080         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8081         Arm_relobj::scan_section_for_cortex_a8_stubs,
8082         Arm_relobj::do_relocation_section): Instead of calling
8083         Output_section::output_address, use faster
8084         Arm_relobj::simple_input_section_output_address.
8085
8086 2010-02-08  David S. Miller  <davem@davemloft.net>
8087
8088         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8089         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8090         relocation helper function.
8091
8092         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8093         just like R_SPARC_GOT{10,13,22}.
8094         (Target_sparc::Scan::local): Likewise.
8095         (Target_sparc::Relocate:relocate): Likewise.
8096
8097 2010-02-06  Ian Lance Taylor  <iant@google.com>
8098
8099         * configure.ac: Rewrite targetobjs duplicate removal code to use
8100         only shell constructs.
8101         * configure: Rebuild.
8102
8103 2010-02-05  Doug Kwan  <dougkwan@google.com>
8104
8105         PR 11247
8106         * arm.cc (Arm_relobj::section_is_scannable): New method.
8107         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8108         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8109
8110 2010-02-04  Doug Kwan  <dougkwan@google.com>
8111
8112         PR 11247
8113         * arm-reloc-property.cc (cstdio): Include.
8114         * configure.ac (targetobjs): Remove duplicates.
8115         * configure: Regenerate.
8116         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8117         big and little endian version for a given address size.
8118
8119 2010-02-03  Doug Kwan  <dougkwan@google.com>
8120
8121         * arm-reloc-property.cc
8122         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8123         definition.
8124         * arm-reloc-property.h
8125         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8126         New method definition.
8127         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8128         declaration.
8129         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8130         overflow to N.
8131         (GOT_PREL): Change implemented to Y.
8132         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8133         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8134         (Arm_relocate_functions::movw_abs_nc): Remove method.
8135         (Arm_relocate_functions::movt_abs): Ditto.
8136         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8137         (Arm_relocate_functions::thm_movt_abs): Ditto.
8138         (Arm_relocate_functions::movw_rel_nc): Ditto.
8139         (Arm_relocate_functions::movw_rel): Ditto.
8140         (Arm_relocate_functions::movt_rel): Ditto.
8141         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8142         (Arm_relocate_functions:thm_movw_rel): Ditto.
8143         (Arm_relocate_functions:thm_movt_rel): Ditto.
8144         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8145         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8146         New method definitions.
8147         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8148         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8149         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8150         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8151         (Target_arm::Relocate::relocate): Check for non-static or
8152         unimplemented relocation code and exit early.  Change calls to
8153         Target_arm::reloc_uses_thumb_bit and
8154         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8155         instead.  Refactor code to handle similar relocations to increase
8156         code sharing.  Remove check for unsupported relocation code in switch
8157         statement.
8158         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8159         relocation property table to find out size.  Change error message to
8160         print out the name of a relocation code instead of the numeric value.
8161         (Target_arm::scan_reloc_for_stub): Use relocation property table
8162         instead of calling Target_arm::reloc_uses_thumb_bit().
8163
8164 2010-02-02  Doug Kwan  <dougkwan@google.com>
8165
8166         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8167         types of relaxed input section.
8168
8169 2010-02-02  Doug Kwan  <dougkwan@google.com>
8170
8171         * Makefile.am (HFILES): Add arm-reloc-property.h.
8172         (DEFFILES): New.
8173         (TARGETSOURCES): Add arm-reloc-property.cc
8174         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8175         (libgold_a_SOURCES): $(DEFFILES)
8176         * Makefile.in: Regenerate.
8177         * arm-reloc-property.cc: New file.
8178         * arm-reloc-property.h: New file.
8179         * arm-reloc.def: New file.
8180         * arm.cc: Update comments.
8181         (arm-reloc-property.h): New included header.
8182         (arm_reloc_property_table): New global variable.
8183         (Target_arm::do_select_as_default_target): New method definition.
8184         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8185         arm-reloc-property to targ_extra_obj.
8186         * parameters.cc (set_parameters_target): Call
8187         Target::select_as_default_target().
8188         * target.h (Target::select_as_default_target): New method definition.
8189         (Target::do_select_as_default_target): Same.
8190
8191 2010-02-01  Doug Kwan  <dougkwan@google.com>
8192
8193         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8194         first_output_text_section_.
8195         (Arm_exidx_fixup::first_output_text_section): New method definition.
8196         (Arm_exidx_fixup::first_output_text_section_): New data member.
8197         (Arm_exidx_fixup::process_exidx_section): Record the first text
8198         output section seen.
8199         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8200         and entsize in output section header.
8201
8202 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8203
8204         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8205         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8206         (Arm_relocate_functions::thm_alu11): New Method.
8207         (Arm_relocate_functions::thm_pc8): New Method.
8208         (Arm_relocate_functions::thm_pc12): New Method.
8209         (Target_arm::Scan::local): Handle the relocations.
8210         (Target_arm::Scan::global): Likewise.
8211         (Target_arm::Relocate::relocate): Likewise.
8212         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8213
8214 2010-01-29  Doug Kwan  <dougkwan@google.com>
8215
8216         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8217         of relocation types as ld.
8218
8219 2010-01-29  Doug Kwan  <dougkwan@google.com>
8220
8221         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8222         to public.
8223         (Arm_relocate_functions::thumb_branch_common): Ditto.
8224         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8225         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8226         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8227         Arm_relocate_functions::jump24): Remove.
8228         (Target_arm::Relocate::relocate): Adjust code to call
8229         Arm_relocation_functions::arm_branch_common and
8230         Arm_relocation_functions::thumb_branch_common instead of their removed
8231         wrappers.  Merge switch-cases together to reduce source code size.
8232
8233 2010-01-29  Doug Kwan  <dougkwan@google.com>
8234
8235         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8236         output_local_symbol_count_needs_update_.
8237         (Arm_relobj::output_local_symbol_count_needs_update,
8238          Arm_relobj::set_output_local_symbol_count_needs_update,
8239          Arm_relobj::update_output_local_symbol_count): New methods.
8240         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8241         member.
8242         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8243         of pointed function as in a R_ARM_PREL31 relocation.
8244         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8245         for output local symbol count updating.
8246         (Target_arm::do_relax): Update output local symbol counts in objects
8247         if necessary.
8248         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8249
8250 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8251
8252         * arm.cc: Added support for the ARM relocations:
8253         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8254         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8255         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8256         movw_prel_nc).
8257         (Arm_relocate_functions::movw_rel): New method.
8258         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8259         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8260         thm_movw_prel_nc).
8261         (Arm_relocate_functions::thm_movw_rel): New method.
8262         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8263         thm_movt_prel).
8264         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8265         relocations.
8266         (Target_arm::Scan::global): Likewise.
8267         (Target_arm::Relocate::relocate): Likewise.
8268         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8269         Likewise.
8270
8271 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8272
8273         * arm.cc: Added support for ARM group relocations.
8274         (Target_arm::reloc_needs_sym_origin): New method.
8275         (Arm_relocate_functions::calc_grp_kn): New method.
8276         (Arm_relocate_functions::calc_grp_residual): New method.
8277         (Arm_relocate_functions::calc_grp_gn): New method.
8278         (Arm_relocate_functions::arm_grp_alu): New Method.
8279         (Arm_relocate_functions::arm_grp_ldr): New Method.
8280         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8281         (Arm_relocate_functions::arm_grp_ldc): New Method.
8282         (Target_arm::Scan::local): Handle the ARM group relocations.
8283         (Target_arm::Scan::global): Likewise.
8284         (Target_arm::Relocate::relocate): Likewise.
8285         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8286         Likewise.
8287
8288 2010-01-26  Doug Kwan  <dougkwan@google.com>
8289
8290         * arm.cc (set): Include.
8291         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8292         pointer type.
8293         (Arm_output_section::Text_section_list): New type.
8294         (Arm_output_section::append_text_sections_to_list): New method.
8295         (Arm_output_section::fix_exidx_coverage): Ditto.
8296         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8297         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8298         Relobj::set_section_offset() instead of
8299         Sized_relobj::invalidate_section_offset().
8300         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8301         parameter for section headers. Ignore relocation sections for
8302         unallocated sections and EXIDX sections.
8303         (Target_arm::fix_exidx_coverage): New method.
8304         (Target_arm::output_section_address_less_than): New type.
8305         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8306         linked text section instead of the EXIDX section.
8307         (Arm_output_section::create_stub_group): Add an assertion to check
8308         that this is not an EXIDX output section.
8309         (Arm_output_section::append_text_sections_to_list): New method.
8310         (Arm_output_section::fix_exidx_coverage): Ditto.
8311         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8312         Arm_relobj::section_needs_reloc_stub_scanning.
8313         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8314         first pass.
8315         (Target_arm::fix_exidx_coverage): New method.
8316         * object.h (Relobj::set_output_section): New method.
8317         (Sized_relobj::invalidate_section_offset): Remove method.
8318         (Sized_relobj::do_invalidate_section_offset): Remove method.
8319         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8320
8321 2010-01-25  Doug Kwan  <dougkwan@google.com>
8322
8323         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8324         Fix warning due to signed and unsigned comparison on a 32-bit host.
8325
8326 2010-01-22  Doug Kwan  <dougkwan@google.com>
8327
8328         * arm.cc (Target_arm::do_relax): Record an output section for section
8329         offset adjustment it contains any stub table that has changed.
8330         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8331         offsets in an output section if necessary.
8332         * output.cc (Output_section::Output_section): Initialize
8333         section_offsets_need_adjustments_.
8334         (Output_section::add_input_section_for_script): Renamed to
8335         Output_section::add_simple_input_section.
8336         (Output_section::save_states): Add a comment.
8337         (Output_section::discard_states): New method defintion.
8338         (Output_section::adjust_section_offsets): Same.
8339         * output.h (Output_section::add_input_section_for_script): Renamed to
8340         Output_section::add_simple_input_section.
8341         (Output_section::discard_states): New method declaration.
8342         (Output_section::adjust_section_offsets): Same.
8343         (Output_section::section_offsets_need_adjustment,
8344         Output_section::set_section_offsets_need_adjustment): New method
8345         definitions.
8346         (Output_section::section_offsets_need_adjustment_): New data member.
8347         * script-sections.cc
8348         (Output_section_element_input::set_section_address): Adjust code for
8349         renaming of Output_section::add_input_section_for_script.
8350         (Orphan_output_section::set_section_address): Same.
8351
8352 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8353
8354         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8355         Fix_v4bx enum values .
8356         * gold/options.h (General_options): New option definitions.
8357         (General_options::fix_v4bx): New method.
8358         (General_options::Fix_v4bx): New enum.
8359         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8360         (General_options::parse_fix_v4bx_interworking): New method.
8361
8362 2010-01-22  Doug Kwan  <dougkwan@google.com>
8363
8364         * arm.cc (Arm_exidx_fixup): New class.
8365
8366 2010-01-21  Doug Kwan  <dougkwan@google.com>
8367
8368         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8369         classes.
8370         (Arm_exidx_section_offset_map): New type.
8371
8372 2010-01-21  Doug Kwan  <dougkwan@google.com>
8373
8374         * arm.cc (Arm_exidx_input_section): New class.
8375         (Arm_relobj::exidx_input_section_by_link,
8376         Arm_relobj::exidx_input_section_by_shndx,
8377         Arm_relobj::make_exidx_input_section): New methods.
8378         (read_arm_attributes_section): Remove.
8379         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8380         information about them.
8381         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8382         to here.
8383
8384 2010-01-20  Doug Kwan  <dougkwan@google.com>
8385
8386         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8387         Input_section_specifier to Section_id.
8388         (Target_arm::new_arm_input_section: Adjust code for change of key
8389         type.
8390         (Target_arm::find_arm_input_section): Ditto.
8391         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8392         (Section_id): Remove.
8393         (Garbage_collection::Section_id_hash): Remove.
8394         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8395         (Section_id): Remove.
8396         (Icf::Section_id_hash): Remove.
8397         * object.h (Section_id, Const_section_id, Section_id_hash,
8398         Const_section_id_hash): New type definitions.
8399         * output.cc (Output_section::add_relaxed_input_section): Change to
8400         use Const_section_id instead of Input_section_specifier as key type.
8401         (Output_section::add_merge_input_section): Ditto.
8402         (Output_section::build_relaxation_map): Change to use Section_id
8403         instead of Input_section_specifier as key type.
8404         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8405         Ditto.
8406         (Output_section::convert_input_sections_to_relaxed_sections): Change
8407         to use Const_section_id instead of Input_section_specifier as key type.
8408         (Output_section::find_merge_section): Ditto.
8409         (Output_section::find_relaxed_input_section): Ditto.
8410         * output.h (Input_section_specifier): Remove class.
8411         (Output_section::Output_section_data_by_input_section_map): Change
8412         key type to Const_section_id.
8413         (Output_section::Output_relaxed_input_section_by_input_section_map):
8414         Ditto.
8415         (Output_section::Relaxation_map): Change key type to Section_id.
8416
8417 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8418
8419         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8420         (class Arm_v4bx_stub): New class.
8421         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8422         (Stub_factory::make_arm_v4bx_stub): New method.
8423         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8424         (Stub_table::empty): Handle v4bx stubs.
8425         (Stub_table::add_arm_v4bx_stub): New method.
8426         (Stub_table::find_arm_v4bx_stub): New method.
8427         (Arm_relocate_functions::v4bx): New method.
8428         (Target_arm::fix_v4bx): New method.
8429         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8430         (Stub_table::relocate_stubs): Likewise.
8431         (Stub_table::do_write): Likewise.
8432         (Stub_table::update_data_size_and_addralign): Likewise.
8433         (Stub_table::finalize_stubs):  Likewise.
8434         (Target_arm::Scan::local): Likewise.
8435         (Target_arm::Scan::global): Likewise.
8436         (Target_arm::do_finalize_sections): Likewise.
8437         (Target_arm::Relocate::relocate): Likewise.
8438         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8439         Likewise.
8440         (Target_arm::scan_reloc_for_stub): Likewise.
8441         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8442
8443 2010-01-19  Ian Lance Taylor  <iant@google.com>
8444
8445         * output.cc (Output_section_headers::do_sized_write): Write large
8446         segment count to sh_info field.
8447         (Output_file_header::do_sized_write): For large segment count,
8448         write PN_XNUM to e_phnum field.
8449
8450 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8451
8452         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8453         (Arm_relocate_functions::thm_jump8): New function.
8454         (Arm_relocate_functions::thm_jump11): New function.
8455         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8456         R_ARM_THM_JUMP11.
8457         (Target_arm::Scan::global): Likewise.
8458         (Target_arm::Relocate::relocate): Likewise.
8459         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8460         Likewise.
8461
8462 2010-01-14  Doug Kwan  <dougkwan@google.com>
8463
8464         * arm.cc (map, utility): Include headers.
8465         (Target_arm::apply_cortex_a8_workaround): New method.
8466         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8467         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8468         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8469         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8470         the --[no-]fix-cortex-a8 command line options.
8471         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8472         (Target_arm::relocate_stub): Use addend in instruction template.
8473         * options.h (DEFINE_bool): Set the user-set flag.
8474         (General_options): Add --[no-]-fix-cortex options.
8475         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8476         : Update fast look-up map after conversion.
8477
8478 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8479
8480         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8481         in the first pass of do_layout.
8482
8483 2010-01-13  Doug Kwan  <dougkwan@google.com>
8484
8485         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8486         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8487         apparent compiler problem of not folding static constant integral
8488         data members of elfcpp::Elf_sizes<32>.
8489
8490 2010-01-13  Doug Kwan  <dougkwan@google.com>
8491
8492         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8493         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8494         Arm_relobj::scan_section_for_cortex_a8_erratum,
8495         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8496         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8497         sections to scan for relocation stubs into a new method
8498         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8499         relocation and Cortex-A8 stub scanning.
8500         (Target_arm::do_relax): Force stubs to be after stubbed sections
8501         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8502         the beginning of a new relaxation pass.  Update a comment.
8503         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8504
8505 2010-01-12  Ian Lance Taylor  <iant@google.com>
8506
8507         * target-reloc.h (visibility_error): New inline function.
8508         (relocate_section): Call visibility_error.
8509         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8510         (MOSTLYCLEANFILES): Likewise.
8511         (protected_4_pic.o, protected_3.err): New targets.
8512         * testsuite/protected_4.cc: New file.
8513
8514 2010-01-12  Doug Kwan  <dougkwan@google.com>
8515
8516         * arm.cc (Cortex_a8_reloc): New class.
8517         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8518         and cortex_a8_relocs_info_.
8519         (Target_arm::fix_cortex_a8): New method definition.
8520         (Target_arm::Cortex_a8_relocs_info): New type.
8521         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8522         New data member declarations.
8523         (Target_arm::scan_reloc_for_stub): Record information about
8524         relocations for THUMB branches that might be exempted from the
8525         Cortex-A8 workaround.
8526         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8527         at the beginning of a relaxation pass.
8528
8529 2010-01-12  Doug Kwan  <dougkwan@google.com>
8530
8531         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8532         (Arm_relobj::Mapping_symbol_position,
8533          Arm_reloj::Mapping_symbol_position_less,
8534          Arm_relobj::Mapping_symbols_info): New types.
8535         (Target_arm::is_mapping_symbol_name): New method definition.
8536         (Arm_relobj::do_count_local_symbols): Save information about mapping
8537         symbols.
8538
8539 2010-01-11  Doug Kwan  <dougkwan@google.com>
8540
8541         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8542         Arm_relocate_functions::thumb32_branch_upper,
8543         Arm_relocate_functions::thumb32_branch_lower,
8544         Arm_relocate_functions::thumb32_cond_branch_offset,
8545         Arm_relocate_functions::thumb32_cond_branch_upper,
8546         Arm_relocate_functions::thumb32_cond_branch_lower,
8547         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8548         branch offset encoding.
8549         (Arm_relocate_functions::thumb_branch_common): Use new branch
8550         offset encoding methods to avoid code duplication.
8551         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8552         (Stub_addend_reader::operator()): Use new branch encoding method
8553         to avoid code duplication.
8554
8555 2010-01-11  Doug Kwan  <dougkwan@google.com>
8556
8557         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8558         (Target_arm::do_finalize_sections): Define special EXIDX section
8559         symbols only if referenced.
8560         * gc.h (Garbage_collection::add_reference): New method.
8561         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8562         code duplication.
8563
8564 2010-01-11  Ian Lance Taylor  <iant@google.com>
8565
8566         * script.cc (Version_script_info::build_expression_list_lookup):
8567         Change complaing about duplicate wildcard match from error to
8568         warning.
8569
8570         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8571         of 2009-12-30.
8572         (Version_script_info::Version_script_info): Initialize globs_,
8573         default_version_, default_is_global_, and exact_.  Don't
8574         initialize globals_ or locals_.
8575         (Version_script_info::build_lookup_tables): Build local symbols
8576         first.
8577         (Version_script_info::unquote): New function.
8578         (Version_script_info::add_exact_match): New function.
8579         (Version_script_info::build_expression_list_lookup): Remove lookup
8580         parameter.  Add is_global parameter.  Change all callers.  Handle
8581         wildcard pattern specially.  Unquote pattern.  Call
8582         add_exact_match.
8583         (Version_script_info::get_name_to_match): New function.
8584         (Version_script_info::get_symbol_version): New function.
8585         (Version_script_info::get_symbol_version_helper): Remove.
8586         (Version_script_info::check_unmatched_names): Call unquote.
8587         * script.h (class Version_script_info): Change get_symbol_version
8588         to be non-inline and add is_global parameter; change all callers.
8589         Rewrite symbol_is_local.  Update declarations.  Define struct
8590         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8591         Remove globals_ and locals_ members.  Add exact_, globs_,
8592         default_version_, is_global_.
8593         (Version_script_info::Glob): Remove pattern, add expression and
8594         is_global.  Update constructor.  Change all callers.
8595         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8596         default version.
8597         (Versions::symbol_section_contents): If a symbol is undefined, or
8598         defined in a dynamic object, set the version index to
8599         VER_NDX_LOCAL.
8600         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8601         symbol_is_local.
8602         (Symbol_table::add_from_pluginobj): Likewise.
8603         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8604
8605 2010-01-11  Doug Kwan  <dougkwan@google.com>
8606
8607         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8608         (incremental_dump_LDADD): Add linking option for libintl.
8609         * Makefile.in: Regenerate.
8610
8611 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8612
8613         PR gold/11144
8614         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8615         instead of -Ds.
8616         * testsuite/Makefile.in: Regenerated.
8617
8618 2010-01-10  Doug Kwan  <dougkwan@google.com>
8619
8620         * options.h (DEFINE_var): Use parentheses around argument varname__
8621         in macro body to avoid any unintended subsequent substitutions.
8622
8623 2010-01-10  Ian Lance Taylor  <iant@google.com>
8624
8625         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8626         candidates before doing symbol resolution.
8627
8628         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8629         ODR candidates if only one is weak.
8630
8631 2010-01-08  Ian Lance Taylor  <iant@google.com>
8632
8633         * script.cc (Version_script_info::build_expression_list_lookup):
8634         Don't warn about ambiguous version, just record the ambiguity.
8635         (Version_script_info::get_symbol_version_helper): Give error if
8636         version is ambiguous.
8637
8638 2010-01-08  Doug Kwan  <dougkwan@google.com>
8639
8640         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8641         prev_data_size_ and prev_addralign_.  Remove initializer for
8642         deleted data member has_been_changed_.
8643         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8644         to determine if the table is empty.
8645         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8646         Remove.
8647         (Stub_table::add_reloc_stub): Define method in class definition
8648         instead of just declaring it there.
8649         (Stub_table::add_cortex_a8_stub): New method definition.
8650         (Stub_table::update_data_size_and_addralign): Ditto.
8651         (Stub_table::finalize_stubs): Ditto.
8652         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8653         (Stub_table::do_addralign_): Return address alignment in the
8654         (Stub_table::do_reset_address_and_file_offset): Define method in
8655         class definition instead of declaring it there.  Set current data
8656         size to be the data size of the previous pass.
8657         (Stub_table::set_final_data_size): Use current data size as the
8658         final data size.
8659         (Stub_table::relocate_stub): Change parameter type of stub from
8660         Reloc_stub pointer to Stub pointer.
8661         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8662         (Stub_table::Cortex_a8_stub_list): New typedef.
8663         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8664          Stub_table::prev_addralign_): New data member.
8665         (Arm_relobj::Arm_relobj): Initialize data member
8666         section_has_cortex_a8_workaround_.
8667         (Arm_relobj::section_has_cortex_a8_workaround,
8668          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8669          definitions.
8670         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8671         declarations.
8672         (Target_arm::relocate_stub): Change parameter type of stub from
8673         Reloc_stub pointer to Stub pointer.
8674         (Insn_template::size, Insn_template::alignment): Handle
8675         THUMB16_SPECIAL_TYPE.
8676         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8677          Stub_table::update_data_size_and_addralign,
8678          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8679         definitions.
8680         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8681         (Stub_table::do_write): Ditto.
8682         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8683
8684 2010-01-08  Ian Lance Taylor  <iant@google.com>
8685
8686         PR 11108
8687         * symtab.h (class Symbol): Remove fields is_target_special_ and
8688         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8689         (Symbol::is_defined_in_discarded_section): New function.
8690         (Symbol::set_is_defined_in_discarded_section): New function.
8691         (Symbol::has_plt_offset): Rewrite.
8692         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8693         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8694         Don't initialize is_target_special_ or has_plt_offset_.
8695         Initialize is_defined_in_discarded_section_.
8696         (Symbol_table::add_from_relobj): If appropriate, set
8697         is_defined_in_discarded_section.
8698         * resolve.cc (Symbol::override_base_with_special): Don't test
8699         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8700         * target-reloc.h (relocate_section): Do special handling for
8701         symbols defined in discarded sections for global symbols as well
8702         as local symbols.
8703
8704 2010-01-08  Ian Lance Taylor  <iant@google.com>
8705
8706         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8707         the SHT_SYMTAB case.
8708
8709 2010-01-08  Ian Lance Taylor  <iant@google.com>
8710
8711         * object.cc (Sized_relobj::do_layout): Don't get confused if
8712         layout_eh_frame returns NULL.
8713
8714 2010-01-08  Ian Lance Taylor  <iant@google.com>
8715
8716         PR 11084
8717         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8718         dynamic symbol table, use the normal symbol table.
8719         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8720         symbol table.
8721
8722 2010-01-08  Ian Lance Taylor  <iant@google.com>
8723
8724         PR 11072
8725         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8726         sections.
8727
8728 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8729
8730         * version.cc (print_version): Change to "Copyright 2010".
8731
8732 2010-01-08  Ian Lance Taylor  <iant@google.com>
8733
8734         PR 10287
8735         PR 11063
8736         * i386.cc (class Target_i386): Change return type of plt_section
8737         to be non-const.
8738         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8739         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8740         tls_desc_rel_ field.
8741         (Output_data_plt_i386::rel_tls_desc): New function.
8742         (Target_i386::rel_tls_desc_section): New function.
8743         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8744         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8745         R_386_TLS_DESC reloc in rel_tls_desc_section.
8746         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8747         Define struct Tlsdesc_info.
8748         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8749         (Target_x86_64::do_reloc_symbol_index): New function.
8750         (Target_x86_64::add_tlsdesc_info): New function.
8751         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8752         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8753         tlsdesc_rel_ field.
8754         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8755         all callers.
8756         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8757         (Target_x86_64::rela_tlsdesc_section): New function.
8758         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8759         handling.
8760         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8761         (Target_x86_64::do_reloc_addend): New function.
8762         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8763         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8764         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8765         (Output_reloc::type): New function.
8766         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8767         (Output_reloc::is_target_specific): New function.
8768         (Output_reloc::target_arg): New function.
8769         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8770         absolute relocs and target specific relocs.
8771         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8772         add_target_specific.
8773         (class Output_data_reloc) [SHT_RELA]: Likewise.
8774         * output.cc (Output_reloc::Output_reloc): Add four new versions
8775         for absolute relocs and target specific relocs.
8776         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8777         (Output_reloc::get_symbol_index): Likewise.
8778         (Output_reloc::local_section_offset): Check that local_sym_index_
8779         is not TARGET_CODE or 0.
8780         (Output_reloc::symbol_value): Likewise.
8781         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8782         reloc.
8783         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8784         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8785         functions.
8786         * layout.cc (add_target_dynamic_tags): Use output section for
8787         DT_PLTRELSZ and DT_JMPREL.
8788
8789 2010-01-07  Ian Lance Taylor  <iant@google.com>
8790
8791         PR 11061
8792         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8793         function.
8794         (class Output_data_reloc_generic): Define.
8795         (class Output_data_reloc_base): Change base class to
8796         Output_data_reloc_generic.  Change add() method to call
8797         bump_relative_reloc_count for a relative reloc.  Remove
8798         sort_relocs_ field.
8799         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8800         to sort_relocs().
8801         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8802         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8803         appropriate.
8804         * layout.h (class Layout): Update declaration.
8805
8806 2010-01-07  Ian Lance Taylor  <iant@google.com>
8807
8808         * output.h (class Output_data): Add const version of
8809         output_section and do_output_section.
8810         (class Output_section_data): Add const version of
8811         do_output_section.
8812         (class Output_section): Likewise.
8813         * layout.cc (Layout::add_target_dynamic_tags): New function.
8814         * layout.h (class Layout): Update declarations.
8815         * arm.cc (Target_arm::do_finalize_sections): Use
8816         add_target_dynamic_tags.
8817         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8818         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8819         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8820         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8821
8822 2010-01-07  Ian Lance Taylor  <iant@google.com>
8823
8824         PR 11042
8825         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8826         object as needed.
8827
8828 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8829             Ian Lance Taylor  <iant@google.com>
8830
8831         PR 11019
8832         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8833         Xindex::read_symtab_xindex.
8834
8835 2010-01-07  Doug Kwan  <dougkwan@google.com>
8836
8837         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8838         (Insn_template::thumb16_bcond_insn): New method declaration.
8839         (Insn_template): Fix spelling.
8840         (Stub::thumb16_special): New method declaration.
8841         (Stub::do_write): Define virtual method which was previously pure
8842         virtual.
8843         (Stub::do_thumb16_special): New method declaration.
8844         (Stub::do_fixed_endian_write): New template member.
8845         (Reloc_stub::do_write): Remove.
8846         (Reloc_stub::do_fixed_endian_write): Remove.
8847         (Cortex_a8_stub): New class definition.
8848         (Stub_factory::make_cortex_a8_stub): New method definition.
8849         (Stub_factory::Stub_factory): Add missing static storage class
8850         qualifier for elf32_arm_stub_a8_veneer_blx.
8851
8852 2010-01-07  Ian Lance Taylor  <iant@google.com>
8853
8854         PR 10980
8855         * options.h (class General_options): Add --warn-unresolved-symbols
8856         and --error-unresolved-symbols.
8857         * errors.cc (Errors::undefined_symbol): Implement
8858         --warn-unresolved-symbols.
8859
8860         * options.h (class General_options): Add -z text and -z textoff.
8861         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8862
8863 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8864
8865         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8866         (Garbage_collection::cident_sections): New function.
8867         (Garbage_collection::add_cident_section): New function.
8868         (Garbage_collection::cident_sections_): New member.
8869         (gc_process_relocs): Add references to sections whose names are C
8870         identifiers.
8871         * gold.h (cident_section_start_prefix): New constant.
8872         (cident_section_stop_prefix): New constant.
8873         (is_cident): New function.
8874         * layout.cc (Layout::define_section_symbols): Replace string constants
8875         with the newly defined constants.
8876         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8877         C identifiers.
8878         * testsuite/Makefile.am: Add gc_orphan_section_test.
8879         * testsuite/Makefile.in: Regenerate.
8880         * testsuite/gc_orphan_section_test.cc: New file.
8881         * testsuite/gc_orphan_section_test.sh: New file.
8882
8883 2010-01-06  Ian Lance Taylor  <iant@google.com>
8884
8885         PR 10980
8886         * options.h (class General_options): Add --warn-shared-textrel.
8887         * layout.cc (Layout::finish_dynamic_section): Implement
8888         --warn-shared-textrel.
8889
8890         PR 10980
8891         * options.h (class General_options): Add --warn-multiple-gp.
8892
8893 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8894
8895         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8896         $(THREADSLIB) and $(LIBDL).
8897         * Makefile.in: Rebuild.
8898
8899 2010-01-06  Ian Lance Taylor  <iant@google.com>
8900
8901         PR 10980
8902         * options.cc (General_options::parse_section_start): New function.
8903         (General_options::section_start): New function.
8904         (General_options::General_options): Initialize all members.
8905         * options.h: Include <map>
8906         (class General_options): Add --section-start.  Add section_starts_
8907         member.
8908         * layout.cc (Layout::attach_allocated_section_to_segment): If
8909         --section-start was used, set the address of the segment.  Remove
8910         local sort_sections.
8911         (Layout::relaxation_loop_body): If the address of the load segment
8912         has been set by --section-start, don't use it.
8913         * output.h (Output_segment::update_flags_for_output_section): New
8914         function.
8915         * output.cc (Output_segment::add_output_section): Call
8916         update_flags_for_output_section.
8917
8918 2010-01-05  Ian Lance Taylor  <iant@google.com>
8919
8920         PR 10980
8921         * options.h (class General_options): Add --undefined-version.
8922         * script.cc (struct Version_expression): Add was_matched_by_symbol
8923         field.
8924         (Version_script_info::matched_symbol): New function.
8925         (Version_script_info::get_symbol_version_helper): Call
8926         matched_symbol.
8927         (Version_script_info::check_unmatched_names): New function.
8928         * script.h (class Version_script_info): Update declarations.
8929         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8930
8931         * options.h (class General_options): Use DEFINE_bool_alias for
8932         allow_multiple_definition.
8933         * resolve.cc (Symbol_table::should_override): Don't test
8934         allow_multiple_definition.
8935
8936         PR 10980
8937         * options.h (class General_options): Add --cref.
8938         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8939         until after printing cref table.
8940         * cref.cc: Include "symtab.h".
8941         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8942         (Cref_table_compare::operator()): New function.
8943         (Cref_inputs::gather_cref): New function.
8944         (filecol): New static const.
8945         (Cref_inputs::print_cref): New function.
8946         (Cref::print_cref): New function.
8947         * cref.h: Include <cstdio>.
8948         (class Cref): Update declarations.
8949         * mapfile.h (Mapfile::file): New function.
8950         * object.h (class Object): Define Symbols.  Declare virtual
8951         do_get_global_symbols.
8952         (Object::get_global_symbols): New function.
8953         * object.cc (Input_objects::add_object): Pass object to cref_ if
8954         --cref.
8955         (Input_objects::archive_start): Likewise.
8956         (Input_objects::archive_stop): Likewise.
8957         (Input_objects::print_cref): New function.
8958         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8959         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8960         --cref.
8961         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8962         function.
8963         * plugin.h (class Sized_pluginobj): Update declarations.
8964
8965 2010-01-05  Ian Lance Taylor  <iant@google.com>
8966
8967         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8968         to is_default_version.  Rename insdef to insdefault.
8969         (Symbol_table::add_from_relobj): Rename def to is_default_version
8970         and local to is_forced_local.
8971         (Symbol_table::add_from_pluginobj): Likewise.
8972         (Symbol_table::add_from_dynobj): Likewise.
8973         (Symbol_table::define_special_symbol): Rename insdef to
8974         insdefault.
8975
8976 2010-01-04  Ian Lance Taylor  <iant@google.com>
8977
8978         PR 10980
8979         * options.h (class General_options): Add
8980         --allow-multiple-definition and -z muldefs.
8981         * resolve.cc (Symbol_table::should_override): Don't warn about a
8982         multiple symbol definition if --allow-multiple-definition or -z
8983         muldefs.
8984
8985         PR 10980
8986         * options.h (class General_options): Add --add-needed and
8987         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8988         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8989         error if --copy-dt-needed-entries aka --add-needed is used and
8990         would cause a change in behaviour.
8991
8992         PR 10980
8993         * options.h (class General_options): Add -G as a short version of
8994         --shared.  Add no-op options -assert, -g, and -i.
8995
8996 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8997
8998         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8999         check for .text or .gnu.linkonce.t sections.
9000         * icf.cc (Icf::find_identical_sections): Ditto.
9001         Change the detection for mangled function name within the section
9002         name.
9003         * icf.h (is_section_foldable_candidate): New function.
9004
9005 2009-12-30  Ian Lance Taylor  <iant@google.com>
9006
9007         PR 10980
9008         * options.h (class General_options): Permit two dashes with
9009         --retain-symbols-file.
9010
9011 2009-12-30  Ian Lance Taylor  <iant@google.com>
9012
9013         PR 10979
9014         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9015         don't put the file header and segment headers in the text
9016         segment.
9017
9018         PR 10979
9019         * common.cc (Sort_commons::operator()): Stabilize sort when both
9020         entries are NULL.
9021         (Symbol_table::do_allocate_commons_list): When allocating common
9022         symbols, skip a symbol which is no longer common.
9023         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9024         an object before checking its type.
9025         * testsuite/common_test_2.c: New file.
9026         * testsuite/common_test_3.c: New file.
9027         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9028         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9029         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9030         (common_test_2_pic.o, common_test_2.so): New targets.
9031         (common_test_3_pic.o, common_test_3.so): New targets.
9032         * testsuite/Makefile.in: Rebuild.
9033
9034         PR 10979
9035         * script.cc (read_input_script): If we see a new SECTIONS clause,
9036         and we have added an input section, give an error.
9037         * layout.h (class Layout): Add have_added_input_section function.
9038         Add have_added_input_section_ field.
9039         * layout.cc (Layout::Layout): Initialize
9040         have_added_input_section_.
9041         (Layout::layout): Set have_added_input_section_.
9042         (Layout::layout_eh_frame): Likewise.
9043
9044 2009-12-30  Ian Lance Taylor  <iant@google.com>
9045
9046         PR 10931
9047         * options.h (class General_options): Add --sort-common option.
9048         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9049         * common.cc (Sort_common): Add sort_order parameter to
9050         constructor.  Add sort_order_ field.
9051         (Sort_commons::operator): Check sort_order_.
9052         (Symbol_table::allocate_commons): Determine the sort order.
9053         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9054         Change all callers.
9055         (Symbol_table::do_allocate_commons_list): Likewise.
9056
9057 2009-12-30  Ian Lance Taylor  <iant@google.com>
9058
9059         PR 10916
9060         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9061         symbols from this object, don't change the visibility of an
9062         undefined symbol.
9063         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9064
9065 2009-12-30  Ian Lance Taylor  <iant@google.com>
9066
9067         PR 10861
9068         * script.h (class Version_script_info): Define Language enum.
9069         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9070         new fields globals_, locals_, and is_finalized_.
9071         * script.cc: Various formatting fixes.
9072         (class Parser_closure): Change language_stack_ from a vector of
9073         std::string to one of Version_script_info::Language.  Adjust all
9074         uses accordingly.
9075         (class Lazy_demangler): Remove.
9076         (struct Version_expression): Change language from std::string to
9077         Version_script_info::Language.
9078         (Version_script_info::Version_script_info): New function.
9079         (Version_script_info::~Version_script_info): Don't call clear.
9080         (Version_script_info::finalize): New function.
9081         (Version_script_info::build_lookup_tables): New function.
9082         (Version_script_info::build_expression_list_lookup): New
9083         function.
9084         (Version_script_info::get_symbol_version_helper): Rewrite to use
9085         lookup tables.
9086         (Version_script_info::print_expression_list): Adjust to use
9087         Version_script_info::Language.
9088         (script_push_lex_into_version_mode): Check that the version script
9089         has not been finalized.
9090         (version_script_push_lang): Change language string to
9091         Version_script_info::Language.
9092         * options.cc (Command_line::version_script): New function.
9093         * options.h (class General_options): Add finalize_dynamic_list
9094         function.  Change version_script from declaration to definition.
9095         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9096         * testsuite/version_script.map: Remove duplicate def of foo.
9097         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9098         version_script.map.
9099         * testsuite/Makefile.in: Rebuild.
9100
9101 2009-12-30  Ian Lance Taylor  <iant@google.com>
9102
9103         PR 10843
9104         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9105         if the input symbol index is 0, make the output symbol index 0.
9106
9107 2009-12-30  Ian Lance Taylor  <iant@google.com>
9108
9109         PR 10670
9110         * options.h (class General_options): Add -x/--discard-all.
9111         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9112         --discard-all.  If the local symbol needs a dynamic entry, check
9113         that before handling --discard-locals.
9114
9115 2009-12-30  Ian Lance Taylor  <iant@google.com>
9116
9117         PR 10450
9118         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9119         flags to PF_R.
9120         (Output_segment::add_output_section): Don't change the flags if
9121         the type is PT_TLS.
9122
9123         PR 10450
9124         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9125         GNU hash table if they need a dynamic value.  Otherwise, don't add
9126         them if they are defined in a dynamic object or are forced local.
9127
9128 2009-12-29  Ian Lance Taylor  <iant@google.com>
9129
9130         PR 10450
9131         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9132         .gnu.hash table for a 32-bit target.
9133
9134         PR 10450
9135         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9136         regular and a dynamic object only needs a dynamic symbol table
9137         entry if it is externally visible.
9138
9139         PR 10450
9140         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9141         constructor.  Add global_offset_table_ field.
9142         (Target_i386::got_section): Set global_offset_table_.
9143         (Target_i386::do_finalize_sections): Set global_offset_table_
9144         size.
9145         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9146         in constructor.  Add global_offset_table_ field.
9147         (Target_x86_64::got_section): Set global_offset_table_.
9148         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9149         size.
9150
9151         * layout.cc (Layout::Layout): Initialize increase_relro_.
9152         (Layout::get_output_section): Add is_relro, is_last_relro, and
9153         is_first_non_relro parameters.  Change all callers.
9154         (Layout::choose_output_section): Likewise.
9155         (Layout::add_output_section_data): Likewise.
9156         (Layout::make_output_section): Likewise.
9157         (Layout::set_segment_offsets): Clear increase_relro when using a
9158         linker script.
9159         * layout.h (class Layout): Add increase_relro method.  Add
9160         increase_relro_ field.  Update declarations.
9161         * output.cc (Output_section::Output_section): Initialize
9162         is_last_relro_ and is_first_non_relro_.
9163         (Output_segment::add_output_section): Group relro sections is
9164         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9165         (Output_segment::maximum_alignment): Remove relro handling.
9166         (Output_segment::set_section_addresses): Add increase_relro
9167         parameter.  Change all callers.  Add initial alignment to align
9168         relro sections on separate page.  Remove old relro handling.
9169         (Output_segment::set_section_list_addresses): Remove in_relro
9170         parameter.  Change all callers.
9171         (Output_segment::set_offset): Add increase parameter.  Change all
9172         callers.  Remove old relro handling.
9173         * output.h (class Output_section): Add new methods: is_last_relro,
9174         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9175         Add is_last_relro_ and is_first_non_relro_ fields.
9176         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9177         Create separate .got.plt section.  Call increase_relro.
9178         * x86_64.cc (Target_x86_64::got_section): Likewise.
9179         * testsuite/relro_script_test.t: Add .got.plt.
9180
9181         PR 10450
9182         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9183         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9184         (Layout::finalize): Call set_dynamic_symbol_size.
9185         (Layout::set_dynamic_symbol_size): New function.
9186         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9187         set_dynamic_symbol_size.
9188
9189         PR 10450
9190         * output.h (class Output_section): Add is_entsize_zero_ field.
9191         * output.cc (Output_section::Output_section): Initialize
9192         is_entsize_zero_.
9193         (Output_section::set_entsize): If two different entsizes are
9194         requested, force it to zero.
9195         (Output_section::add_input_section): Set flags for .debug_str
9196         before updating section flags.  Set entsize.
9197         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9198         and SHF_STRING if all input sections have those flags.
9199
9200 2009-12-29   Rafael Espindola  <espindola@google.com>
9201
9202         * main.cc (main): Fix the sys time reporting.
9203         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9204         reporting.
9205
9206 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9207
9208         * options.cc (General_options::parse_version): Allow -v to exit
9209         without an error if there is nothing to link.
9210
9211 2009-12-29  Ian Lance Taylor  <iant@google.com>
9212
9213         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9214         using a version of gcc before 4.1.
9215         * configure: Rebuild.
9216
9217 2009-12-28  Chris Demetriou  <cgd@google.com>
9218
9219         * attributes.cc (Output_attributes_section_data::do_write): Use
9220         std::vector::front rather than std::vector::data.
9221
9222 2009-12-28  Ian Lance Taylor  <iant@google.com>
9223
9224         * symtab.h (class Symbol_table): Add enum Defined.
9225         * resolve.cc (Symbol_table::should_override): Add defined
9226         parameter.  Change all callers.  Test whether object is NULL
9227         before calling a method on it.
9228         (Symbol_table::report_resolve_problem): Add defined parameter.
9229         Change all callers.
9230         (Symbol_table::should_override_with_special): Likewise.
9231         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9232         parameter.  Change all callers.
9233         (Symbol_table::do_define_in_output_data): Likewise.
9234         (Symbol_table::define_in_output_segment): Likewise.
9235         (Symbol_table::do_define_in_output_segment): Likewise.
9236         (Symbol_table::define_as_constant): Likewise.
9237         (Symbol_table::do_define_as_constant): Likewise.
9238         * script.h (class Symbol_assignment): Add is_defsym parameter to
9239         constructor; change all callers.
9240         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9241         parameter.  Change all callers.  Add is_defsym_ field.
9242         (class Parser_closure): Add parsing_defsym parameter to
9243         constructor; change all callers.  Add parsing_defsym accessor
9244         function.  Add parsing_defsym_ field.
9245
9246 2009-12-28  Ian Lance Taylor  <iant@google.com>
9247
9248         * gold.cc (queue_middle_tasks): Fix formatting.
9249         * object.cc (Relobj::is_section_name_included): Likewise.
9250
9251 2009-12-23  Ian Lance Taylor  <iant@google.com>
9252
9253         * i386.cc (Target_i386::do_calls_non_split): Recognize
9254         -fsplit-stack prologue for a function with a static chain.
9255         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9256         -fsplit-stack prologue when using %r11.
9257
9258 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9259
9260         * options.cc (General_options::parse_version): Make -v continue and do
9261         the link like GNU ld does.
9262
9263 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9264
9265         * Makefile.am (CCFILES): Add timer.cc.
9266         (HFILES): Add timer.h.
9267         * configure.ac: Check for sysconf and times.
9268         * main.cc: include timer.h.
9269         (main): Use Timer instead of get_run_time.
9270         * timer.cc: New.
9271         * timer.h: New.
9272         * workqueue.cc: include timer.h.
9273         (Workqueue::find_and_run_task):
9274         Report user, sys and wall time.
9275         * Makefile.in: Regenerate.
9276         * config.in: Regenerate.
9277         * configure: Regenerate.
9278
9279 2009-12-16  Doug Kwan  <dougkwan@google.com>
9280
9281         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9282         sections.
9283         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9284         relaxed input sections.
9285         * output.cc (Output_section::find_relaxed_input_section): Change
9286         return type to Output_relaxed_input_section pointer.  Adjust code
9287         for new type of relaxed_input_section_map_.
9288         * output.h (Output_section::find_relaxed_input_section): Change
9289         return type to Output_relaxed_input_section pointer.
9290         (Output_section::Output_relaxed_input_section_by_input_section_map):
9291         New type.
9292         (Output_section::relaxed_input_section_map_): Change type to
9293         Output_section::Output_relaxed_input_section_by_input_section_map.
9294         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9295         input section.
9296
9297 2009-12-15  Ian Lance Taylor  <iant@google.com>
9298
9299         * layout.cc (Layout::create_shstrtab): Only write out after input
9300         sections if we are compressing debug sections.
9301
9302 2009-12-15  Ian Lance Taylor  <iant@google.com>
9303
9304         * archive.cc (Archive::add_symbols): Only look up a symbol without
9305         a version if there is, in fact, a version.
9306
9307 2009-12-14  Ian Lance Taylor  <iant@google.com>
9308
9309         Revert -Wshadow changes, all changes from:
9310         2009-12-11  Doug Kwan  <dougkwan@google.com>
9311         2009-12-11  Nick Clifton  <nickc@redhat.com>
9312         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9313
9314 2009-12-11  Doug Kwan  <dougkwan@google.com>
9315
9316         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9317         due to -Wshadow.
9318         * attributes.cc (Object_attribute::size): Ditto.
9319         (Attributes_section_data::size): Ditto.
9320         (Attributes_section_data::Attributes_section_data): Ditto.
9321         (Output_attributes_section_data::do_write): Ditto.
9322         * attributes.h (Object_attribute::set_type): Ditto.
9323         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9324
9325 2009-12-11  Nick Clifton  <nickc@redhat.com>
9326
9327         * archive.cc: Fix shadowed variable warnings.
9328         * arm.cc: Likewise.
9329         * compressed_output.cc: Likewise.
9330         * compressed_output.h: Likewise.
9331         * configure: Likewise.
9332         * dwarf_reader.cc: Likewise.
9333         * dynobj.cc: Likewise.
9334         * dynobj.h: Likewise.
9335         * ehframe.cc: Likewise.
9336         * ehframe.h: Likewise.
9337         * errors.cc: Likewise.
9338         * expression.cc: Likewise.
9339         * fileread.cc: Likewise.
9340         * fileread.h: Likewise.
9341         * freebsd.h: Likewise.
9342         * i386.cc: Likewise.
9343         * icf.cc: Likewise.
9344         * incremental.h: Likewise.
9345         * layout.cc: Likewise.
9346         * layout.h: Likewise.
9347         * mapfile.cc: Likewise.
9348         * merge.cc: Likewise.
9349         * merge.h: Likewise.
9350         * object.cc: Likewise.
9351         * object.h: Likewise.
9352         * options.h: Likewise.
9353         * output.cc: Likewise.
9354         * output.h: Likewise.
9355         * parameters.cc: Likewise.
9356         * plugin.cc: Likewise.
9357         * powerpc.cc: Likewise.
9358         * reduced_debug_output.cc: Likewise.
9359         * reduced_debug_output.h: Likewise.
9360         * reloc.cc: Likewise.
9361         * reloc.h: Likewise.
9362         * resolve.cc: Likewise.
9363         * script-sections.cc: Likewise.
9364         * script.cc: Likewise.
9365         * script.h: Likewise.
9366         * sparc.cc: Likewise.
9367         * symtab.cc: Likewise.
9368         * symtab.h: Likewise.
9369         * target-select.cc: Likewise.
9370         * target-select.h: Likewise.
9371         * token.h: Likewise.
9372         * workqueue.cc: Likewise.
9373         * workqueue.h: Likewise.
9374         * x86_64.cc: Likewise.
9375
9376 2009-12-10  Doug Kwan  <dougkwan@google.com>
9377
9378         * arm.cc (attributes.h): New include.
9379         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9380         (Arm_relobj::~Arm_relobj): Delete object pointed by
9381         attributes_section_data_.
9382         (Arm_relobj::attributes_section_data): New method definition.
9383         (Arm_relobj::attributes_section_data_): New data member declaration.
9384         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9385         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9386         attributes_section_data_.
9387         (Arm_dynobj::attributes_section_data): New method definition.
9388         (Arm_dynobj::attributes_section_data_): New data member declaration.
9389         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9390         initialization value of may_use_blx_ to false.
9391         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9392         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9393         object attributes to compute results instead of hard-coding.
9394         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9395         Target_arm::get_secondary_compatible_arch,
9396         Target_arm::set_secondary_compatible_arch
9397         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9398         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9399         New method declarations.
9400         (Target_arm::get_aeabi_object_attribute): New method definition.
9401         (Target_arm::attributes_section_data_): New data member declaration.
9402         (read_arm_attributes_section): New template definition.
9403         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9404         (Arm_dynobj::do_read_symbols): Ditto.
9405         (Target_arm::do_finalize_sections): Merge attributes sections from
9406         input.  Check for BLX use after attributes section merging.
9407         Fix __exidx_start and __exidx_end visibility.  Create an
9408         .ARM.attributes section if necessary.
9409         (Target_arm::get_secondary_compatible_arch,
9410         Target_arm::set_secondary_compatible_arch,
9411         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9412         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9413         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9414         New method definitions.
9415
9416 2009-12-09  Ian Lance Taylor  <iant@google.com>
9417
9418         * plugin.cc (Plugin::load): Don't cast from void* to a function
9419         pointer.
9420
9421 2009-12-09  Ian Lance Taylor  <iant@google.com>
9422
9423         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9424         information fields.
9425
9426 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9427
9428         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9429         Replace two_file_shared_1.so with two_file_shared_2.so.
9430         * testsuite/Makefile.in: Regenerated.
9431
9432 2009-12-08  Doug Kwan  <dougkwan@google.com>
9433
9434         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9435         (HFILES): Add attributes.h and int_encoding.h.
9436         * Makefile.in: Regenerate.
9437         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9438         function definitions to int_encoding.cc
9439         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9440         prototypes to int_encoding.h
9441         * reduced_debug_output.cc (int_encoding.h): New include.
9442         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9443         function definitions to int_encoding.cc
9444         (insert_into_vector, read_from_pointer): Move template definitions to
9445         int_encoding.h
9446         * attributes.cc: New file.
9447         * attributes.h: New file.
9448         * int_encoding.cc: New file.
9449         * int_encoding.h: New file.
9450
9451 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9452
9453         PR gold/11055
9454         * incremental-dump.cc (dump_incremental_inputs): New.
9455         (main): Use dump_incremental_inputs.
9456
9457 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9458
9459         PR gold/10893
9460         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9461         checking elfcpp::STT_FUNC.
9462         (Target_i386::Relocate::relocate): Likewise.
9463         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9464
9465         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9466         symbols from shared libraries into normal FUNC symbols.
9467
9468         * symtab.h (Symbol): Add is_func and use it.
9469
9470 2009-12-05  Doug Kwan  <dougkwan@google.com>
9471
9472         * arm.cc (Target_arm::arm_info): Initialize new fields
9473         attributes_section and attributes_vendor.
9474         * i386.cc (Target_i386::i386_info): Same.
9475         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9476         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9477         fields attributes_section and attributes_vendor.
9478         * sparc.cc (Target_sparc::sparc_info): Same.
9479         * target.h (Target::attributes_section, Target::attributes_vendor,
9480         Target::is_attributes_section, Target::attribute_arg_type,
9481         Target::attributes_order): New method definitions.
9482         (Target::Target_info::attributes_section,
9483         Target::Target_info::attributes_vendor): New fields.
9484         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9485         virtual method definitions.
9486         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9487         attributes_section and attributes_vendor.
9488         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9489
9490 2009-12-05  Doug Kwan  <dougkwan@google.com>
9491
9492         * arm.cc: Update comments about interworking and stub generation.
9493         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9494         considered as non-PIC.
9495         (Arm_relocate_functions::base_abs): Fix formatting.
9496         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9497         of function to use GOT entry address instead of offset.
9498         (Target_arm::Scan::global): Issue an error if a symbol would need a
9499         PLT does not get one because it is untyped.  Remove code to create
9500         dynamic symbols for relative branches.
9501         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9502         takes unsigned integer instead of boolean.
9503
9504 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9505
9506         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9507         (two_file_test_LDADD): Likewise.
9508         (common_test_1_LDADD): Likewise.
9509         (exception_test_LDADD) Likewise.
9510         (weak_test_LDADD): Likewise.
9511         (many_sections_test_LDADD): Likewise.
9512         (initpri1_LDADD): Likewise.
9513         (script_test_1_LDADD): Likewise.
9514         (script_test_2_LDADD): Likewise.
9515         (justsyms_LDADD): Likewise.
9516         (binary_test_LDADD): Likewise.
9517         (large_LDADD): Likewise.
9518         * testsuite/Makefile.in: Regenerated.
9519
9520 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9521
9522         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9523         (Symbol_table::override_with_special): Likewise.
9524         (Symbol_table::add_from_object): Likewise.
9525
9526 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9527
9528         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9529         Don't set the data_offset twice.
9530
9531 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9532
9533         * testsuite/Makefile.in: Regenerate.
9534
9535 2009-12-03  Doug Kwan  <dougkwan@google.com>
9536
9537         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9538         (Target_arm::do_finalize_sections): Add parameter for symbol table
9539         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9540         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9541         parameter for symbol table pointer.
9542         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9543         an additional parameter for a pointer to symbol table.
9544         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9545         parameter for a symbol table pointer.
9546         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9547         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9548         Ditto.
9549         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9550         parameter for a symbol table pointer.
9551
9552 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9553
9554         * incremental.cc (Incremental_inputs_header)
9555         (Incremental_inputs_header_write, Incremental_inputs_entry)
9556         (Incremental_inputs_entry_write): Move ...
9557         * incremental.h (Incremental_inputs_header)
9558         (Incremental_inputs_header_write, Incremental_inputs_entry)
9559         (Incremental_inputs_entry_write): here.
9560
9561 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9562
9563         * incremental.cc (make_sized_incremental_binary): Set the target.
9564         Error if it is incompatible.
9565         * output.h (Output_file): Add filename method.
9566
9567 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9568
9569         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9570         from the get_* methods.
9571
9572 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9573
9574         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9575         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9576         Write 0 for the data_offset of scripts.
9577
9578 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9579
9580         * testsuite/Makefile.am: Add the incremental_test.sh test.
9581         * testsuite/incremental_test.sh: New.
9582         * testsuite/incremental_test_1.c: New.
9583         * testsuite/incremental_test_2.c: New.
9584
9585 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9586
9587         * incremental-dump.cc (main): Fix typos.
9588
9589 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9590
9591         PR gold/11025
9592         * incremental-dump.cc (main): Use llu to print 64 bit values.
9593
9594 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9595             H.J. Lu  <hongjiu.lu@intel.com>
9596
9597         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9598         $(LIBDL).
9599         (incremental_dump_LDADD): Likewise.
9600         * Makefile.in: Regenerated.
9601
9602 2009-11-25  Doug Kwan  <dougkwan@google.com>
9603
9604         Revert:
9605
9606         2009-11-25  Doug Kwan  <dougkwan@google.com>
9607
9608                 * arm.cc (Target_arm::Target_arm): Move method definition
9609                 outside of class definition.  Add code to handle
9610                 --target1-rel, --target1-abs and --target2= options.
9611                 (Target_arm::get_reloc_reloc_type): Change method to be
9612                 non-static and const.
9613                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9614                 New data member declaration.
9615                 (Target_arm::Scan::local, Target_arm::Scan::global,
9616                 Target_arm::Relocate::relocate,
9617                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9618                 Adjust call to Target_arm::get_real_reloc_type.
9619                 (Target_arm::get_real_reloc_type): Use command line options
9620                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9621                 * options.h (--target1-rel, --target1-abs, --target2): New
9622                 ARM-only options.
9623
9624 2009-11-25  Doug Kwan  <dougkwan@google.com>
9625
9626         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9627         class definition.  Add code to handle --target1-rel, --target1-abs
9628         and --target2= options.
9629         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9630         and const.
9631         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9632         member declaration.
9633         (Target_arm::Scan::local, Target_arm::Scan::global,
9634         Target_arm::Relocate::relocate,
9635         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9636         call to Target_arm::get_real_reloc_type.
9637         (Target_arm::get_real_reloc_type): Use command line options to
9638         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9639         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9640         options.
9641
9642 2009-11-25  Doug Kwan  <dougkwan@google.com>
9643
9644         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9645         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9646         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9647         formatting.
9648         (Arm_relocate_functions::thm_call): Replace body with a call to
9649         Arm_relocate_functions::thumb_branch_common.
9650         (Arm_relocate_functions::thm_jump24,
9651         Arm_relocate_functions::thm_xpc22): New method definitions.
9652         (Arm_relocate_functions::thumb_branch_common): New method definition.
9653         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9654         operator.
9655         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9656         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9657
9658 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9659
9660         * Makefile.am: Build incremental-dump
9661         * Makefile.in: Regenerate.
9662         * incremental-dump.cc: New.
9663         * incremental.cc (Incremental_inputs_header_data,
9664         Incremental_inputs_entry_data): Move to incremental.h
9665         * incremental.h: (Incremental_inputs_header_data,
9666         Incremental_inputs_entry_data): Move from incremental.cc
9667
9668 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9669
9670         * incremental.cc (Incremental_inputs_header,
9671         Incremental_inputs_header_write, Incremental_inputs_entry,
9672         Incremental_inputs_entry_write): Add a typedef with the data type.
9673
9674 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9675
9676         * incremental.cc (Incremental_inputs_header,
9677         Incremental_inputs_header_write, Incremental_inputs_entry,
9678         Incremental_inputs_entry_write): Update comment about which
9679         type has the filed descriptions.
9680
9681 2009-11-15  Doug Kwan  <dougkwan@google.com>
9682
9683         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9684         (Arm_relocate_functions::arm_branch_common): Change method defintion
9685         in class definition to a method declaration and update list of formal
9686         parameters.
9687         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9688         Arm_relocation_functions::jump24): Adjust call to
9689         Arm_relocate_functions::arm_branch_common.  Update list of formal
9690         parameters.
9691         (Arm_relocate_functions::xpc25): New method definition.
9692         (Arm_relocate_functions::arm_branch_common): Move method defintion
9693         out from class definition.  Use stubs for mode-switching and extending
9694         branch ranges.
9695         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9696         specially.  Change code to enable use of stubs in ARM branches.
9697
9698 2009-11-10  Doug Kwan  <dougkwan@google.com>
9699
9700         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9701         in method declaration.
9702         (Target_arm::relocate_stub): New method declaration.
9703         (Target_arm::default_target): Change to return a pointer instead of
9704         a const reference.
9705         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9706         Target_arm::default_target.
9707         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9708         method definition.
9709         (Target_arm::relocate_section): Adjust view.
9710         (Target_arm::relocate_stub): New method definition.
9711
9712 2009-11-10  Doug Kwan  <dougkwan@google.com>
9713
9714         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9715         a format warning.
9716         * incremental.cc (open_incremental_binary): Initialized local
9717         variables to avoid warnings.
9718         * object.cc (make_elf_object): Ditto.
9719         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9720         a format warning.
9721
9722 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9723
9724         PR gold/10930
9725         * testsuite/plugin_test.c: Include "config.h".
9726
9727 2009-11-09  Doug Kwan  <dougkwan@google.com>
9728
9729         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9730         (arm_symbol_value): Remove.
9731         (Arm_relocate_functions::arm_branch_common,
9732         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9733         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9734         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9735         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9736         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9737         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9738         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9739         Arm_relocate_functions::thm_mobw_abs_nc,
9740         Arm_relocate_functions::thm_mov_abs,
9741         Arm_relocate_functions::movw_prel_nc,
9742         Arm_relocate_functions::thm_movt_abs,
9743         Arm_relocate_functions::movt_prel,
9744         Arm_relocate_functions::thm_movw_prel_nc,
9745         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9746         (Target_arm::Relocate::relocate): Only decompose address into two
9747         parts if relocation type uses the thumb-bit and pass the actual
9748         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9749         calls to methods in Arm_relocate_functions for this change.
9750
9751 2009-11-08  Ian Lance Taylor  <iant@google.com>
9752
9753         PR 10925
9754         * reloc.cc: Instantiate
9755         Sized_relobj::initialize_input_to_output_maps and
9756         Sized_relobj:free_input_to_output_maps.
9757
9758 2009-11-06  Ian Lance Taylor  <iant@google.com>
9759
9760         PR 10876
9761         * defstd.cc (in_segment): Set only_if_ref true for "end".
9762
9763 2009-11-06  Doug Kwan  <dougkwan@google.com>
9764
9765         * arm.cc (class Reloc_stub): Correct a comment.
9766         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9767         (Target_arm::scan_section_for_stubs): New method declaration.
9768         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9769         Change methods from private to protected.
9770         (Target_arm::do_may_relax): New method definition.
9771         (Target_arm::do_relax, Target_arm::group_sections,
9772         Target_arm::scan_reloc_for_stub,
9773         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9774         (Target_arm::arm_input_section_map_): New data member declaration.
9775         (Target_arm::scan_reloc_for_stub,
9776         Target_arm::scan_reloc_section_for_stubs,
9777         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9778         Target_arm::do_relax): New method definitions.
9779
9780 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9781
9782         * configure.ac: Check for (struct stat)::st_mtim
9783         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9784         * config.in: Regenerate.
9785         * configure: Regenerate.
9786
9787 2009-11-05  Ian Lance Taylor  <iant@google.com>
9788
9789         PR 10910
9790         * output.cc (Output_segment::add_output_section): Add missing
9791         return statement.
9792
9793 2009-11-04  Ian Lance Taylor  <iant@google.com>
9794
9795         PR 10880
9796         * object.h (class Object): Add is_needed and set_is_needed
9797         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9798         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9799         defined in a dynamic object and referenced by a regular object,
9800         set is_needed for the dynamic object.
9801         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9802         if the file is marked with as_needed and it is not needed.
9803
9804 2009-11-04  Ian Lance Taylor  <iant@google.com>
9805
9806         PR 10887
9807         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9808         tags if data is discarded by linker script.
9809         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9810         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9811         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9812         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9813
9814 2009-11-04  Ian Lance Taylor  <iant@google.com>
9815
9816         * layout.cc (Layout::get_output_section): Add is_interp and
9817         is_dynamic_linker_section parameters.  Change all callers.
9818         (Layout::choose_output_section): Likewise.
9819         (Layout::make_output_section): Likewise.
9820         (Layout::add_output_section_data): Add is_dynamic_linker_section
9821         parameter.  Change all callers.
9822         * layout.h (class Layout): Update declarations.
9823         * output.h (class Output_section): Add is_interp, set_is_interp,
9824         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9825         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9826         generate_code_fills_at_write_ to a bitfield.
9827         * output.cc (Output_section::Output_sections): Initialize new
9828         fields.
9829         (Output_segment::add_output_section): Add do_sort parameter.
9830         Change all callers.
9831
9832 2009-11-03  Ian Lance Taylor  <iant@google.com>
9833
9834         PR 10860
9835         * options.h (class General_options): Add --warn-common.
9836         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9837         merging two common symbols.
9838         (Symbol_table::should_override): Handle --warn-common when merging
9839         a common symbol with a defined symbol.  Use report_resolve_problem
9840         for multiple definitions.
9841         (Symbol_table::report_resolve_problem): New function.
9842         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9843
9844 2009-11-03  Doug Kwan  <dougkwan@google.com>
9845
9846         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9847         stub_factory_.
9848         (Target_arm::stub_factory): New method definition.
9849         (Target_arm::new_arm_input_section,
9850         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9851         Target_arm::reloc_uses_thumb_bit): New method declarations.
9852         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9853         New type definitions.
9854         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9855         member declarations.
9856         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9857         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9858         New method definitions.
9859
9860 2009-11-03  Ian Lance Taylor  <iant@google.com>
9861
9862         * options.h (class General_options): Add --warn_constructors.
9863
9864 2009-11-03  Ian Lance Taylor  <iant@google.com>
9865
9866         PR 10893
9867         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9868         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9869
9870 2009-11-03  Ian Lance Taylor  <iant@google.com>
9871
9872         PR 10895
9873         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9874         --msgid-bugs-address.
9875         (install-pdf): New target.
9876         (install-data_yes): Look up one directory to find mkinstalldirs.
9877
9878 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9879
9880         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9881         tree.
9882
9883 2009-10-30  Doug Kwan  <dougkwan@google.com>
9884
9885         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9886
9887 2009-10-30  Doug Kwan  <dougkwan@google.com>
9888
9889         * arm.cc (Stub_addend_reader): New struct template definition
9890         and partial specializations.
9891         (Stub_addend_reader::operator()): New method definition for a
9892         partially specialized template.
9893
9894 2009-10-30  Doug Kwan  <dougkwan@google.com>
9895
9896         * arm.cc (Arm_relobj::processor_specific_flags): New method
9897         definition.
9898         (Arm_relobj::do_read_symbols): New method declaration.
9899         (Arm_relobj::processor_specific_flags_): New data member declaration.
9900         (Arm_dynobj): New class definition.
9901         (Target_arm::do_finalize_sections): Add input_objects parameter.
9902         (Target_arm::do_adjust_elf_header): New method declaration.
9903         (Target_arm::are_eabi_versions_compatible,
9904         (Target_arm::merge_processor_specific_flags): New method declaration.
9905         (Target_arm::do_make_elf_object): New overloaded method definitions
9906         and declaration.
9907         (Arm_relobj::do_read_symbols): New method definition.
9908         (Arm_dynobj::do_read_symbols): Ditto.
9909         (Target_arm::do_finalize_sections): Add input_objects parameters.
9910         Merge processor-specific flags from all input objects.
9911         (Target_arm::are_eabi_versions_compatible,
9912         Target_arm::merge_processor_specific_flags,
9913         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9914         New method definitions.
9915         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9916         Input_objects pointer type parameter.
9917         * layout.cc (Layout::finalize): Pass input objects to target's.
9918         finalize_sections function.
9919         * output.cc (Output_file_header::do_sized_write): Set ELF file
9920         header's processor-specific flags.
9921         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9922         Input_objects pointer type parameter.
9923         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9924         * target.h (Input_objects): New forward class declaration.
9925         (Target::processor_specific_flags,
9926         Target::are_processor_specific_flags_sect): New method definitions.
9927         (Target::finalize_sections): Add input_objects parameter.
9928         (Target::Target): Initialize processor_specific_flags_ and
9929         are_processor_specific_flags_set_.
9930         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9931         parameter.
9932         (Target::set_processor_specific_flags): New method definition.
9933         (Target::processor_specific_flags_,
9934         Target::are_processor_specific_flags_set_): New data member
9935         declarations.
9936         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9937         Input_objects pointer type parameter.
9938
9939 2009-10-30  Doug Kwan  <dougkwan@google.com>
9940
9941         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9942
9943 2009-10-28  Ian Lance Taylor  <iant@google.com>
9944
9945         * object.h (class Relobj): Drop options parameter from
9946         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9947         do_scan_relocs, do_relocate.  Change all callers.
9948         (class Sized_relobj): Drop options parameters from
9949         do_gc_process_relocs, do_scan_relocs, do_relocate,
9950         do_relocate_sections, relocate_sections, emit_relocs_scan,
9951         emit_relocs_scan_reltype.  Change all callers.
9952         (struct Relocate_info): Remove options field and all references to
9953         it.
9954         * reloc.h (class Read_relocs): Remove options constructor
9955         parameter and options_ field.  Change all callers.
9956         (class Gc_process_relocs, class Scan_relocs): Likewise.
9957         (class Relocate_task): Likewise.
9958         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9959         all callers.
9960         (scan_relocatable_relocs): Likewise.
9961         * target.h (class Sized_target): Remove options parameter from
9962         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9963         all callers.
9964         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9965         callers.
9966         * arm.cc: Update functions to remove options parameters.
9967         * i386.cc: Likewise.
9968         * powerpc.cc: Likewise.
9969         * sparc.cc: Likewise.
9970         * x86_64.cc: Likewise.
9971         * testsuite/testfile.cc: Likewise.
9972
9973 2009-10-28  Doug Kwan  <dougkwan@google.com>
9974
9975         * arm.cc (Arm_relobj): New class definition.
9976         (Arm_relobj::scan_sections_for_stubs,
9977         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9978         New method definitions.
9979
9980 2009-10-28  Cary Coutant  <ccoutant@google.com>
9981
9982         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9983         (Plugin::cleanup_done_): New member.
9984         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9985         (Plugin_manager::cleanup_done_): Remove.
9986         (Plugin_manager::add_input_file): Edit error message.
9987         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9988         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9989
9990 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9991
9992         * fileread.cc: (File_read::View::~View): Use the new
9993         data_ownership_ filed.
9994         (File_read::~File_read): Dispose the new whole_file_view_.
9995         (File_read::open): Mmap the whole file if needed.
9996         (File_read::open): Use whole_file_view_ instead of contents_.
9997         (File_read::find_view): Use whole_file_view_ if applicable.
9998         (File_read::do_read): Use whole_file_view_ instead of contents_.
9999         (File_read::make_view): Use whole_file_view_ instead of contents_,
10000         update File_read::View::View call.
10001         (File_read::find_or_make_view): Update File_read::View::View
10002         call.
10003         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10004         remove contents_
10005         (File_read::View::Data_ownership): New enum.
10006         (File_read::View::View): Replace bool mapped_ with Data_ownership
10007         argument.
10008         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10009         (File_read::View::data_ownership_): New field.
10010         (File_read::contents_): Remove (replaced by whole_file_view_).
10011         (File_read::whole_file_view_): New field.
10012         * options.h (class General_options): Add --keep-files-mapped.
10013
10014 2009-10-27  Cary Coutant  <ccoutant@google.com>
10015
10016         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10017         * testsuite/Makefile.am (plugin_test_5): New test case.
10018         * testsuite/Makefile.in: Regenerate.
10019
10020 2009-10-25  Doug Kwan  <dougkwan@google.com>
10021
10022         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10023         from private to protected to allow access by child class.
10024         (Sized_relobj::do_relocate_sections): New method declaration.
10025         (Sized_relobj::relocate_sections): Virtualize.
10026         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10027         Sized_relobj::relocate_sections.  Instantiate template explicitly
10028         for different target sizes and endianity.
10029
10030 2009-10-24  Doug Kwan  <dougkwan@google.com>
10031
10032         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10033         (Arm_input_section::as_arm_input_section): New method.
10034         (Arm_output_section): New class definition.
10035         (Arm_output_section::create_stub_group,
10036         Arm_output_section::group_sections): New method definitions.
10037
10038 2009-10-22  Doug Kwan  <dougkwan@google.com>
10039
10040         * arm.cc (Arm_input_section): New class definition.
10041         (Arm_input_section::init, Arm_input_section:do_write,
10042         Arm_input_section::set_final_data_size,
10043         Arm_input_section::do_reset_address_and_file_offset): New method
10044         definitions.
10045
10046 2009-10-21  Doug Kwan  <dougkwan@google.com>
10047
10048         * arm.cc (Stub_table, Arm_input_section): New forward class
10049         declarations.
10050         (Stub_table): New class defintion.
10051         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10052         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10053         New method definition.
10054
10055 2009-10-21  Doug Kwan  <dougkwan@google.com>
10056
10057         * arm.cc: Update copyright comments.
10058         (Target_arm): New forward class template declaration.
10059         (Arm_address): New type.
10060         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10061         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10062         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10063         constants.
10064         (Insn_template): Same.
10065         (DEF_STUBS): New macro.
10066         (Stub_type): New enum type.
10067         (Stub_template): New class definition.
10068         (Stub): Same.
10069         (Reloc_stub): Same.
10070         (Stub_factory): Same.
10071         (Target_arm::Target_arm): Initialize may_use_blx_ and
10072         should_force_pic_veneer_.
10073         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10074         Target_arm::should_force_pic_veneer,
10075         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10076         Target_arm::using_thumb_only, Target_arm:;default_target): New
10077         method defintions.
10078         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10079         New data member declarations.
10080         (Insn_template::size, Insn_template::alignment): New method defintions.
10081         (Stub_template::Stub_template): New method definition.
10082         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10083         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10084         (Stub_factory::Stub_factory): New method definition.
10085         * gold.h (string_hash): New template.
10086         * output.h (Input_section_specifier::hash_value): Use
10087         gold::string_hash.
10088         (Input_section_specifier::string_hash): Remove.
10089         * stringpool.cc (Stringpool_template::string_hash): Use
10090         gold::string_hash.
10091
10092 2009-10-20  Doug Kwan  <dougkwan@google.com>
10093
10094         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10095         symbols of relaxed input sections.
10096         * output.h (Output_section::find_relaxed_input_section): Make
10097         method public.
10098
10099 2009-10-16  Doug Kwan  <dougkwan@google.com>
10100
10101         * dynobj.cc (Versions::Versions): Initialize version_script_.
10102         Only insert base version symbol definition for a shared object
10103         if version script defines any version versions.
10104         (Versions::define_base_version): New method definition.
10105         (Versions::add_def): Check that base version is not needed.
10106         (Versions::add_need): Define base version lazily.
10107         * dynobj.h (Versions::define_base_version): New method declaration.
10108         (Versions::needs_base_version_): New data member declaration.
10109         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10110         (check_DATA): Add no_version_test.stdout.
10111         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10112         New make rules.
10113         * testsuite/Makefile.in: Regenerate.
10114         * testsuite/no_version_test.c: New file.
10115         * testsuite/no_version_test.sh: Ditto.
10116
10117 2009-10-16  Doug Kwan  <dougkwan@google.com>
10118
10119         * expression.cc (class Segment_start_expression): New class definition.
10120         (Segment_start_expression::value): New method definition.
10121         (script_exp_function_segment_start): Return a new
10122         Segment_start_expression.
10123         * gold/script-c.h (script_saw_segment_start_expression): New function
10124         prototype.
10125         * script-sections.cc (Script_sections::Script_sections): Initialize
10126         SAW_SEGMENT_START_EXPRESSION_ to false.
10127         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10128         and -Tbbs options to specify section addresses if given in
10129         command line and no SEGMENT_START expression is seen in a script.
10130         * script-sections.h (Script_sections::saw_segment_start_expression,
10131         Script_sections::set_saw_segment_start_expression): New method
10132         definition.
10133         (Script_sections::saw_segment_start_expression_): New data member
10134         declaration.
10135         * script.cc (script_saw_segment_start_expression): New function.
10136         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10137         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10138         script_test_7.sh and script_test_8.sh.
10139         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10140         script_test_8.stdout.
10141         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10142         (script_test_6, script_test_6.stdout, script_test_7,
10143         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10144         * Makefile.in: Regenerate.
10145         * testsuite/script_test_6.sh: New file.
10146         * testsuite/script_test_6.t: Same.
10147         * testsuite/script_test_7.sh: Same.
10148         * testsuite/script_test_7.t: Same.
10149         * testsuite/script_test_8.sh: Same.
10150
10151 2009-10-16  Doug Kwan  <dougkwan@google.com>
10152
10153         * output.cc (Output_segment::set_section_list_address): Cast
10154         expressions to unsigned long long type to avoid format warnings.
10155
10156 2009-10-15  Ian Lance Taylor  <iant@google.com>
10157
10158         * script.cc (Script_options::add_symbol_assignment): Always add a
10159         dot assignment to script_sections_.
10160         * script-sections.cc (Script_sections::add_dot_assignment):
10161         Initialize if necessary.
10162
10163         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10164         program headers with no load segment if there is a linker script.
10165
10166         * layout.cc (Layout::set_segment_offsets): Align the file offset
10167         to the segment aligment for -N or -n with no load segment.
10168         * output.cc (Output_segment::add_output_section): Don't crash if
10169         the first section is a TLS section.
10170         (Output_segment::set_section_list_addresses): Print an error
10171         message if the address moves backward in a linker script.
10172         * script-sections.cc
10173         (Output_section_element_input::set_section_addresses): Don't
10174         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10175         (Orphan_output_section::set_section_addresses): Likewise.
10176
10177 2009-10-15  Doug Kwan  <dougkwan@google.com>
10178
10179         * layout.cc (Layout::finish_dynamic_section): Generate tags
10180         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10181         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10182         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10183
10184 2009-10-14  Ian Lance Taylor  <iant@google.com>
10185
10186         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10187         fields.
10188         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10189         data_shdr fields of relinfo.
10190         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10191         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10192         R_386_TLS_LDO_32, adjust based on section flags.
10193         (Target_i386::Relocate::fix_up_ldo): Remove.
10194
10195 2009-10-13  Ian Lance Taylor  <iant@google.com>
10196
10197         Add support for -pie.
10198         * options.h (class General_options): Add -pie and
10199         --pic-executable.
10200         (General_options::output_is_position_independent): Test -pie.
10201         (General_options::output_is_executable): Return true if not shared
10202         and not relocatable.
10203         (General_options::output_is_pie): Remove.
10204         * options.cc (General_options::finalize): Reject incompatible uses
10205         of -pie.
10206         * gold.cc (queue_middle_tasks): A -pie link is not static.
10207         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10208         * symtab.cc (Symbol::final_value_is_known): Return false if
10209         output_is_position_independent.
10210         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10211         output_is_position_independent.
10212         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10213         output_is_position_independent.
10214         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10215         output_is_position_independent.
10216         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10217         two_file_pie_test.
10218         (basic_pie_test.o, basic_pie_test): New targets.
10219         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10220         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10221         (two_file_pie_test): New target.
10222         * testsuite/Makefile.in: Rebuild.
10223         * README: Remove note saying that -pie is not supported.
10224
10225 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10226
10227         * options.h (class General_options): Add -init and -fini.
10228         * layout.cc (Layout::finish_dynamic_section): Emit
10229         given init and fini functions.
10230
10231 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10232
10233         * gc.h (gc_process_relocs): Check if icf is enabled using new
10234         function.
10235         * gold.cc (queue_initial_tasks): Likewise.
10236         (queue_middle_tasks): Likewise.
10237         * object.cc (do_layout): Likewise.
10238         * symtab.cc (is_section_folded): Likewise.
10239         * main.cc (main): Likewise.
10240         * reloc.cc (Read_relocs::run): Likewise.
10241         (Sized_relobj::do_scan_relocs): Likewise.
10242         * icf.cc (is_function_ctor_or_dtor): New function.
10243         (Icf::find_identical_sections): Check if function is ctor or dtor when
10244         safe icf is chosen.
10245         * options.h (General_options::icf): Change option to be an enum.
10246         (Icf_status): New enum.
10247         (icf_enabled): New method.
10248         (icf_safe_folding): New method.
10249         (set_icf_status): New method.
10250         (icf_status_): New variable.
10251         * (options.cc) (General_options::finalize): Set icf_status_.
10252         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10253         icf_test and icf_keep_unique_test to use the --icf enum flag.
10254         * testsuite/icf_safe_test.sh: New file.
10255         * testsuite/icf_safe_test.cc: New file.
10256
10257 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10258
10259         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10260         includes to gc.h and icf.h.
10261         * arm.cc: Include gc.h.
10262         * gold.cc: Likewise.
10263         * i386.cc: Likewise.
10264         * powerpc.cc: Likewise.
10265         * sparc.cc: Likewise.
10266         * x86_64.cc: Likewise.
10267         * gc.h: Include icf.h.
10268
10269 2009-10-11  Ian Lance Taylor  <iant@google.com>
10270
10271         * plugin.cc: Include "gold.h" before other header files.
10272
10273 2009-10-10  Chris Demetriou  <cgd@google.com>
10274
10275         * options.h (Input_file_argument::Input_file_type): New enum.
10276         (Input_file_argument::is_lib_): Replace with...
10277         (Input_file_argument::type_): New member.
10278         (Input_file_argument::Input_file_argument): Take Input_file_type
10279         'type' rather than boolean 'is_lib' as second argument.
10280         (Input_file_argument::is_lib): Use type_.
10281         (Input_file_argument::is_searched_file): New function.
10282         (Input_file_argument::may_need_search): Handle is_searched_file.
10283         * options.cc (General_options::parse_library): Support -l:filename.
10284         (General_options::parse_just_symbols): Update for Input_file_argument
10285         changes.
10286         (Command_line::process): Likewise.
10287         * archive.cc (Archive::get_file_and_offset): Likewise.
10288         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10289         * script.cc (read_script_file, script_add_file): Likewise.
10290         * fileread.cc (Input_file::Input_file): Likewise.
10291         (Input_file::will_search_for): Handle is_searched_file.
10292         (Input_file::open): Likewise.
10293         * readsyms.cc (Read_symbols::get_name): Likewise.
10294         * testsuite/Makefile.am (searched_file_test): New test.
10295         * testsuite/Makefile.in: Regenerate.
10296         * testsuite/searched_file_test.cc: New file.
10297         * testsuite/searched_file_test_lib.cc: New file.
10298
10299 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10300             Ian Lance Taylor  <iant@google.com>
10301
10302         * descriptor.cc: Include <cstdio> and "binary-io.h".
10303         (Descriptors::open): Open the files in binary mode always.
10304         * script.cc (Lex::get_token): Treat \r as whitespace.
10305
10306 2009-10-09  Ian Lance Taylor  <iant@google.com>
10307
10308         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10309
10310 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10311             Ian Lance Taylor  <iant@google.com>
10312
10313         * configure.ac: Check for readv function also.
10314         * fileread.cc (readv): Define if not HAVE_READV.
10315         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10316         does not exist.
10317         * config.in: Regenerate.
10318         * configure: Regenerate.
10319
10320 2009-10-09  Doug Kwan  <dougkwan@google.com>
10321
10322         * layout.cc (Layout::make_output_section): Call target hook to make
10323         ordinary output section.
10324         (Layout::finalize): Adjust parameter list of call the
10325         Target::may_relax().
10326         * layout.h (class Layout::section_list): New method.
10327         * merge.h (Output_merge_base::entsize): Change visibility to public.
10328         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10329         New methods.
10330         (Output_merge_string::do_is_string): New method.
10331         * object.cc (Sized_relobj::do_setup): renamed from
10332         Sized_relobj::set_up.
10333         * object.h (Sized_relobj::adjust_shndx,
10334         Sized_relobj::initializ_input_to_output_maps,
10335         Sized_relobj::free_input_to_output_maps): Change visibilities to
10336         protected.
10337         (Sized_relobj::setup): Virtualize.
10338         (Sized_relobj::do_setup): New method declaration.
10339         (Sized_relobj::invalidate_section_offset,
10340         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10341         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10342         * options.cc (parse_int): New function.
10343         * options.h (parse_int): New declaration.
10344         (DEFINE_int): New macro.
10345         (stub_group_size): New option.
10346         * output.cc (Output_section::Output_section): Initialize memebers
10347         merge_section_map_, merge_section_by_properties_map_,
10348         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10349         (Output_section::add_input_section): Handled deferred code-fill
10350         generation and remove an old comment.
10351         (Output_section::add_relaxed_input_section): New method definition.
10352         (Output_section::add_merge_input_section): Use merge section by
10353         properties map to speed to search.  Update merge section maps
10354         as appropriate.
10355         (Output_section::build_relaxation_map): New method definition.
10356         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10357         Same.
10358         (Output_section::relax_input_section): Renamed to
10359         Output_section::convert_input_sections_to_relaxed_sections and change
10360         interface to take a vector of pointers to relaxed sections.
10361         (Output_section::find_merge_section,
10362         Output_section::find_relaxed_input_section): New method definitions.
10363         (Output_section::is_input_address_mapped,
10364         Output_section::output_offset, Output_section::output_address):
10365         Use output section data maps to speed up searching.
10366         (Output_section::find_starting_output_address): Add comments.
10367         (Output_section::do_write,
10368         Output_section::write_to_postprocessing_buffer): Do code-fill
10369         generation as appropriate.
10370         (Output_section::get_input_sections): Invalidate relaxed input section
10371         map.
10372         (Output_section::restore_states): Adjust type of checkpoint .
10373         Invalidate relaxed input section map.
10374         * output.h (Output_merge_base): New class declaration.
10375         (Input_section_specifier): New class defintion.
10376         (class Output_relaxed_input_section) Change base class to
10377         Output_section_data_build.
10378         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10379         base class initializer.
10380         (Output_section::add_relaxed_input_section): New method declaration.
10381         (Output_section::Input_section): Change visibility to protected.
10382         (Output_section::Input_section::relobj,
10383         Output_section::Input_section::shndx): Handle relaxed input sections.
10384         Output_section::input_sections) Change visibility to protected.  Also
10385         define overload to return a non-const pointer.
10386         (Output_section::Merge_section_properties): New class defintion.
10387         (Output_section::Merge_section_by_properties_map,
10388         Output_section::Output_section_data_by_input_section_map,
10389         Output_section::Relaxation_map): New types.
10390         (Output_section::relax_input_section): Rename method to
10391         Output_section::convert_input_sections_to_relaxed_sections and change
10392         interface to take a vector of relaxed section pointers.
10393         (Output_section::find_merge_section,
10394         Output_section::find_relaxed_input_section,
10395         Output_section::build_relaxation_map,
10396         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10397         New method declarations.
10398         (Output_section::merge_section_map_
10399         Output_section::merge_section_by_properties_map_,
10400         Output_section::relaxed_input_section_map_,
10401         Output_section::is_relaxed_input_section_map_valid_,
10402         Output_section::generate_code_fills_at_write_): New data members.
10403         * script-sections.cc
10404         (Output_section_element_input::set_section_addresses): Call
10405         current_data_size and addralign methods of relaxed input sections.
10406         (Orphan_output_section::set_section_addresses): Call current_data_size
10407         and addralign methods of relaxed input sections.
10408         * symtab.cc (Symbol_table::compute_final_value): Extract template
10409         from the body of Symbol_table::sized_finalize_symbol.
10410         (Symbol_table::sized_finalized_symbol): Call
10411         Symbol_table::compute_final_value.
10412         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10413         (Symbol_table::compute_final_value): New templated method declaration.
10414         * target.cc (Target::do_make_output_section): New method defintion.
10415         * target.h (Target::make_output_section): New method declaration.
10416         (Target::relax): Add more parameters for input objects, symbol table
10417         and layout.  Adjust call to do_relax.
10418         (Target::do_make_output_section): New method declaration.
10419         (Target::do_relax): Add parameters for input objects, symbol table
10420         and layout.
10421
10422 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10423
10424         * pread.c: Include stdio.h.
10425
10426 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10427
10428         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10429         defined.
10430
10431 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10432
10433         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10434         Change read_shndx type to unsigned int.
10435         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10436         int.
10437         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10438         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10439         Change read_shndx type to unsigned int.
10440         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10441         int.
10442         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10443         * layout.cc (Layout::create_symtab_sections): Cast the result of
10444         local_symcount * symsize to off_t in the gold_assert.
10445
10446 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10447
10448         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10449         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10450         R_ARM_BASE_ABS.
10451         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10452         (Arm_relocate_functions::thm_abs5): New function.
10453         (Arm_relocate_functions::abs12): New function.
10454         (Arm_relocate_functions::abs16): New function.
10455         (Arm_relocate_functions::base_abs): New function.
10456         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10457         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10458         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10459         R_ARM_BASE_ABS.
10460         (Scan::global): Likewise.
10461         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10462         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10463         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10464         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10465         R_ARM_BASE_ABS.
10466
10467 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10468
10469         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10470         (Arm_relocate_functions::movt_prel): New function.
10471         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10472         (Arm_relocate_functions::thm_movt_prel): New function.
10473         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10474         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10475         (Scan::global, Relocate::relocate): Likewise.
10476         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10477
10478 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10479
10480         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10481         Incremental_checker.
10482         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10483         unsigned int.
10484         (class Incremental_inputs_header): New class.
10485         (Incremental_inputs_header_writer): Edit comment.
10486         (Incremental_inputs_entry): New class.
10487         (Incremental_inputs_entry_writer): Edit comment.
10488         (Sized_incremental_binary::do_find_incremental_inputs_section):
10489         Add *strtab_shndx parameter, fill it.
10490         (Sized_incremental_binary::do_check_inputs): New method.
10491         (Incremental_checker::can_incrementally_link_output_file): Use
10492         Sized_incremental_binary::check_inputs.
10493         (Incremental_inputs::report_command_line): Save command line in
10494         command_line_.
10495         * incremental.h:
10496         (Incremental_binary::find_incremental_inputs_section): New
10497         method.
10498         (Incremental_binary::do_find_incremental_inputs_section): Add
10499         strtab_shndx parameter.
10500         (Incremental_binary::do_check_inputs): New pure virtual method.
10501         (Sized_incremental_binary::do_check_inputs): Declare.
10502         (Incremental_checker::Incremental_checker): Add incremental_inputs
10503         parameter, use it to initialize incremental_inputs_.
10504         (Incremental_checker::incremental_inputs_): New field.
10505         (Incremental_checker::command_line): New method.
10506         (Incremental_checker::inputs): New method.
10507         (Incremental_checker::command_line_): New field.
10508
10509 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10510
10511         * incremental.cc: Include <cstdarg> and "target-select.h".
10512         (vexplain_no_incremental): New function.
10513         (explain_no_incremental): New function.
10514         (Incremental_binary::error): New method.
10515         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10516         method.
10517         (make_sized_incremental_binary): New function.
10518         (open_incremental_binary): New function.
10519         (can_incrementally_link_file): Add checks if output is ELF and has
10520         inputs section.
10521         * incremental.h: Include "elfcpp_file.h" and "output.h".
10522         (Incremental_binary): New class.
10523         (Sized_incremental_binary): New class.
10524         (open_incremental_binary): Declare.
10525         * object.cc (is_elf_object): Use
10526         elfcpp::Elf_recognizer::is_elf_file.
10527         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10528         * output.h (Output_file::filesize): New method.
10529
10530 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10531
10532         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10533         New function.
10534         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10535         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10536         function.
10537         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10538         function.
10539         (Arm_relocate_functions::movw_abs_nc): New function.
10540         (Arm_relocate_functions::movt_abs): New function.
10541         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10542         (Arm_relocate_functions::thm_movt_abs): New function.
10543         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10544         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10545         (Scan::global): Likewise.
10546         (Relocate::relocate): Likewise.
10547         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10548
10549 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10550
10551         * arm.cc (Arm_relocate_functions::got_prel) New function.
10552         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10553         (Relocate::relocate): Likewise.
10554         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10555
10556 2009-10-06  Ian Lance Taylor  <iant@google.com>
10557
10558         * options.h (class General_options): Define
10559         split_stack_adjust_size parameter.
10560         * object.h (class Object): Add uses_split_stack_ and
10561         has_no_split_stack_ fields.  Add uses_split_stack and
10562         has_no_split_stack accessor functions.  Declare
10563         handle_split_stack_section.
10564         (class Reloc_symbol_changes): Define.
10565         (class Sized_relobj): Define Function_offsets.  Declare
10566         split_stack_adjust, split_stack_adjust_reltype, and
10567         find_functions.
10568         * object.cc (Object::handle_split_stack_section): New function.
10569         (Sized_relobj::do_layout): Call handle_split_stack_section.
10570         * dynobj.cc (Sized_dynobj::do_layout): Call
10571         handle_split_stack_section.
10572         * reloc.cc (Sized_relobj::relocate_sections): Call
10573         split_stack_adjust for executable sections in split_stack
10574         objects.  Pass reloc_map to relocate_section.
10575         (Sized_relobj::split_stack_adjust): New function.
10576         (Sized_relobj::split_stack_adjust_reltype): New function.
10577         (Sized_relobj::find_functions): New function.
10578         * target-reloc.h: Include "object.h".
10579         (relocate_section): Add reloc_symbol_changes parameter.  Change
10580         all callers.
10581         * target.h (class Target): Add calls_non_split method.  Declare
10582         do_calls_non_split virtual method.  Declare match_view and
10583         set_view_to_nop.
10584         * target.cc: Include "elfcpp.h".
10585         (Target::do_calls_non_split): New function.
10586         (Target::match_view): New function.
10587         (Target::set_view_to_nop): New function.
10588         * gold.cc (queue_middle_tasks): Give an error if mixing
10589         split-stack and non-split-stack objects with -r.
10590         * i386.cc (Target_i386::relocate_section): Add
10591         reloc_symbol_changes parameter.
10592         (Target_i386::do_calls_non_split): New function.
10593         * x86_64.cc (Target_x86_64::relocate_section): Add
10594         reloc_symbol_changes parameter.
10595         (Target_x86_64::do_calls_non_split): New function.
10596         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10597         parameter.
10598         * powerpc.cc (Target_powerpc::relocate_section): Add
10599         reloc_symbol_changes parameter.
10600         * sparc.cc (Target_sparc::relocate_section): Add
10601         reloc_symbol_changes parameter.
10602         * configure.ac: Call AM_CONDITIONAL for the default target.
10603         * configure: Rebuild.
10604         * testsuite/Makefile.am (TEST_AS): New variable.
10605         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10606         (check_DATA): Add split_i386 and split_x86_64 files.
10607         (SPLIT_DEFSYMS): Define.
10608         (split_i386_[1234n].o): New targets.
10609         (split_i386_[124]): New targets.
10610         (split_i386_[1234r].stdout): New targets.
10611         (split_x86_64_[1234n].o): New targets.
10612         (split_x86_64_[124]): New targets.
10613         (split_x86_64_[1234r].stdout): New targets.
10614         (MOSTLYCLEANFILES): Add new executables.
10615         * testsuite/split_i386.sh: New file.
10616         * testsuite/split_x86_64.sh: New file.
10617         * testsuite/split_i386_1.s: New file.
10618         * testsuite/split_i386_2.s: New file.
10619         * testsuite/split_i386_3.s: New file.
10620         * testsuite/split_i386_4.s: New file.
10621         * testsuite/split_i386_n.s: New file.
10622         * testsuite/split_x86_64_1.s: New file.
10623         * testsuite/split_x86_64_2.s: New file.
10624         * testsuite/split_x86_64_3.s: New file.
10625         * testsuite/split_x86_64_4.s: New file.
10626         * testsuite/split_x86_64_n.s: New file.
10627         * testsuite/testfile.cc (Target_test): Update relocation_section
10628         function.
10629         * testsuite/Makefile.in: Rebuild.
10630
10631 2009-10-06  Ian Lance Taylor  <iant@google.com>
10632
10633         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10634         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10635         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10636         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10637         the address on ldo_addrs_.
10638         (Target_i386::Relocate::fix_up_ldo): New function.
10639
10640 2009-10-06   Rafael Espindola  <espindola@google.com>
10641
10642         * plugin.cc (add_input_library): New.
10643         (Plugin::load): Add add_input_library to tv.
10644         (Plugin_manager::add_input_file): Add the is_lib argument.
10645         (add_input_file): Update call to Plugin_manager::add_input_file.
10646         (add_input_library): New.
10647         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10648
10649 2009-09-30  Doug Kwan  <dougkwan@google.com>
10650
10651         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10652         symbol and call Symbol::may_need_copy_reloc to determine if
10653         a copy reloc is needed.
10654         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10655         nocopyreloc is given in command line.
10656         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10657         given in command line.
10658         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10659         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10660         of the removed Target_i386::may_need_copy_reloc.
10661         * options.h (copyreloc): New option with default value false.
10662         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10663         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10664         instead of the removed Target_powerpc::may_need_copy_reloc.
10665         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10666         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10667         instead of the removed Target_sparc::may_need_copy_reloc.
10668         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10669         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10670         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10671         instead of the removed Target_x86_64::may_need_copy_reloc.
10672
10673 2009-09-30  Ian Lance Taylor  <iant@google.com>
10674
10675         * object.h (class Object): Remove target_ field, and target,
10676         sized_target, and set_target methods.
10677         (Object::sized_target): Remove.
10678         (class Sized_relobj): Update declarations.  Remove sized_target.
10679         * object.cc (Sized_relobj::setup): Remove target parameter.
10680         Change all callers.
10681         (Input_objects::add_object): Don't do anything with the target.
10682         (make_elf_sized_object): Add punconfigured parameter.  Change all
10683         callers.  Set or test parameter target.
10684         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10685         Change all callers.
10686         * parameters.cc (Parameters::set_target): Change parameter type to
10687         be non-const.
10688         (Parameters::default_target): Remove.
10689         (set_parameters_target): Change parameter type to be non-const.
10690         (parameters_force_valid_target): New function.
10691         (parameters_clear_target): New function.
10692         * parameters.h (class Parameters): Update declarations.  Remove
10693         default_target method.  Add sized_target and clear_target
10694         methods.  Change target_ to be non-const.
10695         (set_parameters_target): Update declaration.
10696         (parameters_force_valid_target): Declare.
10697         (parameters_clear_target): Declare.
10698         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10699         as NULL if we aren't searching.
10700         (Add_symbols::run): Don't check for compatible target.
10701         * fileread.cc (Input_file::open_binary): Call
10702         parameters_force_valid_target.
10703         * gold.cc (queue_middle_tasks): Likewise.
10704         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10705         set_target on object.
10706         * dynobj.h (class Sized_dynobj): Update declarations.
10707         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10708         make_elf_object returns NULL.
10709         (Archive::include_member): Don't check whether object target is
10710         compatible.
10711         * output.cc (Output_section::add_input_section): Get target from
10712         parameters.
10713         (Output_section::relax_input_section): Likewise.
10714         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10715         parameters.
10716         (Sized_relobj::do_scan_relocs): Likewise.
10717         (Sized_relobj::relocate_sections): Likewise.
10718         * resolve.cc (Symbol_table::resolve): Likewise.
10719         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10720         parameter.  Change all callers.
10721         (Symbol_table::add_from_object): Get target from parameters.
10722         (Symbol_table::add_from_relobj): Don't check object target.
10723         (Symbol_table::add_from_dynobj): Likewise.
10724         (Symbol_table::define_special_symbol): Get target from
10725         parameters.
10726         * symtab.h (class Symbol_table): Update declaration.
10727         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10728         parameter.  Change all callers.  Clear parameter target.
10729         (Binary_test): Test target here.
10730         * testsuite/object_unittest.cc (gold_testsuite): Remove
10731         target_test_pointer parameter.  Change all callers.
10732         (Object_test): Test target here.
10733
10734 2009-09-26  Ian Lance Taylor  <iant@google.com>
10735
10736         * testsuite/initpri1.c: Don't try to use constructor priorities if
10737         compiling with gcc before 4.3.
10738
10739 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10740
10741         * testsuite/retain_symbols_file_test.sh (check_present): Change
10742         output file name to retain_symbols_file_test.stdout.
10743         (check_absent): Likewise.
10744
10745 2009-09-18  Craig Silverstein  <csilvers@google.com>
10746
10747         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10748         * options.cc: Include <cerrno> and <fstream>.
10749         (General_options::finalize): Parse -retain-symbols-file tag.
10750         * options.h: New flag.
10751         (General_options): New method should_retain_symbol, new
10752         variable symbols_to_retain.
10753         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10754         should_retain_symbol map.
10755         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10756         * testsuite/Makefile.in: Regenerate.
10757         * testsuite/retain_symbols_file_test.sh: New file.
10758
10759 2009-09-18  Nick Clifton  <nickc@redhat.com>
10760
10761         * po/es.po: Updated Spanish translation.
10762
10763 2009-09-17  Doug Kwan  <dougkwan@google.com>
10764
10765         * debug.h (DEBUG_RELAXATION): New constant.
10766         (DEBUG_ALL): Add DEBUG_RELAXATION.
10767         (debug_string_to_enum): Add relaxation debug option.
10768         * layout.cc
10769         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10770         Layout::Relaxation_debug_check::read_sections,
10771         Layout::Relaxation_debug_check::read_sections): New method definitions.
10772         (Layout::Layout): Initialize data members
10773         record_output_section_data_from_scrips_,
10774         script_output_section_data_list_ and relaxation_debug_check_.
10775         (Layout::save_segments, Layout::restore_segments,
10776         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10777         Layout::relaxation_loop_body): New method definitions.
10778         (Layout::finalize): Support relaxation.  Move section layout code to
10779         Layout::relaxation_loop_body.
10780         (Layout::set_asection_address_from_script): Move code for orphan
10781         section placement out.
10782         (Layout::place_orphan_sections_in_script): New method definition.
10783         * layout.h (Output_segment_headers, Output_file_header):
10784         New forward class declarations.
10785         (Layout::~Layout): Define.
10786         (Layout::new_output_section_data_from_script): New method definition.
10787         (Layout::place_orphan_sections_in_script): New method declaration.
10788         (Layout::Segment_states): New type declaration.
10789         (Layout::save_segments, Layout::restore_segments,
10790         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10791         Layout::relaxation_loop_body): New method declarations.
10792         (Layout::Output_section_data_list): New type declaration.
10793         (Layout::Relaxation_debug_check): New class definition.
10794         (Layout::record_output_section_data_from_script_,
10795         Layout::script_output_section_data_list_, Layout::segment_states_,
10796         Layout::relaxation_debug_check_): New data members.
10797         * output.cc: (Output_section_headers::do_size): New method definition.
10798         (Output_section_headers::Output_section_headers): Move size
10799         computation to Output_section_headers::do_size.
10800         (Output_segment_headers::do_size): New method definition.
10801         (Output_file_header::Output_file_header): Move size computation to
10802         Output_file_header::do_size and call it.
10803         (Output_file_header::do_size): New method definition.
10804         (Output_data_group::Output_data_group): Adjust call to
10805         Output_section_data.
10806         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10807         (Output_symtab_xindex::do_write): Add array bound check.
10808         (Output_section::Input_section::print_to_mapfile): Handle
10809         RELAXED_INPUT_SECTION_CODE.
10810         (Output_section::Output_section): Initialize data member checkpoint_.
10811         (Output_section::~Output_section): Delete checkpoint object pointed
10812         by checkpoint_.
10813         (Output_section::add_input_section): Always add an Input_section if
10814         relaxing.
10815         (Output_section::add_merge_input_section): Add assert.
10816         (Output_section::relax_input_section): New method definition.
10817         (Output_section::set_final_data_size): Set load address to zero for
10818         an unallocated section.
10819         (Output_section::do_address_and_file_offset_have_reset_values):
10820         New method definition.
10821         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10822         Handle relaxed input section.
10823         (Output_section::sort_attached_input_sections): Checkpoint input
10824         section list lazily.
10825         (Output_section::get_input_sections): Change type of input_sections to
10826         list of Simple_input_section pointers.  Checkpoint input section list
10827         lazily.  Also handle relaxed input sections.
10828         (Output_section::add_input_section_for_script): Take a reference to
10829         a Simple_input_section object instead of Relobj pointer and section
10830         index as parameter.  Handle relaxed input sections.
10831         (Output_section::save_states, Output_section::restore_states): New
10832         method definitions.
10833         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10834         (Output_data::is_data_size_fixed): New method definition.
10835         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10836         if it is fixed.
10837         (Output_data::address_and_file_offset_have_reset_values): New method
10838         definition.
10839         (Output_data::do_address_and_file_offset_have_reset_values): New method
10840         definition.
10841         (Output_data::set_data_size): Check that data size is not fixed.
10842         (Output_data::fix_data_size): New method definition.
10843         (Output_data::is_data_size_fixed_): New data member.
10844         (Output_section_headers::set_final_data_size): New method definition.
10845         (Output_section_headers::do_size): New method declaration.
10846         (Output_segment_headers::set_final_data_size): New method definition.
10847         (Output_segment_headers::do_size): New method declaration.
10848         (Output_file_header::set_final_data_size)::New method definition.
10849         (Output_file_header::do_size)::New method declaration.
10850         (Output_section_data::Output_section_data): Add new parameter
10851         is_data_size_fixed and use it to fix data size.
10852         (Output_data_const::Output_data_const): Adjust call to base class
10853         constructor and fix data size.
10854         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10855         base class constructor and fix data size.
10856         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10857         base class constructor and fix data size.
10858         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10859         class constructor and fix data size.
10860         (Output_data_group::set_final_data_size): New method definition.
10861         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10862         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10863         class constructor and fix data size.
10864         (Output_relaxed_input_section): New class definition.
10865         (Output_section::Simple_input_section): New class definition.
10866         (Output_section::get_input_sections): Adjust parameter list.
10867         (Output_section::add_input_section_for_script): Same.
10868         (Output_section::save_states, Output_section::restore_states,
10869         Output_section::do_address_and_file_offset_have_reset_values,
10870         (Output_section::Input_section::Input_section): Handle
10871         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10872         Output_relaxed_input_section.
10873         (Output_section::Input_section::is_input_section,
10874         Output_section::Input_section::set_output_section): Handle relaxed
10875         input section.
10876         (Output_section::Input_section::is_relaxed_input_section,
10877         Output_section::Input_section::output_section_data,
10878         Output_section::Input_section::relaxed_input_section): New method
10879         definitions.
10880         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10881         value.
10882         (Output_section::Input_section::u1_): Update comments.
10883         (Output_section::Input_section::u2_): Add new union member poris.
10884         (Output_section::Checkpoint_output_section): New classs definition.
10885         (Output_section::relax_input_section): New method declaration.
10886         (Output_section::checkpoint_): New data member.
10887         (Output_segment): Update comments.
10888         (Output_segment::Output_segment): Un-privatize copy constructor.
10889         (Output_segment::operator=): Un-privatize.
10890         * script-sections.cc (Output_section_element::Input_section_list):
10891         Change element type to Output_section::Simple_input_section.
10892         (Output_section_element_dot_assignment::set_section_addresses):
10893         Register output section data for relaxation clean up.
10894         (Output_data_exression::Output_data_expression): Adjust call to base
10895         constructor to fix data size.
10896         (Output_section_element_data::set_section_addresses): Register
10897         Output_data_expression object for relaxation clean up.
10898         (struct Input_section_info): Replace Relobj pointer and section index
10899         pair with Output_section::Simple_input_section and Convert struct to a
10900         class.
10901         (Input_section_sorter::operator()): Adjust access to
10902         Input_section_info data member to use accessors.
10903         (Output_section_element_input::set_section_addresses): Use layout
10904         parameter.  Adjust code to use Output_section::Simple_input_section
10905         and Input_secction_info classes.  Register filler for relaxation
10906         clean up.
10907         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10908         and section index pair with Output_section::Simple_input_section
10909         class.  Adjust code accordingly.
10910         (Phdrs_element::release_segment): New method definition.
10911         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10912         segment list.
10913         (Script_sections::release_segments): New method definition.
10914         * gold/script-sections.h (Script_sections::release_segments): New
10915         method declaration.
10916         * gold/target.h (Target::may_relax, Target::relax,
10917         Target::do_may_relax, Target::do_relax): New method definitions.
10918
10919 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10920
10921         * arm.cc (has_signed_unsigned_overflow): New function.
10922         (Arm_relocate_functions::abs8): New function.
10923         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10924         (Target_arm::Scan::global): Likewise.
10925         (Target_arm::relocate::relocate): Likewise.
10926         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10927         Likewise.
10928
10929 2009-09-16  Cary Coutant  <ccoutant@google.com>
10930
10931         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10932         * testsuite/Makefile.in: Regenerate.
10933
10934 2009-09-11  Nick Clifton  <nickc@redhat.com>
10935
10936         * po/gold.pot: Updated by the Translation project.
10937
10938 2009-09-08  Cary Coutant  <ccoutant@google.com>
10939
10940         * output.cc (Output_file::open): Add execute permission to empty file.
10941         * testsuite/Makefile.am (permission_test): New test.
10942         * testsuite/Makefile.in: Regenerate.
10943
10944 2009-09-02  Ian Lance Taylor  <iant@google.com>
10945
10946         * output.cc (Output_file::resize): Call map_no_anonymous rather
10947         than map.
10948
10949 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10950
10951         * gold.cc: Include "incremental.h".
10952         (queue_initial_tasks): Call Incremental_checker methods.
10953         * incremental.cc: Include "output.h".
10954         (Incremental_checker::can_incrementally_link_output_file): New
10955         method.
10956         * incremental.h (Incremental_checker): New class.
10957
10958         * output.cc (Output_file::open_for_modification): New method.
10959         (Output_file::map_anonymous): Changed return type to bool.  Record
10960         map in base_ field.
10961         (Output_file::map_no_anonymous): New method, broken out of map.
10962         (Output_file::map): Use map_no_anonymous and map_anonymous.
10963         * output.h (class Output_file): Update declarations.
10964
10965 2009-08-24  Cary Coutant  <ccoutant@google.com>
10966
10967         * options.h (Command_line::Pre_options): New class.
10968         (Command_line::pre_options): New member.
10969         * options.cc (gold::options::ready_to_register): New variable.
10970         (One_option::register_option): Do nothing if not registering options.
10971         Assert if same short option registered twice.
10972         (General_options::General_options): Turn off option registration when
10973         done constructing.
10974         (Command_line::Pre_options::Pre_options): New constructor.
10975
10976 2009-08-24  Cary Coutant  <ccoutant@google.com>
10977
10978         * options.h (General_options::no_keep_memory): Remove incorrect
10979         short option.
10980
10981 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10982
10983         * Makefile.am (am__skiplex, am__skipyacc): New.
10984         * Makefile.in: Regenerate.
10985
10986 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10987
10988         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10989         (INCLUDES): ... this.
10990         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10991         (AM_CPPFLAGS): Renamed from ...
10992         (INCLUDE): ... this.
10993         * Makefile.in, testsuite/Makefile.in: Regenerate.
10994
10995         * Makefile.in: Regenerate.
10996         * aclocal.m4: Likewise.
10997         * config.in: Likewise.
10998         * configure: Likewise.
10999         * testsuite/Makefile.in: Likewise.
11000
11001         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11002         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11003         * Makefile.in: Regenerate.
11004         * testsuite/Makefile.in: Regenerate.
11005
11006 2009-08-19  Cary Coutant  <ccoutant@google.com>
11007
11008         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11009         symbols in shared libraries overridden by hidden or internal symbols
11010         in the main program.
11011
11012 2009-08-19  Chris Demetriou  <cgd@google.com>
11013
11014         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11015         checking source file names in error messages.
11016
11017 2009-08-18  Doug Kwan  <dougkwan@google.com>
11018
11019         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11020         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11021         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11022         an elfcpp::Ehdr as parameter.
11023         * object.cc (Object::set_target): Remove the version that looks up
11024         a target and sets it.
11025         (Sized_relobj::setup): Take a Target object instead of
11026         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11027         (make_elf_sized_object): Find target and ask target to
11028         make an ELF object.
11029         * object.h: (Object::set_target): Remove the version that looks up
11030         a target and sets it.
11031         (Sized_relobj::setup): Take a Target object instead of
11032         an elfcpp:Ehdr as parameter.
11033         * target.cc: Include dynobj.h.
11034         (Target::do_make_elf_object_implementation): New.
11035         (Target::do_make_elf_object): New.
11036         * target.h (Target::make_elf_object): New template declaration.
11037         (Target::do_make_elf_object): New method declarations.
11038         (Target::do_make_elf_object_implementation): New template declaration.
11039
11040 2009-08-14  Ian Lance Taylor  <iant@google.com>
11041
11042         * gold.h (FUNCTION_NAME): Define.
11043         (gold_unreachable): Use FUNCTION_NAME.
11044
11045 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11046
11047         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11048         symbol in the --keep-unique list is not found.
11049
11050 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11051
11052         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11053         been maked as --keep-unique.
11054         (Icf::unfold_section): New function.
11055         * icf.h (Icf::unfold_section): New function.
11056         * options.h (General_options::keep_unique): New option.
11057         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11058         * testsuite/Makefile.in: Regenerate.
11059         * testsuite/icf_keep_unique_test.sh: New file.
11060         * testsuite/icf_keep_unique_test.cc: New file.
11061
11062 2009-08-12  Cary Coutant  <ccoutant@google.com>
11063
11064         PR 10471
11065         * resolve.cc (Symbol_table::resolve): Check for references from
11066         dynamic objects to hidden and internal symbols.
11067         * testsuite/Makefile.am (hidden_test.sh): New test.
11068         * testsuite/Makefile.in: Regenerate.
11069         * testsuite/hidden_test.sh: New script.
11070         * testsuite/hidden_test_1.c: New test source.
11071         * testsuite/hidden_test_main.c: New test source.
11072
11073 2009-08-11  Doug Kwan  <dougkwan@google.com>
11074
11075         * arm.cc: Update comments.
11076         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11077         segment to locate the .ARM.exidx section if present.
11078
11079 2009-08-09  Doug Kwan  <dougkwan@google.com>
11080
11081         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11082         patch.
11083
11084 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11085         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11086         compiler warnings.
11087
11088 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11089
11090         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11091         valid tls_segment only for non-debug-section relocations.
11092         * testsuite/Makefile.am: Add gc_tls_test.
11093         * testsuite/Makefile.in: Regenerate.
11094         * testsuite/gc_tls_test.cc: New file.
11095         * testsuite/gc_tls_test.sh: New file.
11096
11097 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11098
11099         * icf.cc: New file.
11100         * icf.h: New file.
11101         * Makefile.am (CCFILES): Add icf.cc.
11102         (HFILES): Add icf.h
11103         * Makefile.in: Regenerate.
11104         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11105         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11106         section, symbol and addend information for the relocs.
11107         * gold.cc (queue_middle_tasks): Call identical code folding.
11108         * gold.h: Add defines for multimap.
11109         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11110         to the call of finalize_local_symbols.
11111         * main.cc (main): Create object of class Icf.
11112         * object.cc (Sized_relobj::do_layout): Allow this function to be
11113         called twice during icf.
11114         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11115         to sections marked as identical by icf.
11116         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11117         when available.
11118         (Sized_relobj::do_section_entsize): New function.
11119         * object.h (Object::section_entsize): New function.
11120         (Object::do_section_entsize): New pure virtual function.
11121         (Relobj::finalize_local_symbols): Add new parameter.
11122         (Relobj::do_section_entsize): New function.
11123         * options.h (General_options::icf): New option.
11124         (General_options::icf_iterations): New option.
11125         (General_options::print_icf_sections): New option.
11126         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11127         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11128         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11129         icf.
11130         * symtab.cc (Symbol_table::is_section_folded): New function.
11131         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11132         to sections marked as identical by icf.
11133         * symtab.h (Symbol_table::set_icf): New function.
11134         (Symbol_table::icf): New function.
11135         (Symbol_table::is_section_folded): New function.
11136         (Symbol_table::icf_): New data member.
11137         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11138         * testsuite/Makefile.am: Add commands to build icf_test.
11139         * testsuite/Makefile.in: Regenerate.
11140         * testsuite/icf_test.sh: New file.
11141         * testsuite/icf_test.cc: New file.
11142
11143 2009-07-24  Chris Demetriou  <cgd@google.com>
11144
11145         * layout.cc (is_compressible_debug_section): Fix incorrect
11146         comment about compressed section names.
11147
11148 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11149
11150         PR 10419
11151         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11152
11153 2009-07-16  Ian Lance Taylor  <iant@google.com>
11154
11155         PR 10400
11156         * layout.h: #include <map>.
11157         (class Kept_section): Change from struct to class.  Add accessors
11158         and setters.  Add section size to Comdat_group mapping.  Change
11159         Comdat_group to std::map.  Add is_comdat_ field.  Add
11160         linkonce_size field in union.
11161         (class Layout): Update declaration of find_or_add_kept_section.
11162         Don't declare find_kept_object.
11163         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11164         parameter.  Add object, shndx, is_comdat, and is_group_name
11165         parameters.  Change all callers.  Adjust for new Kept_section.
11166         (Layout::find_kept_object): Remove.
11167         * object.cc (Sized_relobj::include_section_group): Update use of
11168         Kept_section.  Rename secnum to shndx.  Only record
11169         Kept_comdat_section if sections are the same size.
11170         (Sized_relobj::include_linkonce_section): Update use of
11171         Kept_section.  Only record Kept_comdat_section if sections are the
11172         same size.  Set size of linkonce section.
11173         (Sized_relobj::map_to_kept_section): Update call to
11174         get_kept_comdat_section.
11175         * object.h (class Sized_relobj): Rename fields in
11176         Kept_comdat_section to drop trailing underscores; change object
11177         field to Relobj*.  Change Kept_comdat_section_table to store
11178         struct rather than pointer.
11179         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11180         Add kept_object and kept_shndx parameters.  Change all callers.
11181         (Sized_relobj::get_kept_comdat_section): Change return type to
11182         bool.  Add kept_object and kept_shndx parameters.  Change all
11183         callers.
11184         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11185         Layout::find_or_add_kept_section.
11186
11187 2009-07-09  Ian Lance Taylor  <iant@google.com>
11188
11189         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11190         Reserve space in the hash table.
11191
11192 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11193
11194         * fileread.cc (File_read::get_mtime): New method.
11195         * fileread.h (Timespec): New structure.
11196         (File_read::get_mtime): New method.
11197         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11198         Renamed from timestamp_nsec.
11199         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11200         Elf_Xword.
11201         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11202         timestamp_nsec.
11203         (Incremental_inputs::report_archive): Save mtime; style fix.
11204         (Incremental_inputs::report_obejct): Save mtime; style fix.
11205         (Incremental_inputs::report_script): Save mtime; style fix.
11206         (Incremental_inputs::finalize_inputs): Style fix.
11207         (Incremental_inputs::finalize): Style fix.
11208         (Incremental_inputs::create_input_section_data): Store inputs
11209         mtime.
11210         * incremental.h (Incremental_inputs::report_script): Add mtime
11211         argument.
11212         (Incremental_inputs::Input_info::Input_info): Intialize only one
11213         union member.
11214         (Incremental_inputs::Input_info::archive): Move to nameless
11215         union.
11216         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11217         (Incremental_inputs::Input_info::script): Move to nameless union.
11218         (Incremental_inputs::mtime): New field.
11219         * script.cc (read_input_script): Pass file mtime to
11220         Incremental_input.
11221         * script.h (Script_info::inputs): Style fix.
11222
11223 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11224
11225         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11226         instead of 32.
11227
11228 2009-06-24  Ian Lance Taylor  <iant@google.com>
11229
11230         PR 10156
11231         * layout.cc (Layout::choose_output_section): If we find an
11232         existing section, update the flags.
11233         (Layout::create_notes): New function, broken out of
11234         Layout::finalize.
11235         (Layout::finalize): Don't create note sections.
11236         (Layout::create_note): Don't crash if linker script discards
11237         section.
11238         (Layout::create_gold_note): Likewise.
11239         (Layout::create_build_id): Likewise.  Don't set
11240         after_input_sections on the section.
11241         (Layout::create_executable_stack_info): Remove target parameter.
11242         Change caller.
11243         * layout.h (class Layout): Declare create_notes.  Update
11244         declaration of create_executable_stack_info.
11245         * gold.cc (queue_middle_tasks): Call create_notes.
11246         * output.cc (Output_section::update_flags_for_input_section): Move
11247         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11248         invalid.
11249         * output.h (Output_data::mark_address_invalid): New function.
11250         (class Output_section): Only declare, not define,
11251         update_flags_for_input_section.  Remove set_flags.
11252
11253 2009-06-24  Ian Lance Taylor  <iant@google.com>
11254
11255         * script-sections.cc (Output_section_definition::
11256         set_section_addresses): Rename shadowing local load_address to
11257         laddr.
11258
11259 2009-06-24  Ian Lance Taylor  <iant@google.com>
11260
11261         PR 10244
11262         * reloc.cc (relocate_sections): Skip empty relocation sections.
11263
11264 2009-06-23  Ian Lance Taylor  <iant@google.com>
11265
11266         PR 10156
11267         * layout.cc (Layout::create_note): Use choose_output_section
11268         rather than make_output_section.
11269
11270 2009-06-23  Ian Lance Taylor  <iant@google.com>
11271
11272         PR 10237
11273         * options.cc (General_options::parse_V): Set printed_version_.
11274         (General_options::General_options): Initialize printed_version_.
11275         * options.h (class General_options): Add printed_version_ field.
11276         * gold.cc (queue_initial_tasks): If there are no input files,
11277         don't give a fatal error if we printed the version information.
11278         (queue_middle_tasks): If using -r with a shared object, give a
11279         fatal error rather than an ordinary error.
11280
11281 2009-06-23  Ian Lance Taylor  <iant@google.com>
11282
11283         PR 10219
11284         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11285         (Layout::make_output_section): Set have_stabstr_section_ if we see
11286         a .stab*str section.
11287         (Layout::finalize): Call link_stabs_sections.
11288         (Layout::link_stabs_sections): New file.
11289         * layout.h (class Layout): Add have_stabstr_section_ field.
11290         Declare link_stabs_sections.
11291
11292 2009-06-23  Doug Kwan  <dougkwan@google.com>
11293
11294         * Makefile.am (libgold_a_LIBADD): New.
11295         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11296         * Makefile.in: Regenerate.
11297         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11298         * configure: Regenerate.
11299         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11300         * fileread.cc: Include sys/state.h
11301         * gold.h: Declare memmem and strndup if found missing.
11302         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11303
11304 2009-06-23  Ian Lance Taylor  <iant@google.com>
11305
11306         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11307         * configure: Rebuild.
11308
11309 2009-06-23  Ian Lance Taylor  <iant@google.com>
11310
11311         PR 10147
11312         * object.cc (Object::section_contents): Don't try to get a view if
11313         the section has length zero.
11314         (Object::handle_gnu_warning_section): If the section is empty, use
11315         the name of the section as the warning.
11316
11317 2009-06-23  Ian Lance Taylor  <iant@google.com>
11318
11319         PR 10133
11320         * stringpool.h (class Stringpool_template): Add optimize_ field.
11321         (Stringpool_template::set_optimize): New function.
11322         * stringpool.cc (Stringpool_template::Stringpool_template):
11323         Initialize optimize_ field.
11324         (Stringpool_template::set_string_offsets): Test local optimize
11325         fild rather than parameter.
11326         * layout.cc (Layout::Layout): Call set_optimize on the section
11327         name stringpool.
11328
11329 2009-06-22  Ian Lance Taylor  <iant@google.com>
11330
11331         PR 10030
11332         * yyscript.y: Parse TARGET.
11333         * script.cc (script_set_target): New function.
11334         * script-c.h (script_set_target): Declare.
11335         * options.cc (General_options::string_to_object_format): Rename
11336         from string_to_object_format in anonymous namespace.  Change
11337         callers.
11338         * options.h (class General_options): Declare
11339         string_to_object_format.
11340
11341 2009-06-22  Ian Lance Taylor  <iant@google.com>
11342
11343         * script-sections.cc (Script_sections::create_segments): Don't put
11344         program headers in a PT_LOAD segment if -n or -N.
11345
11346 2009-06-22  Ian Lance Taylor  <iant@google.com>
11347
11348         PR 10141
11349         * options.h (class General_options): Add -z lazy and -z now.  Sort
11350         -z options into alphabetical order.
11351         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11352
11353 2009-06-21  Ian Lance Taylor  <iant@google.com>
11354
11355         * layout.cc (Layout::make_output_section): Call
11356         Target::new_output_section.
11357         (Layout::attach_allocated_section_to_segment): Put large section
11358         sections in a separate load segment with the large segment flag
11359         set.
11360         (Layout::segment_precedes): Sort large data segments after other
11361         load segments.
11362         (align_file_offset): New static function.
11363         (Layout::set_segment_offsets): Use align_file_offset.
11364         * output.h (class Output_section): Add is_small_section_ and
11365         is_large_section_ fields.
11366         (Output_section::is_small_section): New function.
11367         (Output_section::set_is_small_section):  New function.
11368         (Output_section::is_large_section): New function.
11369         (Output_section::set_is_large_section): New function.
11370         (Output_section::is_large_data_section): New function.
11371         (class Output_segment): Add is_large_data_segment_ field.
11372         (Output_segment::is_large_data_segment): New function.
11373         (Output_segment::set_is_large_data_segment): New function.
11374         * output.cc (Output_section::Output_section): Initialize new
11375         fields.
11376         (Output_segment::Output_segment): Likewise.
11377         (Output_segment::add_output_section): Add assertion that large
11378         data sections always go in large data segments.  Force small data
11379         sections to the end of the list of data sections.  Force small BSS
11380         sections to the start of the list of BSS sections.  For large BSS
11381         sections to the end of the list of BSS sections.
11382         * symtab.h (class Symbol): Declare is_common_shndx.
11383         (Symbol::is_defined): Check Symbol::is_common_shndx.
11384         (Symbol::is_common): Likewise.
11385         (class Symbol_table): Define enum Commons_section_type.  Update
11386         declarations.  Add small_commons_ and large_commons_ fields.
11387         * symtab.cc (Symbol::is_common_shndx): New function.
11388         (Symbol_table::Symbol_table): Initialize new fields.
11389         (Symbol_table::add_from_object): Put small and large common
11390         symbols in the right list.
11391         (Symbol_table::sized_finalized_symbol): Check
11392         Symbol::is_common_shndx.
11393         (Symbol_table::sized_write_globals): Likewise.
11394         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11395         common symbol lists.  Don't call do_allocate_commons_list if the
11396         list is empty.
11397         (Symbol_table::do_allocate_commons_list): Remove is_tls
11398         parameter.  Add comons_section_type parameter.  Change all
11399         callers.  Handle small and large common symbols.
11400         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11401         Symbol::is_common_shndx.
11402         * resolve.cc (symbol_to_bits): Likewise.
11403         * target.h (Target::small_common_shndx): New function.
11404         (Target::small_common_section_flags): New function.
11405         (Target::large_common_shndx): New function.
11406         (Target::large_common_section_flags): New function.
11407         (Target::new_output_section): New function.
11408         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11409         small_common_section_flags, and large_common_section_flags
11410         fields.
11411         (Target::do_new_output_section): New virtual function.
11412         * arm.cc (Target_arm::arm_info): Initialize new fields.
11413         * i386.cc (Target_i386::i386_info): Likewise.
11414         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11415         Likewise.
11416         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11417         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11418         (Target_x86_64::do_new_output_section): New function.
11419         * configure.ac: Define conditional MCMODEL_MEDIUM.
11420         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11421         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11422         (large_LDFLAGS): Define.
11423         * testsuite/large.c: New file.
11424         * testsuite/testfile.cc (Target_test::test_target_info):
11425         Initialize new fields.
11426         * configure, testsuite/Makefile.in: Rebuild.
11427
11428 2009-06-05  Doug Kwan  <dougkwan@google.com>
11429
11430         * Makefile.am (CCFILES): Add target.cc.
11431         * Makefile.in: Regenerate.
11432         * i386.cc (class Target_i386): Define new virtual method to
11433         override do_is_local_label_name in parent.
11434         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11435         local symbols if --discard-locals or -X is given.
11436         * options.h (class General_options): Declare new options
11437         '--discard-locals' and '-X' for discarding locals.
11438         * target.h (class Target): Define new methods is_local_label_name.
11439         Declare new virtual method do_is_local_label_name.
11440         * target.cc: New file.
11441         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11442         (check_SCRIPTS): Add discard_locals_test.sh.
11443         (check_DATA): Add discard_local_tests.syms.
11444         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11445         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11446         * testsuite/Makefile.in: Regenerate.
11447         * testsuite/discard_locals_test.c: New file.
11448         * testsuite/discard_locals_test.sh: Same.
11449
11450 2009-06-05  Doug Kwan  <dougkwan@google.com>
11451
11452         * object.cc (Sized_relobj::Sized_relobj): Initialize
11453         discarded_eh_frame_shndx_ to -1U.
11454         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11455         section.
11456         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11457         a discarded .eh_frame section.
11458         (Sized_relobj::do_finalize_local_symbols): Ditto.
11459         * object.h (class Sized_relobj): Declare new member
11460         discarded_eh_frame_shndx_.
11461         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11462         (local_labels_test.o, local_labels_test): New rules.
11463         * testsuite/Makefile.in: Regenerate.
11464
11465 2009-06-04  Doug Kwan  <dougkwan@google.com>
11466
11467         * layout.cc (Layout::section_name_mapping): Add mapping for
11468         special ARM sections.
11469
11470 2009-06-03  Doug Kwan  <dougkwan@google.com>
11471
11472         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11473         (utils::has_overflow): Same.
11474
11475 2009-06-03  Ian Lance Taylor  <iant@google.com>
11476
11477         * layout.cc (Layout::section_name_mapping): New array, replacing
11478         Layout::linkonce_mapping.
11479         (Layout::section_name_mapping_count): New variable, replacing
11480         Layout::linkonce_mapping_count.
11481         (Layout::linkonce_output_name): Remove.
11482         (Layout::output_section_name): Rewrite.
11483         * layout.h (class Layout): Rename Linkonce_mapping to
11484         Section_name_mapping, linkonce_mapping to section_name_mapping,
11485         linkonce_mapping_count to section_name_mapping_count.  Don't
11486         declare linkonce_output_name.
11487
11488 2009-06-03  Doug Kwan  <dougkwan@google.com>
11489
11490         * gold/arm.cc (namespace utils): New.
11491         (Target_arm::reloc_is_non_pic): Define new method.
11492         (class Arm_relocate_functions): New.
11493         (Target_arm::Relocate::relocate): Handle relocation types used by
11494         Android.
11495
11496 2009-06-03  Ian Lance Taylor  <iant@google.com>
11497
11498         * arm.cc (Target_arm::scan::global): Use || instead of |.
11499
11500 2009-06-02  Doug Kwan  <dougkwan@google.com>
11501
11502         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11503         issued_non_pic_error_.
11504         (class Target_arm::Scan): Declare new method check_non_pic.
11505         Define new method symbol_needs_plt_entry.
11506         Declare new data member issued_non_pic_error_.
11507         (class Target_arm::Relocate): Declare new method
11508         should_apply_static_reloc.
11509         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11510         (Target_arm::Scan::check_non_pic): Define new method.
11511         (Target_arm::Scan::local): Handle a small subset of reloc types used
11512         by Android.
11513         (Target_arm::Scan::local): Same.
11514         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11515
11516 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11517
11518         * incremental.cc (Incremental_inputs::report_command_line): Filter
11519         out --incremental-* options.
11520
11521 2009-05-29  Doug Kwan  <dougkwan@google.com>
11522
11523         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11524         template class.
11525         (class Target_arm): Update comment.
11526         (Target_arm::Target_arm): Initialize new data members GOT_,
11527         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11528         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11529         and Target_arm::rel_dyn_section.
11530         Declare new_enum Target_arm::Got_type.
11531         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11532         and DYNBSS_.
11533         Update commments for member do_dynsym_value.
11534         (Target_arm::got_size, Target_arm::plt_section,
11535         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11536         new methods inside class defintion.
11537         (Target_arm::got_section): Define new method.
11538         (Target_arm::rel_dyn_section): Same.
11539         (Output_data_plt_arm): New template class.
11540         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11541         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11542         (Output_data_plt_arm::add_entry): Same.
11543         (Output_data_plt_arm::first_plt_entry): Define new
11544         static data member for PLT instruction template.
11545         (Output_data_plt_arm::plt_entry): Same.
11546         (Output_data_plt_arm::do_write): Define new method.
11547         (Target_arm::make_plt_entry): Same.
11548         (Target_arm::do_finalize_sections): Same.
11549         (Target_arm::do_dynsym_value): Same.
11550
11551 2009-05-28  Doug Kwan  <dougkwan@google.com>
11552
11553         * Makefile.am (TARGETSOURCES): Add arm.cc.
11554         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11555         * Makefile.in: Regenerate.
11556         * arm.cc: New file.
11557         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11558
11559 2009-05-26  Doug Kwan  <dougkwan@google.com>
11560
11561         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11562         (General_options::check_excluded_libs): Strip off directories in
11563         archive name before matching like GNU ld does.
11564         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11565         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11566         (exclude_libs_test_LDFLAGS): Add linker option
11567         -Wl,--exclude-libs,libexclude_libs_test_3
11568         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11569         an explicit archive without using -l.
11570         (alt/libexclude_libs_test_3.a): New make rule.
11571         * testsuite/Makefile.in: Regenerate.
11572         * testsuite/exclude_libs_test.c : Declare lib3_default().
11573         (main): Call it.
11574         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11575         * exclude_libs_test_3.c: New file.
11576
11577 2009-05-26  Nick Clifton  <nickc@redhat.com>
11578
11579         * po/id.po: New Indonesian translation.
11580         * po/gold.pot: Updated template file.
11581
11582 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11583
11584         * testsuite/Makefile.am: Add -ffunction-sections to compile
11585         gc_comdat_test files.  Add -Wl,--gc-sections to build
11586         gc_comdat_test.
11587         * testsuite/Makefile.in: Regenerate.
11588         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11589
11590 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11591
11592         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11593         kept comdat section was garbage collected.
11594         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11595         * testsuite/Makefile.in: Regenerate.
11596         * testsuite/gc_comdat_test.sh: New file.
11597         * testsuite/gc_comdat_test_1.cc: New file.
11598         * testsuite/gc_comdat_test_2.cc: New file.
11599
11600 2009-05-19  Doug Kwan  <dougkwan@google.com>
11601
11602         * archive.cc (Archive::Archive): Move constructor from archive.h
11603         to here.  Initialize no_export_.
11604         (Archive::get_elf_object_for_member): Set no_export flag of object.
11605         * archive.h (Archive::Archive): Move constructor body to
11606         archive.cc.
11607         (Archive::no_export): New method.
11608         (Archive::no_export_): New field.
11609         * object.h (Object::Object): Initialize no_export_ to false.
11610         (Object::no_export, Object::set_no_export): New methods.
11611         (Object::no_export_): New field.
11612         * options.cc (General_options::parse_exclude_libs): New method.
11613         (General_options::check_excluded_libs) Same.
11614         * options.h (exclude_libs): New option.
11615         (General_options::check_excluded_libs): New method declaration.
11616         (General_options::excluded_libs_): New field.
11617         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11618         default or protected visibility if an object has no-export flag set.
11619         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11620         (check_SCRIPTS): Add exclude_libs_test.sh.
11621         (check_DATA): Add exclude_libs_test.syms.
11622         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11623         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11624         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11625         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11626         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11627         libexclude_libs_test_2.a): New rules.
11628         * testsuite/Makefile.in: Regenerate.
11629         * testsuite/exclude_libs_test.c: New file.
11630         * testsuite/exclude_libs_test.sh: Ditto.
11631         * testsuite/exclude_libs_test_1.c: Ditto.
11632         * testsuite/exclude_libs_test_2.c: Ditto.
11633
11634 2009-05-15  Ian Lance Taylor  <iant@google.com>
11635
11636         * configure.ac: Check for declarations for cases where libiberty.h
11637         checks HAVE_DECL_xxx.
11638         * configure, config.in: Rebuild.
11639
11640 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11641
11642         * gold.h (Incremental_argument_list): Remove (invalid) forward
11643         declaration.
11644         * incremental.cc (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::finalize): Call finalize_inputs().
11649         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11650         Create inputs entries.
11651         * incremental.h (Incremental_input_type): New enum.
11652         (Incremental_inputs::Incremental_input): Initialize new fields.
11653         (Incremental_inputs::report_inputs): New method.
11654         (Incremental_inputs::report_achive): New method.
11655         (Incremental_inputs::report_object): New method.
11656         (Incremental_inputs::report_script): New method.
11657         (Incremental_inputs::finalize_inputs): New method.
11658         (Incremental_inputs::Input_info): New struct.
11659         (Incremental_inputs::Input_info_map): New typedef.
11660         (Incremental_inputs::lock_): New field.
11661         (Incremental_inputs::Inputs_): New field.
11662         (Incremental_inputs::Inputs_map): New field.
11663         * main.cc (main): Call Incremental_input::report_inputs.
11664         * options.h (Input_argument_list): Typedef moved from
11665         Input_arguments.
11666         (Input_file_group::Files): Remove, use ::Input_argument_list.
11667         (Input_file_group::Input_argument_list): Remove, use
11668         ::Input_argument_list.
11669         * plugin.cc (Plugin_manager::add_input_file): Add error in
11670         incremental build.
11671         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11672         functions.
11673         * script.cc (read_input_script): Call
11674         Incremental_input::report_script.
11675         * script.h (Script_info): New class.
11676
11677 2009-04-27  Ian Lance Taylor  <iant@google.com>
11678
11679         * x86_64.cc (do_adjust_output_section): Set entsize to
11680         plt_entry_size.
11681
11682 2009-04-23  Elliott Hughes  <enh@google.com>
11683
11684         * output.cc (Output_file::close): After short writes, continue
11685         writing from the correct offset in the buffer being written.
11686
11687 2009-04-23  Chris Demetriou  <cgd@google.com>
11688
11689         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11690         * configure: Regenerate.
11691         * config.in: Regenerate.
11692         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11693         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11694
11695 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11696
11697         * incremental.cc (Incremental_inputs_header_data): Renamed from
11698         Incremental_input_header_data.
11699         (Incremental_inputs_header_data::data_size): New field.
11700         (Incremental_inputs_header_data::put_input_file_count): Renamed
11701         from input_file_count.
11702         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11703         from command_line_offset.
11704         (Incremental_inputs_header_data::put_reserved): Renamed from
11705         put_reserved.
11706         (Incremental_inputs_entry_data): Renamed from
11707         Incremental_input_entry_data.
11708         (Incremental_inputs_entry_data::data_size): New field.
11709         (Incremental_inputs::report_command_line): New method.
11710         (Incremental_inputs::finalize): New method.
11711         (Incremental_inputs::create_incremental_inputs_data): New method.
11712         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11713         * incremental.h: New file.
11714         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11715         (Layout::finalize): Create incremental inputs section in
11716         incremental builds.
11717         (Layout::create_incremental_info_sections): New method.
11718         * layout.h (Layout::incremental_inputs): New method.
11719         (Layout::create_incremental_info_sections): New method.
11720         (Layout::incremental_inputs_): New field.
11721         * main.cc (main): Notify Incremental_input of the command line.
11722
11723 2009-04-01  Ian Lance Taylor  <iant@google.com>
11724             Mikolaj Zalewski  <mikolajz@google.com>
11725
11726         * gold.h (reserve_unordered_map): Define, three versions, one for
11727         each version of Unordered_map.
11728         * layout.cc (Layout::Layout): Remove options parameter.  Add
11729         number_of_input_files parameter.  Don't initialize options_.
11730         Initialize number_of_input_files_ and resized_signatures_.  Move
11731         sections_are_attached_.
11732         (Layout::layout_group): Reserve space for group_signatures_.
11733         (Layout::find_or_add_kept_section): Change name parameter to be a
11734         reference.  Resize signatures_ map when it gets large enough.
11735         (Layout::layout_eh_frame): Use parameters->options() instead of
11736         this->options_.
11737         (Layout::make_output_section): Likewise.
11738         (Layout::attach_allocated_section_to_segment): Likewise.
11739         (Layout::finalize, Layout::create_executable_stack): Likewise.
11740         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11741         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11742         * layout.h (class Layout): Update declarations.  Remove options_
11743         field.  Add number_of_input_files_ and resized_signatures_
11744         fields.  Move sections_are_attached_ field.
11745         * main.cc (main): Pass number of input files to Layout
11746         constructor.  Don't pass options.
11747
11748 2009-03-30  Ian Lance Taylor  <iant@google.com>
11749
11750         * ffsll.c (ffsll): Correct implementation.
11751
11752 2009-03-27  Ian Lance Taylor  <iant@google.com>
11753
11754         * ffsll.c: New file.
11755         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11756         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11757         * ftruncate.c (ftruncate): Declare before definition.
11758         * mremap.c (mremap): Likewise.
11759         * pread.c (pread): Likewise.
11760         * configure, Makefile.in, config.in: Rebuild.
11761
11762         * mremap.c: New file.
11763         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11764         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11765         (mremap): Declare if HAVE_MREMAP is not defined.
11766         * configure, Makefile.in, config.in: Rebuild.
11767
11768 2009-03-27  Cary Coutant  <ccoutant@google.com>
11769
11770         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11771         position independent.
11772         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11773         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11774
11775 2009-03-24  Cary Coutant  <ccoutant@google.com>
11776
11777         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11778         an executable.
11779         (needs_dynamic_reloc): Likewise.
11780
11781 2009-03-24  Ian Lance Taylor  <iant@google.com>
11782
11783         * yyscript.y (file_cmd): Recognize EXTERN.
11784         (extern_name_list, extern_name_list_body): New nonterminals.
11785         * script.cc (script_add_extern): Define.
11786         * script-c.h (script_add_extern): Declare.
11787
11788 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11789
11790         * object.cc (is_elf_object): Define.
11791         * object.h (is_elf_object): Declare.
11792         * archive.cc (Archive::get_elf_object_for_member): Call
11793         is_elf_object.
11794         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11795
11796 2009-03-24  Elliott Hughes  <enh@google.com>
11797
11798         * output.cc (Output_file::map_anonymous): Define.
11799         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11800         try an anonymous one.  Report the size if the mmap fails.
11801         * output.h (class Output_file): Declare map_anonymous.
11802
11803 2009-03-24  Ian Lance Taylor  <iant@google.com>
11804
11805         * target-select.cc (instantiate_target): Don't acquire the lock if
11806         the instantiated_target_ field has already been set.
11807
11808 2009-03-23  Ian Lance Taylor  <iant@google.com>
11809
11810         * gold-threads.h (class Initialize_lock): Define.
11811         * gold-threads.cc (class Initialize_lock_once): Define.
11812         (initialize_lock_control): New static variable.
11813         (initialize_lock_pointer): New static variable.
11814         (initialize_lock_once): New static function.
11815         (Initialize_lock::Initialize_lock): Define.
11816         (Initialize_lock::initialize): Define.
11817         * target-select.h: Include "gold-threads.h".
11818         (class Target_selector): Add lock_ and initialize_lock_ fields.
11819         Don't define instantiate_target, just declare it.
11820         * target-select.cc (Target_selector::Target_selector): Initialize
11821         new fields.
11822         (Target_selector::instantiate_target): Define.
11823         * descriptors.h: Include "gold-threads.h".
11824         (class Descriptors): Add initialize_lock_ field.
11825         * descriptors.cc (Descriptors::Descriptors): Initialize new
11826         field.
11827         (Descriptors::open): Use initialize_lock_ field
11828         * errors.h (class Errors): Add initialize_lock_ field.
11829         * errors.cc (Errors::Errors): Initialize new field.
11830         (Errors::initialize_lock): Use initialize_lock_ field.
11831         * powerpc.cc (class Target_selector_powerpc): Remove
11832         instantiated_target_ field.  In do_recognize call
11833         instantiate_target rather than do_instantiate_target.  In
11834         do_instantiate_target just allocate a new target.
11835         * sparc.cc (class Target_selector_sparc): Likewise.
11836
11837         * freebsd.h: New file.
11838         * i386.cc: Include "freebsd.h".
11839         (Target_i386): Derive from Target_freebsd rather than
11840         Sized_target.
11841         (Target_selector_i386): Derive from Target_selector_freebsd rather
11842         than Target_selector.
11843         * x86_64.cc: Include "freebsd.h".
11844         (Target_x86_64): Derive from Target_freebsd rather than
11845         Sized_target.
11846         (Target_selector_x86_64): Derive from Target_selector_freebsd
11847         rather than Target_selector.
11848         * target.h (class Target): Add adjust_elf_header and
11849         do_adjust_elf_header.
11850         * output.cc (Output_file_header:: do_sized_write): Call target
11851         adjust_elf_header routine.
11852         * configure.tgt: Set targ_osabi.
11853         * configure.ac: Define GOLD_DEFAULT_OSABI.
11854         * parameters.cc (Parameters::default_target): Pass
11855         GOLD_DEFAULT_OSABI to select_target.
11856         * target-select.h (class Target_selector): Make instantiate_target
11857         protected rather than private.
11858         * Makefile.am (HFILES): Add freebsd.h.
11859         * configure, Makefile.in, config.in: Rebuild.
11860
11861         * merge.cc (do_add_input_section): Correct pend value.  Change
11862         message about last entry not being null terminated from error to
11863         warning.
11864
11865 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11866
11867         * incremental.cc: New file.
11868         * Makefile.am (CCFILES): Add incremental.cc.
11869         * Makefile.in: Rebuild.
11870
11871 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11872
11873         * layout.cc (Layout::output_section_name): Preserve names
11874         of '.note.' sections.
11875
11876 2009-03-19  Ian Lance Taylor  <iant@google.com>
11877
11878         * descriptors.cc (Descriptors::open): Check that the options are
11879         valid before using them.
11880
11881 2009-03-18  Ian Lance Taylor  <iant@google.com>
11882
11883         * script-sections.h: Include <list>.
11884         (class Script_sections): Change Sections_elements from std::vector
11885         to std::list.  Typedef public Elements_iterator.  Add
11886         orphan_section_placement_, data_segment_align_start_, and
11887         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11888         field.
11889         * script-sections.cc (class Orphan_section_placement): New class.
11890         (class Sections_element): Add virtual functions is_relro and
11891         orphan_section_init.  Remove virtual function place_orphan_here.
11892         (class Output_section_definition): Add is_relro and
11893         orphan_section_init.  Remove place_orphan_here.
11894         (class Orphan_output_section): Likewise.
11895         (Script_sections::Script_sections): Update for field changes.
11896         (Script_sections::data_segment_align): Set saw_data_segment_align_
11897         and data_segment_align_start_, not data_segment_align_index.
11898         (Script_sections::data_segment_relro_end): Check
11899         saw_data_segment_align_.  Use data_segment_align_start_ rather
11900         than data_segment_align_index_.
11901         (Script_sections::place_orphan): Rewrite to use
11902         Orphan_section_placement.
11903
11904 2009-03-17  Ian Lance Taylor  <iant@google.com>
11905
11906         * archive.cc (Archive::add_symbols): Check for a version attached
11907         to the symbol name in the archive map.
11908         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11909         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11910         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11911         (ver_test_11.a): New target.
11912         * testsuite/Makefile.in: Rebuild.
11913
11914         * configure.ac: Check for chsize and posix_fallocate.  Replace
11915         ftruncate.
11916         * ftruncate.c: New file, from gnulib.
11917         * output.cc (posix_fallocate): Define dummy version if not
11918         HAVE_POSIX_FALLOCATE.
11919         (Output_file::map): Call posix_fallocate rather than lseek and
11920         write.
11921         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11922         * configure, Makefile.in, config.in: Rebuild.
11923
11924 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11925
11926         * layout.h (Layout::create_note): Add section_name parameter.
11927         * layout.cc (Layout::create_note): Likewise.
11928         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11929
11930 2009-03-17  Ian Lance Taylor  <iant@google.com>
11931
11932         * descriptors.cc: Include "options.h".
11933         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11934         (Descriptors::open): Always use O_CLOEXEC when opening a new
11935         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11936         then set FD_CLOEXEC.
11937
11938         * sparc.cc (class Target_sparc): Add has_got_section.
11939         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11940         make sure we have a GOT section.
11941
11942         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11943         (Target_sparc::Scan::local): Likewise.
11944         (Target_sparc::Scan::global): Likewise.
11945         (Target_sparc::Relocate::relocate): Likewise.
11946         (Target_sparc::Relocate::relocate_tls): Likewise.
11947
11948         * symtab.cc (Symbol_table::define_default_version): New function,
11949         broken out of add_from_object.
11950         (Symbol_table::add_from_object): Call define_default_version.
11951         (Symbol_table::define_special_symbol): Add resolve_oldsym
11952         parameter.  Change all callers.  If the version for a symbol comes
11953         from a version script, resolve it with the symbol with the same
11954         name with no version.  Also add the symbol without a version if
11955         appropriate.
11956         (do_define_in_output_data): If resolving with oldsym, don't delete
11957         sym.
11958         (do_define_in_output_segment): Likewise.
11959         (do_define_as_constant): Likewise.
11960         * symtab.h (class Symbol_table): Update declarations.
11961
11962 2009-03-13  Ian Lance Taylor  <iant@google.com>
11963
11964         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11965         (Read_symbols::requeue): New function.
11966         (Read_symbols::do_read_symbols): If make_elf_object fails because
11967         the target type is not configured, and the file was searched for,
11968         issue a warning and retry with the next directory.
11969         (Add_symbols::run): If the file has an incompatible format, and
11970         it was searched for, requeue the Read_symbols task.  On error,
11971         release the object.
11972         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11973         dirindex parameter to constructor.  Change all callers.  Declare
11974         incompatible_warning and requeue.
11975         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11976         input_argument_ and input_group_ fields.  Add them to
11977         constructor.  Change all callers.
11978         (class Read_script): Add dirindex_ field.  Add it to constructor.
11979         Change all callers.
11980         * archive.cc (Archive::setup): Remove input_objects parameter.
11981         Change all callers.
11982         (Archive::get_file_and_offset): Likewise.
11983         (Archive::read_all_symbols): Likewise.
11984         (Archive::read_symbols): Likewise.
11985         (Archive::get_elf_object_for_member): Remove input_objects
11986         parameter.  Add punconfigured parameter.  Change all callers.
11987         (Archive::add_symbols): Change return type to bool.  Check return
11988         value of include_member.
11989         (Archive::include_all_members): Likewise.
11990         (Archive::include_member): Change return type to bool.  Return
11991         false if first included object has incompatible target.  Set
11992         included_member_ field.
11993         (Add_archive_symbols::run): If add_symbols returns false, requeue
11994         Read_symbols task.
11995         * archive.h (class Archive): Add included_member_ field.
11996         Initialize it in constructor.  Add input_file and searched_for
11997         methods.  Update declarations.
11998         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11999         input_argument_ fields.  Add them to constructor.  Change all
12000         callers.
12001         * script.cc: Include "target-select.h".
12002         (class Parser_closure): Add skip_on_incompatible_target_ and
12003         found_incompatible_target_ fields.  Add
12004         skip_on_incompatible_target parameter to constructor.  Change all
12005         callers.  Add methods skip_on_incompatible_target,
12006         clear_skip_on_incompatible_target, found_incompatible_target, and
12007         set_found_incompatible_target.
12008         (read_input_script): Add dirindex parameter.  Change all callers.
12009         If parser finds an incompatible target, requeue Read_symbols
12010         task.
12011         (script_set_symbol): Clear skip_on_incompatible_target in
12012         closure.
12013         (script_add_assertion, script_parse_option): Likewise.
12014         (script_start_sections, script_add_phdr): Likewise.
12015         (script_check_output_format): New function.
12016         * script.h (read_input_script): Update declaration.
12017         * script-c.h (script_check_output_format): Declare.
12018         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12019         (ignore_cmd): Remove OUTPUT_FORMAT.
12020         * fileread.cc (Input_file::Input_file): Add explicit this.
12021         (Input_file::will_search_for): New function.
12022         (Input_file::open): Add pindex parameter.  Change all callers.
12023         * fileread.h (class Input_file): Add input_file_argument method.
12024         Declare will_search_for.  Update declarations.
12025         * object.cc (make_elf_object): Add punconfigured parameter.
12026         Change all callers.
12027         * object.h (class Object): Make input_file public.  Add
12028         searched_for method.
12029         (make_elf_object): Update declaration.
12030         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12031         restart search.
12032         * dirsearch.h (class Dirsearch): Update declaration.
12033         * options.h (class General_options): Add --warn-search-mismatch.
12034         * parameters.cc (Parameters::is_compatible_target): New function.
12035         * parameters.h (class Parameters): Declare is_compatible_target.
12036         * workqueue.cc (Workqueue::add_blocker): New function.
12037         * workqueue.h (class Workqueue): Declare add_blocker.
12038
12039         * fileread.cc (Input_file::open): Remove options parameter.
12040         Change all callers.
12041         (Input_file::open_binary): Likewise.
12042         * script.cc (read_input_script): Likewise.
12043         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12044         options parameter from constructor.  Change all callers.
12045         (class Read_script): Likewise.
12046         * fileread.h (class Input_file): Update declarations.
12047         * script.h (read_input_script): Update declaration.
12048
12049 2009-03-10  Nick Clifton  <nickc@redhat.com>
12050
12051         * po/es.po: New Spanish translation.
12052
12053 2009-03-06  Cary Coutant  <ccoutant@google.com>
12054
12055         * options.cc (parse_short_option): Keep dash_z from registering itself.
12056
12057 2009-03-03  Ian Lance Taylor  <iant@google.com>
12058
12059         PR 9918
12060         * target-reloc.h (relocate_section): Pass output_section to
12061         relocate.
12062         * i386.cc (Target_i386::should_apply_static_reloc): Add
12063         output_section parameter.  Change all callers.
12064         (Target_i386::Relocate::relocate): Add output_section parameter.
12065         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12066         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12067         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12068         * testsuite/two_file_shared.sh: New script.
12069         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12070         (check_DATA): Add two_file_shared.dbg.
12071         (two_file_shared.dbg): New target.
12072         * testsuite/Makefile.in: Rebuild.
12073
12074 2009-03-01  Ian Lance Taylor  <iant@google.com>
12075
12076         * configure.ac: Check for byteswap.h.
12077         * configure: Rebuild.
12078         * config.in: Rebuild.
12079
12080 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12081
12082         * layout.cc (Layout::find_or_add_kept_section): New function.
12083         (Layout::add_comdat): Removed.
12084         * layout.h (struct Kept_section): Move out of class Layout.
12085         Remove trailing underscores from field names.  Add group_sections
12086         field.  Rename group_ field to is_group.  Change all uses.
12087         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12088         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12089         comdat_groups_ field.
12090         (Sized_relobj::include_section_group): Use
12091         find_or_add_kept_section and Kept_section::group_sections.
12092         (Sized_relobj::include_linkonce_section): Likewise.
12093         * object.cc (class Sized_relobj): Don't define Comdat_group or
12094         Comdat_group_table.  Remove find_comdat_group and
12095         add_comdat_group.  Remove comdat_groups_ field.
12096         * plugin.cc (include_comdat_group): Use
12097         Layout::find_or_add_kept_section.
12098
12099 2009-02-28  Ian Lance Taylor  <iant@google.com>
12100
12101         * README: --gc-sections and map files are now supported.  Document
12102         some build requirements.
12103
12104         PR 6992
12105         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12106         relocatable link set the value of the section symbol to zero.
12107         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12108         relocatable link don't include the section address in the local
12109         symbol value.
12110
12111 2009-02-27  Ian Lance Taylor  <iant@google.com>
12112
12113         PR 6811
12114         * options.h (class Search_directory): Add is_system_directory.
12115         (class General_options): Declare is_in_system_directory.
12116         * options.cc (get_relative_sysroot): Make static.
12117         (get_default_sysroot): Make static.
12118         (General_optoins::is_in_system_directory): New function.
12119         * fileread.cc (Input_file::is_in_system_directory): New function.
12120         * fileread.h (class Input_file): Declare is_in_system_directory.
12121         * object.h (class Object): Add is_in_system_directory.
12122         (class Input_objects): Remove system_library_directory_ field.
12123         * object.cc (Input_objects::add_object): Don't set
12124         system_library_directory_.
12125         (input_objects::found_in_system_library_directory): Remove.
12126         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12127         parameter.  Change all callers.
12128         (Symbol_table::sized_write_globals): Likewise.
12129         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12130         Call Object::is_in_system_directory.
12131         * symtab.h (class Symbol_table): Update declarations.
12132
12133         PR 5990
12134         * descriptors.h (Open_descriptor): Add is_on_stack field.
12135         * descriptors.cc (Descriptors::open): If the descriptor is on the
12136         top of the stack, remove it.  Initialize is_on_stack field.
12137         (Descriptors::release): Only add pod to stack if it is not on the
12138         stack already.
12139         (Descriptors::close_some_descriptor): Clear stack_next and
12140         is_on_stack fields.
12141
12142         PR 7091
12143         * output.cc (Output_section::find_starting_output_address): Rename
12144         from starting_output_address; add PADDR parameter; change return
12145         type.
12146         * output.h (class Output_section): Declare
12147         find_starting_output_address instead of starting_output_address.
12148         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12149         section symbol for which we can't find a merge section.
12150
12151         PR 9836
12152         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12153         hidden or internal, force the symbol to be local.
12154         * resolve.cc (Symbol::override_visibility): Define.
12155         (Symbol::override_base): Use override_visibility.
12156         (Symbol_table::resolve): Likewise.
12157         (Symbol::override_base_with_special): Likewise.
12158         (Symbol_table::override_with_special): If the visibility is hidden
12159         or internal, force the symbol to be local.
12160         * symtab.h (class Symbol): Add set_visibility and
12161         override_visibility.
12162         * testsuite/ver_test_1.sh: New file.
12163         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12164         (check_DATA): Add ver_test_1.syms.
12165         (ver_test_1.syms): New target.
12166         * testsuite/Makefile.in: Rebuild.
12167
12168 2009-02-25  Cary Coutant  <ccoutant@google.com>
12169
12170         * layout.cc (Layout::choose_output_section): Don't rename sections
12171         when using a linker script that has a SECTIONS clause.
12172         * Makefile.in: Regenerate.
12173
12174         * testsuite/Makefile.am (script_test_5.sh): New test case.
12175         * testsuite/Makefile.in: Regenerate.
12176         * testsuite/script_test_5.cc: New file.
12177         * testsuite/script_test_5.sh: New file.
12178         * testsuite/script_test_5.t: New file.
12179
12180 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12181
12182         * archive.cc (Archive::include_member): Update calls to add_symbols.
12183         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12184         the Layout argument.
12185         * dynobj.h (do_add_symbols): Add the Layout argument.
12186         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12187         Layout argument.
12188         * object.h (Object::add_symbols): Add the Layout argument.
12189         (Object::do_add_symbols): Add the Layout argument.
12190         (Sized_relobj::do_add_symbols): Add the Layout argument.
12191         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12192         Unify the two versions.
12193         (Add_plugin_symbols): Remove.
12194         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12195         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12196         (Add_plugin_symbols): Remove.
12197         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12198         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12199         (Add_symbols::run): Make it work with Pulginobj.
12200
12201 2009-02-06  Ian Lance Taylor  <iant@google.com>
12202
12203         * object.cc (Sized_relobj::do_layout): Make info message start
12204         with lower case letter.
12205
12206 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12207
12208         * binary.cc: Fix file comment.
12209
12210         * options.h (enum Incremental_disposition): Define.
12211         (class General_options): Add new options: --incremental,
12212         --incremental_changed, --incremental_unchanged,
12213         --incremental_unknown.  Add incremental_disposition_ and
12214         implicit_incremental_ fields.
12215         (General_options::incremental_disposition): New function.
12216         (class Position_dependent_options): Add incremental_disposition
12217         option.
12218         (Position_dependent_options::copy_from_options): Set incremental
12219         dispositions.
12220         * options.cc (General_options::parse_incremental_changed): New
12221         function.
12222         (General_options::parse_incremental_unchanged): New function.
12223         (General_options::parse_incremental_unknown): New function.
12224         (General_options::General_options): Initialize new fields
12225         incremental_disposition_ and implicit_incremental_.
12226         (General_options::finalize): Check for uasge of --incremental-*
12227         without --incremental.
12228
12229 2009-02-06  Chris Demetriou  <cgd@google.com>
12230
12231         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12232         pointer and to report location as the file name associated with
12233         the symbol.
12234         (gold_undefined_symbol_at_location): New function to replace the
12235         old gold_undefined_symbol functionality.
12236         * target-reloc.h (relocate_section): Update to use
12237         gold_undefined_symbol_at_location.
12238         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12239         Call gold_undefined_symbol function rather than gold_error.
12240         * errors.h (Errors::undefined_symbol): Take location as a
12241         string, rather than calculating it from a relocation.
12242         * errors.cc (Errors::fatal): Print "fatal error:" before the
12243         formatted message.
12244         (Errors::error, Errors::error_at_location): Print "error: "
12245         before the formatted message.
12246         (Errors::undefined_symbol): Take location as a string, rather
12247         than calculating it from a relocation.
12248         (gold_undefined_symbol_at_location): New function akin to
12249         old gold_undefined_symbol, calculates location from relocation.
12250         (gold_undefined_symbol): Change to take only a Symbol pointer
12251         and to report location as the file name associated with the symbol.
12252         * testsuite/debug_msg.sh: Update for changed error messages.
12253         * testsuite/undef_symbol.sh: Likewise.
12254
12255 2009-02-04  Duncan Sands  <baldrick@free.fr>
12256
12257         PR 9812
12258         * reduced_debug_output.h
12259         (Output_reduced_debug_abbrev_section::failed): Use format for
12260         gold_warning.
12261         (Output_reduced_debug_info_section::faild): Likewise.
12262
12263 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12264
12265         * script.cc (Lazy_demangler): New class.
12266         (Version_script_info::get_symbol_version_helper): Demangle a
12267         symbol only once.
12268
12269 2009-01-29  Cary Coutant  <ccoutant@google.com>
12270
12271         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12272         to __tls_get_addr.
12273         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12274
12275 2009-01-28  Ian Lance Taylor  <iant@google.com>
12276
12277         * version.cc (version_string): Bump to 1.9.
12278
12279         * gold.h: Include <cstring> and <stdint.h>.
12280         * version.cc: Include <cstdio>.
12281         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12282         warning.
12283         * reduced_debug_output.cc (insert_into_vector): Rename from
12284         Insert_into_vector; change all callers.  Use Swap_unaligned to
12285         avoid aliasing issue; remove union since it is unnecessary.
12286
12287 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12288
12289         * Makefile.am (CCFILES): Add gc.cc.
12290         (HFILES): Add gc.h.
12291         * Makefile.in: Regenerate.
12292         * gold.cc (Gc_runner): New class.
12293         (queue_initial_tasks): Call garbage collection related tasks
12294         when corresponding options are invoked.
12295         (queue_middle_gc_tasks): New function.
12296         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12297         processed early before laying out sections during garbage collection.
12298         * gold.h (queue_middle_gc_tasks): New function.
12299         (is_prefix_of): Move from "layout.cc".
12300         * i386.cc (Target_i386::gc_process_relocs): New function.
12301         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12302         * main.cc (main): Create object of class "Garbage_collection".
12303         * object.cc (Relobj::copy_symbols_data): New function.
12304         (Relobj::is_section_name_included): New function.
12305         (Sized_relobj::do_layout): Allow this function to be called twice
12306         during garbage collection and defer layout of section during the
12307         first call.
12308         * object.h (Relobj::get_symbols_data): New function.
12309         (Relobj::is_section_name_included): New function.
12310         (Relobj::copy_symbols_data): New function.
12311         (Relobj::set_symbols_data): New function.
12312         (Relobj::get_relocs_data): New function.
12313         (Relobj::set_relocs_data): New function.
12314         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12315         (Relobj::gc_process_relocs): New function.
12316         (Relobj::do_gc_process_relocs): New pure virtual function.
12317         (Relobj::sd_): New data member.
12318         (Sized_relobj::is_output_section_offset_invalid): New function.
12319         (Sized_relobj::do_gc_process_relocs): New function.
12320         * options.h (General_options::gc_sections): Modify to not be a no-op.
12321         (General_options::print_gc_sections): New option.
12322         * plugin.cc (Plugin_finish::run): Remove function call to
12323         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12324         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12325         * reloc.cc (Read_relocs::run): Add task to process relocs and
12326         determine unreferenced sections when doing garbage collection.
12327         (Gc_process_relocs): New class.
12328         (Sized_relobj::do_gc_process_relocs): New function.
12329         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12330         sections that are garbage collected.
12331         * reloc.h (Gc_process_relocs): New class.
12332         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12333         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12334         symbols whose corresponding sections are garbage collected.
12335         (Symbol_table::Symbol_table): Add new parameter for the garbage
12336         collection object.
12337         (Symbol_table::gc_mark_undef_symbols): New function.
12338         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12339         (Symbol_table::gc_mark_dyn_syms): New function.
12340         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12341         as garbage.
12342         (Symbol_table::add_from_object): Likewise.
12343         (Symbol_table::add_from_relobj): When building shared objects, do not
12344         treat externally visible symbols as garbage.
12345         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12346         table information for static and relocatable links.
12347         * symtab.h (Symbol_table::set_gc): New function.
12348         (Symbol_table::gc): New function.
12349         (Symbol_table::gc_mark_undef_symbols): New function.
12350         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12351         (Symbol_table::gc_mark_dyn_syms): New function.
12352         (Symbol_table::gc_): New data member.
12353         * target.h (Sized_target::gc_process_relocs): New pure virtual
12354         function.
12355         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12356         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12357
12358 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12359
12360         * options.h (General_options::gc_sections): Define as a no-op for now.
12361         (General_options::no_keep_memory): Ditto.
12362         (General_options::Bshareable): Define.
12363         * options.cc (General_options::finalize): Honor -Bshareable.
12364
12365 2009-01-20  Andreas Schwab  <schwab@suse.de>
12366
12367         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12368         read the value in the contents, since we don't use it.  Use the
12369         template endianness when writing.
12370         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12371
12372 2009-01-19  Andreas Schwab  <schwab@suse.de>
12373
12374         * configure.tgt (powerpc64-*): Fix targ_obj.
12375
12376 2009-01-15  Ian Lance Taylor  <iant@google.com>
12377
12378         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12379         local symbols when stripping all symbols.
12380
12381 2009-01-14  Cary Coutant  <ccoutant@google.com>
12382
12383         * output.cc (Output_reloc): Add explicit instantiations.
12384
12385 2009-01-14  Cary Coutant  <ccoutant@google.com>
12386
12387         * archive.cc (Archive::get_elf_object_for_member): Remove call
12388         to File_read::claim_for_plugin.
12389         * descriptors.cc (Descriptors::open): Remove reference to
12390         is_claimed.
12391         (Descriptors::claim_for_plugin): Remove.
12392         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12393         (Descriptors::is_claimed): Remove.
12394         (claim_descriptor_for_plugin): Remove.
12395         * fileread.cc (File_read::claim_for_plugin): Remove.
12396         * fileread.h (File_read::claim_for_plugin): Remove.
12397         (File_read::descriptor): Reopen descriptor if necessary.
12398         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12399         (Plugin_manager::all_symbols_read): Add task parameter. Change
12400         all callers.
12401         (Plugin_manager::get_input_file): New function.
12402         (Plugin_manager::release_input_file): New function.
12403         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12404         corresponding data member.
12405         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12406         and pass to base constructor. Change all callers.
12407         (get_input_file, release_input_file): New functions.
12408         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12409         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12410         (Plugin_manager::all_symbols_read): Add task parameter.
12411         (Plugin_manager::get_input_file): New function.
12412         (Plugin_manager::release_input_file): New function.
12413         (Plugin_manager::task_): New data member.
12414         (Pluginobj::Pluginobj): Add filesize parameter.
12415         (Pluginobj::filename): New function.
12416         (Pluginobj::descriptor): New function.
12417         (Pluginobj::filesize): New function.
12418         (Pluginobj::filesize_): New data member.
12419         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12420         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12421         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12422
12423         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12424         with archive libraries.
12425         * testsuite/Makefile.in: Regenerate.
12426         * testsuite/plugin_test.c (struct sym_info): New type.
12427         (get_input_file, release_input_file): New static variables.
12428         (onload): Capture new transfer vector entries.
12429         (claim_file_hook): Stop reading at end of file according to filesize.
12430         Factor out parsing of readelf output into separate function.
12431         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12432         APIs and get the source file name from the symbol table.  Convert
12433         source file name to corresponding object file name.  Print info
12434         message when adding new input files.
12435         (parse_readelf_line): New function.
12436         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12437         * testsuite/plugin_test_2.sh: Likewise.
12438         * testsuite/plugin_test_3.sh: Likewise.
12439         * testsuite/plugin_test_4.sh: New test case.
12440
12441 2009-01-07  Ian Lance Taylor  <iant@google.com>
12442
12443         * version.cc (version_string): Bump to 1.8.
12444
12445 2008-12-23  Cary Coutant  <ccoutant@google.com>
12446
12447         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12448         * plugin.cc (Plugin_manager::finish): Rename as
12449         layout_deferred_objects.  Move cleanup to separate function.
12450         (Plugin_manager::cleanup): New function.
12451         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12452         separately.
12453         * plugin.h (Plugin_manager::finish): Rename as
12454         layout_deferred_objects.
12455         (Plugin_manager::cleanup): New function.
12456         (Plugin_manager::cleanup_done): New field.
12457
12458 2008-12-23  Cary Coutant  <ccoutant@google.com>
12459
12460         * plugin.cc (is_visible_from_outside): New function.
12461         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12462         so we don't return "IR only" status for exported symbols or -r links.
12463
12464         * testsuite/Makefile.am (plugin_test_3): New test case.
12465         * testsuite/Makefile.in: Regenerate.
12466         * testsuite/plugin_test_3.sh: New file.
12467
12468 2008-12-22  Cary Coutant  <ccoutant@google.com>
12469
12470         * object.cc (Sized_relobj::layout_section): New function.
12471         (Sized_relobj::do_layout): Defer layout of input sections until after
12472         plugin has provided replacement files.
12473         (Sized_relobj::do_layout_deferred_sections): New function.
12474         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12475         (Relobj::layout_deferred_sections): New function.
12476         (Relobj::do_layout_deferred_sections): New function.
12477         (Sized_relobj::do_layout_deferred_sections): New function.
12478         (Sized_relobj::layout_section): New function.
12479         (Sized_relobj::Deferred_layout): New structure.
12480         (Sized_relobj::deferred_layout_): New field.
12481         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12482         Change all callers.  Layout deferred sections.
12483         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12484         references.
12485         (Plugin_hook::run): Move code from do_plugin_hook inline.
12486         (Plugin_hook::do_plugin_hook): Remove.
12487         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12488         (Plugin_manager::finish): Renamed, was cleanup.
12489         (Plugin_manager::should_defer_layout): New function.
12490         (Plugin_manager::add_deferred_layout_object): New function.
12491         (Plugin_manager::Deferred_layout_list): New type.
12492         (Plugin_manager::deferred_layout_objects_): New field.
12493         (Plugin_hook::do_plugin_hook): Remove.
12494
12495 2008-12-17  Ian Lance Taylor  <iant@google.com>
12496
12497         * options.h (class General_options): Add --no case for
12498         --export-dynamic.
12499
12500 2008-12-16  Cary Coutant  <ccoutant@google.com>
12501
12502         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12503         vector.
12504         (Plugin_manager::claim_file): Create plugin object even if
12505         plugin did not call the add_symbols callback.
12506         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12507         asking for more symbols than were added.
12508         * testsuite/Makefile.am (plugin_test_1): Add test case with
12509         no global symbols.
12510         (empty.syms): New target.
12511         * testsuite/Makefile.in: Regenerate.
12512         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12513         message. Don't call add_symbols if no globals.
12514         (all_symbols_read_hook): Don't provide replacement for empty
12515         claimed file.
12516
12517 2008-12-12  Ian Lance Taylor  <iant@google.com>
12518
12519         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12520         r_type == 0 for a local symbol with r_sym == 0.
12521         (scan_relocatable_relocs): Pass r_sym to
12522         local_non_section_strategy.
12523         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12524         r_sym parameter.
12525
12526         * configure.ac: Update test for TLS descriptors: they are
12527         supported as of glibc 2.9.
12528         * configure: Rebuild.
12529
12530 2008-12-11  Ian Lance Taylor  <iant@google.com>
12531
12532         PR 7091
12533         * target-reloc.h (Default_scan_relocatable_relocs): For each
12534         function, map r_type == 0 to RELOC_DISCARD.
12535
12536 2008-12-10  Cary Coutant  <ccoutant@google.com>
12537
12538         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12539         object to override a kept COMDAT group from a plugin object.
12540
12541 2008-12-09  Ian Lance Taylor  <iant@google.com>
12542
12543         PR 7088
12544         * yyscript.y (file_cmd): Handle INPUT.
12545
12546         * testsuite/initpri1.c: Change all declarations to be full
12547         prototypes by adding void, to avoid compiler warnings.
12548
12549 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12550
12551         * options.cc (General_options::parse_plugin_opt): New.
12552         (General_options::add_plugin): The argument now is just the filename.
12553         (General_options::add_plugin_option): New.
12554         * options.h (plugin_opt): New.
12555         (add_plugin): Change argument name.
12556         (add_plugin_option): New.
12557         * plugin.cc (Plugin::load): Don't parse the plugin option.
12558         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12559         (Plugin::add_option): New.
12560         (Plugin::args_): Change type.
12561         (Plugin::filename_): New.
12562         (Plugin_manager::add_plugin_option): New.
12563         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12564         * testsuite/Makefile.in: Regenerate.
12565
12566 2008-12-05  Cary Coutant  <ccoutant@google.com>
12567
12568         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12569         Handle --strip-lto-sections option.
12570         * options.h (strip_lto_sections): New option.
12571
12572 2008-12-01  Cary Coutant  <ccoutant@google.com>
12573
12574         * plugin.cc (ld_plugin_message): Change format parameter to const.
12575         Fix mismatch between new[] and delete.
12576
12577 2008-11-14  Cary Coutant  <ccoutant@google.com>
12578
12579         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12580         instead of -1U.
12581
12582 2008-11-05  Craig Silverstein  <csilvers@google.com>
12583
12584         * options.cc (General_options::parse_dynamic_list): New function.
12585         * options.h (General_options): New flags dynamic_list,
12586         dynamic_list_data, dynamic_list_cpp_new, and
12587         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12588         (General_options::in_dynamic_list): New function.
12589         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12590         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12591         (Lex::can_continue_name): Likewise.
12592         (yylex): Likewise.
12593         (read_script_file): New parameter script_options.
12594         (read_dynamic_list): New function.
12595         (Script_options::define_dynamic_list): New function.
12596         (dynamic_list_keyword_parsecodes): New variable.
12597         (dynamic_list_keywords): New variable.
12598         * script.h (Script_options::define_dynamic_list): New function
12599         prototype.
12600         (read_dynamic_list): New function prototype.
12601         * symtab.cc (strprefix): New macro.
12602         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12603         dynamic_list_data, dynamic_list_cpp_new, and
12604         dynamic_list_cpp_typeinfo.
12605         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12606         (dynamic_list_expr): New rule.
12607         (dynamic_list_nodes): Likewise.
12608         (dynamic_list_node): Likewise.
12609         * testsuite/Makefile.am (dynamic_list): New test.
12610         * testsuite/Makefile.in: Regenerated.
12611         * testsuite/dynamic_list.t: New file.
12612         * testsuite/dynamic_list.sh: New file.
12613
12614 2008-11-05  Craig Silverstein  <csilvers@google.com>
12615
12616         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12617         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12618         (t11_last): Likewise.
12619         * testsuite/ver_test_6.c (main): Likewise.
12620
12621 2008-10-07  Cary Coutant  <ccoutant@google.com>
12622
12623         * options.c (General_options::finalize): Add check for -static and
12624         -shared.
12625         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12626         is not empty.
12627
12628 2008-10-02  Cary Coutant  <ccoutant@google.com>
12629
12630         * plugin.cc (make_sized_plugin_object): Fix conditional
12631         compilation to work when not all targets are enabled.
12632
12633 2008-09-29  Cary Coutant  <ccoutant@google.com>
12634
12635         * archive.cc (Archive::get_file_and_offset): Use filename instead
12636         of name to get library path.
12637         (Archive::include_member): Unlock external member of a thin archive.
12638
12639         * testsuite/Makefile.am (TEST_AR): New variable.
12640         (thin_archive_test_1): New test.
12641         (thin_archive_test_2): New test.
12642         * testsuite/Makefile.in: Regenerate.
12643         * testsuite/thin_archive_main.cc: New file.
12644         * testsuite/thin_archive_test_1.cc: New file.
12645         * testsuite/thin_archive_test_2.cc: New file.
12646         * testsuite/thin_archive_test_3.cc: New file.
12647         * testsuite/thin_archive_test_4.cc: New file.
12648
12649 2008-09-29  Cary Coutant  <ccoutant@google.com>
12650
12651         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12652         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12653         instead of -1U.
12654         (Sized_relobj::do_finalize_local_symbols): Likewise.
12655         (Sized_relobj::map_to_kept_section): Likewise.
12656         * object.h (Sized_relobj::invalid_address): New constant.
12657         (Sized_relobj::do_output_section_offset): Check for invalid_address
12658         and return -1ULL.
12659         * output.cc (Output_reloc::local_section_offset): Use constant
12660         invalid_address instead of -1U.
12661         (Output_reloc::get_address): Likewise.
12662         (Output_section::output_address): Change -1U to -1ULL.
12663         * output.h (Output_reloc::invalid_address): New constant.
12664         * reloc.cc (Sized_relobj::write_sections): Use constant
12665         invalid_address instead of -1U.
12666         (Sized_relobj::relocate_sections): Likewise.
12667         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12668         values for merge sections.
12669         * target-reloc.h (relocate_for_relocatable): Use constant
12670         invalid_address instead of -1U.
12671
12672 2008-09-19  Cary Coutant  <ccoutant@google.com>
12673
12674         Add plugin functionality for link-time optimization (LTO).
12675         * configure.ac (plugins): Add --enable-plugins option.
12676         * configure: Regenerate.
12677         * config.in: Regenerate.
12678         * Makefile.am (LIBDL): New variable.
12679         (CCFILES): Add plugin.cc.
12680         (HFILES): Add plugin.h.
12681         (ldadd_var): Add LIBDL.
12682         * Makefile.in: Regenerate.
12683
12684         * archive.cc: Include "plugin.h".
12685         (Archive::setup): Don't preread archive symbols when using a plugin.
12686         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12687         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12688         files.
12689         (Archive::include_member): Add symbols from plugin objects.
12690         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12691         * descriptors.cc (Descriptors::open): Check for file descriptors
12692         abandoned by plugins.
12693         (Descriptors::claim_for_plugin): New function.
12694         * descriptors.h (Descriptors::claim_for_plugin): New function.
12695         (Open_descriptor::is_claimed): New field.
12696         (claim_descriptor_for_plugin): New function.
12697         * fileread.cc (File_read::claim_for_plugin): New function.
12698         * fileread.h (File_read::claim_for_plugin): New function.
12699         (File_read::descriptor): New function.
12700         * gold.cc: Include "plugin.h".
12701         (queue_initial_tasks): Add task to call plugin hooks for generating
12702         new object files.
12703         * main.cc: Include "plugin.h".
12704         (main): Load plugin libraries.
12705         * object.h (Pluginobj): Declare.
12706         (Object::pluginobj): New function.
12707         (Object::do_pluginobj): New function.
12708         (Object::set_target): New function.
12709         * options.cc: Include "plugin.h".
12710         (General_options::parse_plugin): New function.
12711         (General_options::General_options): Initialize plugins_ field.
12712         (General_options::add_plugin): New function.
12713         * options.h (Plugin_manager): Declare.
12714         (General_options): Add --plugin option.
12715         (General_options::has_plugins): New function.
12716         (General_options::plugins): New function.
12717         (General_options::add_plugin): New function.
12718         (General_options::plugins_): New field.
12719         * plugin.cc: New file.
12720         * plugin.h: New file.
12721         * readsyms.cc: Include "plugin.h".
12722         (Read_symbols::do_read_symbols): Check for archive before checking
12723         for ELF file.  Call plugin hooks to claim files.
12724         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12725         from a real object file; force override when processing replacement
12726         files.
12727         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12728         (Symbol::init_base_object): Likewise.
12729         (Symbol::init_base_output_data): Likewise.
12730         (Symbol::init_base_output_segment): Likewise.
12731         (Symbol::init_base_constant): Likewise.
12732         (Symbol::init_base_undefined): Likewise.
12733         (Symbol::output_section): Assert that object is not a plugin.
12734         (Symbol_table::add_from_pluginobj): New function.
12735         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12736         undefined.
12737         (Symbol_table::sized_write_globals): Likewise.
12738         (Symbol_table::add_from_pluginobj): Instantiate template.
12739         * symtab.h (Sized_pluginobj): Declare.
12740         (Symbol::in_real_elf): New function.
12741         (Symbol::set_in_real_elf): New function.
12742         (Symbol::in_real_elf_): New field.
12743         (Symbol_table::add_from_pluginobj): New function.
12744
12745         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12746         (LIBDL): New variable.
12747         (LDADD): Add LIBDL.
12748         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12749         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12750         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12751         (MOSTLYCLEANFILES): Likewise.
12752         * testsuite/Makefile.in: Regenerate.
12753         * testsuite/plugin_test.c: New file.
12754         * testsuite/plugin_test_1.sh: New file.
12755         * testsuite/plugin_test_2.sh: New file.
12756
12757 2008-09-16  Ian Lance Taylor  <iant@google.com>
12758
12759         * target-reloc.h (relocate_section): Check whether a symbol is
12760         defined by the ABI before reporting an undefined symbol error.
12761         * target.h (Target::is_defined_by_abi): Make parameter const.
12762         (Target::do_is_defined_by_abi): Likewise.
12763         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12764         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12765         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12766         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12767         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12768         * testsuite/Makefile.in: Rebuild.
12769
12770         * fileread.cc (make_view): Add casts to avoid warning.
12771
12772 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12773
12774         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12775         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12776
12777 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12778
12779         * options.h (General_options::output_is_executable): New.
12780         (General_options::output_is_pie): New.
12781         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12782         for shared libraries.
12783         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12784
12785 2008-09-11  Chris Demetriou  <cgd@google.com>
12786
12787         * options.h (origin): New -z option.
12788         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12789         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12790         in DT_FLAGS_1.
12791
12792 2008-09-05  Cary Coutant  <ccoutant@google.com>
12793
12794         * fileread.cc (File_read::make_view): Add check for attempt to map
12795         beyond end of file.
12796
12797 2008-09-05  Cary Coutant  <ccoutant@google.com>
12798
12799         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12800         explicit instantiations.
12801
12802 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12803
12804         PR gold/6858
12805         * options.cc (General_options::finalize): Allow undefined symbols
12806         in shlibs if linking -shared.
12807
12808         PR gold/6859
12809         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12810         symbols as not needing a dynsym entry.
12811
12812 2008-08-20  Craig Silverstein  <csilvers@google.com>
12813
12814         * fileread.cc (File_read::open): Do not lock the file unless it
12815         was successfully opened.
12816
12817 2008-08-14  Cary Coutant  <ccoutant@google.com>
12818
12819         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12820         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12821         * testsuite/tls_test.cc (struct int128): 128-bit struct
12822         for testing TLS relocs with non-zero addend.
12823         (v12): New TLS variable.
12824         (t12): New test.
12825         (t_last): Add check for v12.
12826         * testsuite/tls_test.h (t12): New function.
12827         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12828
12829 2008-08-13  Ian Lance Taylor  <iant@google.com>
12830
12831         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12832         set tls_segment_ or relro_segment_.
12833         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12834         when appropriate.
12835         * output.h (Output_section::clear_is_relro): New function.
12836         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12837         sections specially even when output_data_ is empty.
12838         (Output_segment::maximum_alignment): When first section is relro,
12839         only force alignment for PT_LOAD segments.
12840         * script.cc (script_data_segment_align): New function.
12841         (script_data_segment_relro_end): New function.
12842         * script-c.h (script_data_segment_align): Declare.
12843         (script_data_segment_relro_end): Declare.
12844         * script-sections.h (class Script_sections): Declare
12845         data_segment_align and data_segment_relro_end.  Add fields
12846         segment_align_index_ and saw_relro_end_.
12847         * script-sections.cc (class Sections_element): Add set_is_relro
12848         virtual function.  Add new bool* parameter to place_orphan_here.
12849         Add get_output_section virtual function.
12850         (class Output_section_definition): Add set_is_relro.  Add new
12851         bool* parameter to place_orphan_here.  Add get_output_section.
12852         Add is_relro_ field.
12853         (Output_section_definition::Output_section_definition): Initialize
12854         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12855         and is_relro_ fields.
12856         (Output_section_definition::place_orphan_here): Add is_relro
12857         parameter.
12858         (Output_section_definition::set_section_addresses): Set relro for
12859         output section.
12860         (Output_section_definition::alternate_constraint): Likewise.
12861         (class Orphan_output_section): Add new bool* parameter to
12862         place_orphan_here.  Add get_output_section.
12863         (Orphan_output_section::place_orphan_here): Add is_relro
12864         parameter.
12865         (Script_sections::Script_sections): Initialize
12866         data_segment_align_index_ and saw_relro_end_.
12867         (Script_sections::data_segment_align): New function.
12868         (Script_sections::data_segment_relro_end): New function.
12869         (Script_sections::place_orphan): Set or clear is_relro.
12870         (Script_sections::set_section_addresses): Force alignment of first
12871         TLS section.
12872         * yyscript.y (exp): Call script_data_segment_align and
12873         script_data_segment_relro_end.
12874         * testsuite/relro_script_test.t: New file.
12875         * testsuite/relro_test.cc (using_script): Declare.
12876         (t1, t2): Test using_script.
12877         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12878         (relro_script_test_SOURCES): Define.
12879         (relro_script_test_DEPENDENCIES): Define.
12880         (relro_script_test_LDFLAGS): Define.
12881         (relro_script_test_LDADD): Define.
12882         (relro_script_test.so): New target.
12883         * testsuite/Makefile.in: Rebuild.
12884
12885 2008-08-06  Cary Coutant <ccoutant@google.com>
12886
12887         * archive.cc (Archive::total_archives, Archive::total_members)
12888         (Archive::total_members_loaded): New variables.
12889         (Archive::setup): Add parameter.  Add option to preread
12890         archive symbols.
12891         (Archive::read_armap): Add counter.
12892         (Archive::get_file_and_offset): New function.
12893         (Archive::get_elf_object_for_member): New function.
12894         (Archive::read_all_symbols): New function.
12895         (Archive::read_symbols): New function.
12896         (Archive::add_symbols): Add counters.
12897         (Archive::include_all_members): Use armap to find members if it's
12898         already built.
12899         (Archive::include_member): Skip reading symbols if already read.
12900         Factored code into Archive::get_file_and_offset and
12901         Archive::get_elf_object_for_member.  Changed call to
12902         Mapfile::report_include_archive_member.
12903         (Archive::print_stats): New function.
12904         * archive.h: Declare Object and Read_symbols_data classes.
12905         (Archive::Archive): Add initializers for new members.
12906         (Archive::setup): Add parameter.
12907         (Archive::print_stats): New function.
12908         (Archive::total_archives, Archive::total_members)
12909         (Archive::total_members_loaded): New variables.
12910         (Archive::get_file_and_offset): New function.
12911         (Archive::get_elf_object_for_member): New function.
12912         (Archive::read_all_symbols): New function.
12913         (Archive::read_symbols): New function.
12914         (Archive::Archive_member): New class.
12915         (Archive::members_): New member.
12916         (Archive::num_members_): New member.
12917         * main.cc: Include archive.h.
12918         (main): Call Archive::print_stats.
12919         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12920         archive parameter; member_name is now the fully-decorated name.
12921         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12922         * options.h: (General_options): Add --preread-archive-symbols option.
12923         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12924         Archive::setup.
12925
12926 2008-08-04  Ian Lance Taylor  <iant@google.com>
12927
12928         * symtab.h (Symbol::use_plt_offset): New function.
12929         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12930         * powerpc.cc (Relocate::relocate): Likewise.
12931         * sparc.cc (Relocate::relocate): Likewise.
12932         * x86_64.cc (Relocate::relocate): Likewise.
12933         * testsuite/weak_plt.sh: New test.
12934         * testsuite/weak_plt_main.cc: New test.
12935         * testsuite/weak_plt_shared.cc: New test.
12936         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12937         (check_PROGRAMS): Add weak_plt.
12938         (check_DATA): Add weak_plt_shared.so.
12939         (weak_plt_main_pic.o, weak_plt): New targets.
12940         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12941         * testsuite/Makefile.in: Rebuild.
12942
12943         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12944         gcctestdir/ld.
12945         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12946         * testsuite/Makefile.in: Rebuild.
12947
12948 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12949
12950         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12951         * Makefile.in: Regenerate.
12952         * po/POTFILES.in: Regenerate.
12953
12954 2008-07-29  Ian Lance Taylor  <iant@google.com>
12955
12956         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12957         symbols before other symbols.
12958         * testsuite/script_test_2.cc (test_addr): Declare.
12959         (test_addr_alias): Declare.
12960         (main): Check that test_addr and test_addr_alias have the right
12961         values.
12962         * testsuite/script_test_2.t: Define test_addr_alias and
12963         test_addr.
12964
12965 2008-07-24  Ian Lance Taylor  <iant@google.com>
12966
12967         PR 5990
12968         * descriptors.cc: New file.
12969         * descriptors.h: New file.
12970         * gold-threads.h (class Hold_optional_lock): New class.
12971         * fileread.cc: Include "descriptors.h".
12972         (File_read::~File_read): Release descriptor rather than closing
12973         it.
12974         (File_read::open) [file]: Call open_descriptor rather than open.
12975         Set is_descriptor_opened_.
12976         (File_read::open) [memory]: Assert that descriptor is not open.
12977         (File_read::reopen_descriptor): New function.
12978         (File_read::release): Release descriptor.
12979         (File_read::do_read): Make non-const.  Reopen descriptor.
12980         (File_read::read): Make non-const.
12981         (File_read::make_view): Reopen descriptor.
12982         (File_read::do_readv): Likewise.
12983         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12984         Update declarations.
12985         * layout.cc: Include "descriptors.h".
12986         (Layout::create_build_id): Use open_descriptor rather than open.
12987         * output.cc: Include "descriptors.h".
12988         (Output_file::open): Use open_descriptor rather than open.
12989         * archive.cc (Archive::const_iterator): Change Archive to be
12990         non-const.
12991         (Archive::begin, Archive::end): Make non-const.
12992         (Archive::count_members): Likewise.
12993         * archive.h (class Archive): Update declarations.
12994         * object.h (Object::read): Make non-const.
12995         * Makefile.am (CCFILES): Add descriptors.cc.
12996         (HFILES): Add descriptors.h.
12997         * Makefile.in: Rebuild.
12998
12999         PR 6716
13000         * gold.h: Always include <clocale>.  Add Solaris workarounds
13001         following code in binutils/sysdep.h.
13002
13003         PR 6048
13004         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13005         this->eh_frame_hdr_ is NULL before using it.
13006
13007         * dynobj.cc (Versions::Versions): Update comment.
13008
13009         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13010         the base version name.
13011
13012         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13013         array size plus one.
13014         (Stringpool_template::set_string_offsets): Subtract one from key
13015         before using it as an array index.
13016         (Stringpool_template::get_offset_with_length): Likewise.
13017         (Stringpool_template::write_to_buffer): Likewise.
13018         * stringpool.h (Stringpool_template::get_offset_from_key):
13019         Likewise.
13020
13021 2008-07-23  Ian Lance Taylor  <iant@google.com>
13022
13023         PR 6658
13024         * object.h (Merged_symbol_value::value): Do our best to handle a
13025         negative addend.
13026
13027         PR 6647
13028         * script.cc (Version_script_info::get_versions): Don't add empty
13029         version tag to return value.
13030         (Version_script_info::get_symbol_version_helper): Change return
13031         type to bool.  Add pversion parameter.  Change all callers.
13032         (script_register_vers_node): Don't require a non-NULL tag.
13033         * script.h (class Version_script_info): Update declarations.
13034         (Version_script_info::get_symbol_version): Change return type to
13035         bool.  Add version parameter.  Change all callers.
13036         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13037         handling.  Handle an empty version from a version script.
13038         (Symbol_table::define_special_symbol): Likewise.
13039         * testsuite/ver_test_10.script: New file.
13040         * testsuite/ver_test_10.sh: New file.
13041         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13042         (check_DATA): Add ver_test_10.syms.
13043         (ver_test_10.syms, ver_test_10.so): New target.
13044         * testsuite/Makefile.in: Rebuild.
13045
13046 2008-07-23  Simon Baldwin  <simonb@google.com>
13047
13048         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13049         to zero for undefined symbols from dynamic libraries.
13050
13051 2008-07-23  Ian Lance Taylor  <iant@google.com>
13052
13053         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13054         Change all callers.
13055         * symtab.h (class Symbol_table): Update declaration.
13056         * testsuite/ver_test_9.cc: New file.
13057         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13058         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13059         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13060         (ver_test_9.so, ver_test_9.o): New targets.
13061         * testsuite/Makefile.in: Rebuild.
13062
13063 2008-07-22  Ian Lance Taylor  <iant@google.com>
13064
13065         * options.h (class General_options): Define --check-sections.
13066         * layout.cc (Layout::set_segment_offsets): Handle
13067         --check-sections.
13068
13069         * options.h (class General_options): Define -n/--nmagic and
13070         -N/--omagic.
13071         * options.cc (General_options::finalize): For -n/--nmagic or
13072         -N/--omagic, set -static.
13073         * layout.cc (Layout::attach_allocated_section_to_segment): If
13074         -N/--omagic, don't put read-only and read-write sections in
13075         different segments.
13076         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13077         finding a read-only segment.
13078         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13079         don't set the minimum segment alignment to the common page size,
13080         and don't set the file offset to the address modulo the page size.
13081         * script-sections.cc (Script_sections::create_segments): If
13082         -n/--omagic, don't put read-only and read-write sections in
13083         different segments.
13084
13085         * cref.cc: New file.
13086         * cref.h: New file.
13087         * options.h (class General_options): Add --print-symbol-counts.
13088         * main.cc (main): Issue defined symbol report if requested.
13089         * archive.cc (Archive::interpret_header): Make into a const member
13090         function.
13091         (Archive::add_symbols): Call Input_objects::archive_start and
13092         archive_stop.
13093         (Archive::const_iterator): Define new class.
13094         (Archive::begin, Archive::end): New functions.
13095         (Archive::include_all_members): Rewrite to use iterator.
13096         (Archive::count_members): New function.
13097         * archive.h (class Archive): Update declarations.
13098         (Archive::filename): New function.
13099         * object.cc: Include "cref.h".
13100         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13101         (Sized_relobj::do_get_global_symbol_counts): New function.
13102         (Input_objects::add_object): Add object to cross-referencer.
13103         (Input_objects::archive_start): New function.
13104         (Input_objects::archive_stop): New function.
13105         (Input_objects::print_symbol_counts): New function.
13106         * object.h: Declare Cref and Archive.
13107         (Object::get_global_symbol_counts): New function.
13108         (Object::do_get_global_symbol_counts): New pure virtual function.
13109         (class Sized_relobj): Add defined_count_ field.  Update
13110         declarations.
13111         (class Input_objects): Add cref_ field.  Update constructor.
13112         Update declarations.
13113         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13114         defined_count_.
13115         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13116         symbol counts.
13117         (Sized_dynobj::do_get_global_symbol_counts): New function.
13118         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13119         defined_count_.  Update declarations.  Define Symbols typedef.
13120         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13121         parameter.  Change all callers.
13122         (Symbol_table::add_from_dynobj): Add sympointers and defined
13123         parameters.  Change all callers.
13124         * symtab.h (class Symbol_table): Update declarations.
13125         * Makefile.am (CCFILES): Add cref.cc.
13126         (HFILES): Add cref.h.
13127         * Makefile.in: Rebuild.
13128
13129 2008-07-22  Simon Baldwin  <simonb@google.com>
13130
13131         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13132         to zero when writing undefined symbols.
13133
13134 2008-07-22  Ian Lance Taylor  <iant@google.com>
13135
13136         * output.cc (Output_section::add_input_section): Don't try to
13137         merge empty merge sections.
13138
13139 2008-07-21  Craig Silverstein  <csilvers@google.com>
13140
13141         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13142         Include symbol version in error message.
13143
13144 2008-07-20  Chris Demetriou  <cgd@google.com>
13145
13146         * configure.ac (gold_cv_c_random_seed): New configured variable.
13147         (RANDOM_SEED_CFLAGS): New substituted variable.
13148         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13149         * configure: Rebuild.
13150         * Makefile.in: Likewise.
13151         * testsuite/Makefile.in: Likewise.
13152
13153 2008-07-18  Ian Lance Taylor  <iant@google.com>
13154
13155         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13156         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13157         * testsuite/ver_test_main.cc (main): Call t4.
13158         (t4, t4_2a): Define.
13159         * testsuite/ver_test_2.cc (t4_2): Define.
13160         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13161         * testsuite/ver_test_4.cc (t4_2a): Define.
13162         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13163         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13164
13165 2008-07-17  Ian Lance Taylor  <iant@google.com>
13166
13167         * dynobj.cc (Versions::add_def): If we give an error about a
13168         missing version, go ahead and create the version anyhow.
13169
13170 2008-07-10  Ian Lance Taylor  <iant@google.com>
13171
13172         Handle output sections with more than 0x7fffffff bytes.
13173         * object.h (class Relobj): Change map_to_output_ to
13174         output_sections_, and just keep a section pointer.  Change all
13175         uses.  Move comdat group support to Sized_relobj.
13176         (Relobj::is_section_specially_mapped): Remove.
13177         (Relobj::output_section): Remove poff parameter.  Change all
13178         callers.
13179         (Relobj::output_section_offset): New function.
13180         (Relobj::set_section_offset): Rewrite.
13181         (Relobj::map_to_output): Remove.
13182         (Relobj::output_sections): New function.
13183         (Relobj::do_output_section_offset): New pure virtual function.
13184         (Relobj::do_set_section_offset): Likewise.
13185         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13186         group support from Relobj.  Update declarations.
13187         (Sized_relobj::get_output_section_offset): New function.
13188         (Sized_relobj::do_output_section_offset): New function.
13189         (Sized_relobj::do_set_section_offset): New function.
13190         * object.cc (Relobj::output_section_address): Remove.
13191         (Sized_relobj::Sized_relobj): Initialize new fields.
13192         (Sized_relobj::include_section_group): Cast find_kept_object to
13193         Sized_relobj.
13194         (Sized_relobj::include_linkonce_section): Likewise.
13195         (Sized_relobj::do_layout): Use separate arrays for output section
13196         and output offset.
13197         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13198         output_sections.
13199         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13200         output_sections and section_offsets.
13201         (Sized_relobj::write_local_symbols): Likewise.
13202         (map_to_kept_section): Compute output address directly.
13203         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13204         output_sections and section_offsets.
13205         (Sized_relobj::write_sections): Likewise.
13206         (Sized_relobj::relocate_sections): Likewise.
13207         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13208         * output.h (class Output_reloc): Update declarations.  Change
13209         u2_.relobj to Sized_relobj*.
13210         (class Output_data_reloc): Change add functions to use
13211         Sized_relobj*.
13212         * output.cc (Output_reloc::Output_reloc): Change relobj to
13213         Sized_relobj*.
13214         (Output_reloc::local_section_offset): Change return type to
13215         Elf_Addr.  Use get_output_section_offset.
13216         (Output_reloc::get_address): Likewise.
13217         (Output_section::is_input_address_mapped): Don't call
13218         is_section_specially_mapped.
13219         (Output_section::output_offset): Likewise.
13220         (Output_section::output_address): Likewise.
13221         (Output_section::starting_output_address): Likewise.
13222         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13223         parameter to Sized_relobj*.
13224         (Copy_relocs::need_copy_reloc): Likewise.
13225         (Copy_relocs::save): Likewise.
13226         * copy-relocs.h (class Copy_relocs): Update declarations.
13227         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13228         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13229         * target-reloc.h (relocate_for_relocatable): Change
13230         offset_in_output_section type to Elf_Addr.  Change code that uses
13231         it as well.
13232         * layout.cc (Layout::layout): Always set *off.
13233         * mapfile.cc (Mapfile::print_input_section): Use
13234         output_section_offset.
13235         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13236         Sized_relobj*.
13237         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13238         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13239         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13240
13241 2008-07-03  Ian Lance Taylor  <iant@google.com>
13242
13243         * layout.cc (Layout::include_section): Do not discard unrecognized
13244         SHT_STRTAB sections.
13245
13246 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13247
13248         * script.cc (Lex::can_continue_name): Make '?' allowable in
13249         version-script names.
13250         * testsuite/version_script.map: Change glob pattern to use '?'
13251
13252 2008-06-30  Manish Singh  <yosh@gimp.org>
13253
13254         PR 6585
13255         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13256         Correct typo.
13257
13258 2008-06-30  Ian Lance Taylor  <iant@google.com>
13259
13260         PR 6660
13261         PR 6682
13262         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13263         versions]: Don't try to read the value in the contents, since we
13264         don't use it.  Use the template endianness when writing.
13265
13266 2008-06-25  Cary Coutant  <ccoutant@google.com>
13267
13268         * fileread.cc (File_read::make_view): Assert on zero-length view.
13269         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13270         symbol table when there are no symbols to read.
13271
13272 2008-06-23  Craig Silverstein  <csilvers@google.com>
13273
13274         * version.cc (version_string): Bump to 1.7
13275
13276 2008-06-18  Craig Silverstein  <csilvers@google.com>
13277
13278         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13279         constant 0xFFFF to type Valtype.
13280         (Powerpc_relocate_functions::rel16_ha): Likewise.
13281
13282 2008-06-17  Ian Lance Taylor  <iant@google.com>
13283
13284         * output.h (Output_section::Input_section): Initialize p2align_ to
13285         zero for Output_section_data constructors.
13286         (Output_section::Input_section::addralign): If not an input
13287         section, return the alignment of the Output_section_data.
13288         * testsuite/copy_test.cc: New file.
13289         * testsuite/copy_test_1.cc: New file.
13290         * testsuite/copy_test_2.cc: New file.
13291         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13292         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13293         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13294         (copy_test_1_pic.o, copy_test_1.so): New targets.
13295         (copy_test_2_pic.o, copy_test_2.so): New targets.
13296         * testsuite/Makefile.in: Rebuild.
13297
13298         * script-sections.cc (Script_sections::place_orphan): Initialize
13299         local variable exact.
13300
13301 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13302
13303         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13304
13305 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13306             David S. Miller  <davem@davemloft.net>
13307
13308         * powerpc.cc: New file.
13309         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13310         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13311         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13312         * Makefile.in: Rebuild.
13313
13314 2008-06-09  Ian Lance Taylor  <iant@google.com>
13315
13316         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13317         <exception>.
13318         (throwing, orig_terminate): New static variables.
13319         (terminate_handler): New static function.
13320         (t2): Set terminate handler.
13321
13322 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13323
13324         PR 6584
13325         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13326         alignment.
13327
13328 2008-05-30  Cary Coutant  <ccoutant@google.com>
13329
13330         * archive.cc (Archive::include_all_members) Correct to step
13331         over symbol table and extended name table in thin archives.
13332
13333 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13334
13335         PR 6407
13336         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13337         calculation.
13338
13339 2008-05-28  Caleb Howe  <cshowe@google.com>
13340
13341         * reduced_debug_output.cc: New file.
13342         * reduced_debug_output.h: New file.
13343         * options.h (class General_options): Add --strip-debug-non-line.
13344         * options.cc (General_options::finalize): Add strip_debug_non_line
13345         to the strip heirarchy.
13346         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13347         fields.
13348         * layout.cc: Include "reduced_debug_output.h".
13349         (Layout::Layout): Initialize new fields.
13350         (line_only_debug_sections): New static array.
13351         (is_lines_only_debug_sections): New static inline function.
13352         (Layout::include_section): Handle --strip-debug-non-line.
13353         (Layout::make_output_section): If --strip-debug-non-line, build
13354         new output sections for .debug_abbrev and .debug_info.
13355         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13356         gold.  Warn about possible overflow.
13357         (read_signed_LEB_128): Likewise.
13358         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13359         (read_signed_LEB_128): Declare.
13360         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13361         (HFILES): Add reduced_debug_output.h.
13362         * Makefile.in: Rebuild.
13363
13364 2008-05-21  Ian Lance Taylor  <iant@google.com>
13365
13366         * mapfile.cc: New file.
13367         * mapfile.h: New file.
13368         * options.h (class General_options): Add -M/--print-map and -Map.
13369         * options.cc (General_options::finalize): Make -M equivalent to
13370         -Map -.
13371         * main.cc: Include <cstdio> and "mapfile.h".
13372         (main): Open mapfile if requested.
13373         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13374         constructor.  Change caller.
13375         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13376         (queue_middle_tasks): Likewise.
13377         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13378         declarations.
13379         * archive.cc: Include "mapfile.h".
13380         (Archive::add_symbols): Add mapfile parameter.  Change all
13381         callers.  Pass mapfile, symbol, and reason to include_member.
13382         (Archive::include_all_members): Add mapfile parameter.  Change all
13383         callers.
13384         (Archive::include_member): Add mapfile, sym, and why parameters.
13385         Change all callers.  Report inclusion to map file.
13386         * archive.h: Include "fileread.h".
13387         (class Archive): Update declarations.
13388         (Archive::file): New const method.
13389         (class Add_archive_symbols): Add mapfile_ field.  Update
13390         constructor.  Change all callers.
13391         * readsyms.h (class Read_symbols): Likewise.
13392         (class Finish_group): Likewise.
13393         (class Read_script): Likewise.
13394         * common.cc: Include "mapfile.h".
13395         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13396         all callers.
13397         (Symbol_table::do_allocate_commons): Likewise.
13398         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13399         symbol allocation to mapfile.
13400         * common.h (class Allocate_commons_task): Add mapfile_ field.
13401         Update constructor.  Change all callers.
13402         * symtab.h (class Symbol_table): Update declarations.
13403         * layout.cc: Include "mapfile.h".
13404         (Layout_task_runner::run): Print information to mapfile.
13405         (Layout::create_gold_note): Change Output_data_fixed_space to
13406         Output_data_zero_fill.
13407         (Layout::create_build_id): Likewise.
13408         (Layout::print_to_mapfile): New function.
13409         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13410         constructor.  Change caller.
13411         (class Layout): Declare print_to_mapfile.
13412         * output.cc (Output_section::Input_section::print_to_mapfile): New
13413         function.
13414         (Output_section::add_input_section): If producing a map, always
13415         add to input_sections_ list.
13416         (Output_section::do_print_to_mapfile): New function.
13417         (Output_segment::print_sections_to_mapfile): New function.
13418         (Output_segment::print_section_list_to_mapfile): New function.
13419         * output.h: Include "mapfile.h".
13420         (Output_data::print_to_mapfile): New function.
13421         (Output_data::do_print_to_mapfile): New virtual function.
13422         (Output_segment_headers::do_print_to_mapfile): New function.
13423         (Output_file_header::do_print_to_mapfile): New function.
13424         (Output_data_const::do_print_to_mapfile): New function.
13425         (class Output_data_const_buffer): Add map_name_ field.  Update
13426         constructor.  Change all callers.  Add do_print_to_mapfile
13427         function.
13428         (class Output_data_fixed_space): Likewise.
13429         (class Output_data_space): Likewise.
13430         (class Output_data_zero_fill): New class.
13431         (Output_data_strtab::do_print_to_mapfile): New function.
13432         (Output_data_reloc_base::do_print_to_mapfile): New function.
13433         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13434         (Output_data_group::do_print_to_mapfile): New function.
13435         (Output_data_got::do_print_to_mapfile): New function.
13436         (Output_data_dynamic::do_print_to_mapfile): New function.
13437         (Output_symtab_xindex::do_print_to_mapfile): New function.
13438         (class Output_section): Declare do_print_to_mapflie.  Declare
13439         print_to_mapfile in Input_section.
13440         (class Output_segment): Declare new functions.
13441         * object.h (Sized_relobj::symbol_count): New function.
13442         * script-sections.cc
13443         (Output_section_element_dot_assignment::set_section_addresses):
13444         Change Output_data_fixed_space to Output_data_zero_fill.
13445         (Output_data_expression::do_print_to_mapfile): New function.
13446         * script.cc (read_input_script): Add mapfile parameter.  Change
13447         all callers.
13448         * script.h (read_input_script): Update declaration.
13449         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13450         (Eh_frame::do_print_to_mapfile): New function.
13451         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13452         (Output_merge_string::do_print_to_mapfile): New function.
13453         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13454         function.
13455         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13456         function.
13457         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13458         function.
13459         * Makefile.am (CCFILES): Add mapfile.cc.
13460         (HFILES): Add mapfile.h.
13461         * Makefile.in: Rebuild.
13462
13463 2008-05-19  Ian Lance Taylor  <iant@google.com>
13464
13465         * options.h (class General_options): Add -z relro.
13466         * layout.cc (Layout::Layout): Initialize relro_segment_.
13467         (Layout::add_output_section_data): Return the output section.
13468         (Layout::make_output_section): Rcognize relro sections and mark
13469         them appropriately.
13470         (Layout::attach_allocated_section_to_segment): Put relro sections
13471         in a PT_GNU_RELRO segment.
13472         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13473         section as relro.
13474         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13475         PT_TLS segments.
13476         (Layout::linkonce_mapping): Map d.rel.ro.local to
13477         .data.rel.ro.local.
13478         (Layout::output_section_name): Us .data.rel.ro.local for any
13479         section which begins with that.
13480         * layout.h (class Layout): Update add_output_section_data
13481         declaration.  Add relro_segment_ field.
13482         * output.cc (Output_section::Output_section): Initialize is_relro_
13483         and is_relro_local_ fields.
13484         (Output_segment::add_output_section): Group relro sections.
13485         (Output_segment::is_first_section_relro): New function.
13486         (Output_segment::maximum_alignment): If there is a relro section,
13487         align the segment to the common page size.
13488         (Output_segment::set_section_addresses): Track whether we are
13489         looking at relro sections.  If the last section is a relro
13490         section, align to the common page size.
13491         (Output_segment::set_section_list_addresses): Add in_relro
13492         parameter.  Change all callers.  Align to the page size when
13493         moving from relro to non-relro section.
13494         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13495         segment.
13496         * output.h (class Output_section): Add is_relro_ and
13497         is_relro_local_ fields.
13498         (Output_section::is_relro): New function.
13499         (Output_section::set_is_relro): New function.
13500         (Output_section::is_relro_local): New function.
13501         (Output_section::set_is_relro_local): New function.
13502         (class Output_segment): Update declarations.
13503         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13504         * sparc.cc (Target_sparc::got_section): Likewise.
13505         * x86_64.cc (Target_x86_64::got_section): Likewise.
13506         * testsuite/relro_test_main.cc: New file.
13507         * testsuite/relro_test.cc: New file.
13508         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13509         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13510         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13511         (relro_test.so, relro_test_pic.o): New targets.
13512         * testsuite/Makefile.in: Rebuild.
13513
13514 2008-05-16  Ian Lance Taylor  <iant@google.com>
13515
13516         * output.cc (Output_segment::add_output_section): Remove front
13517         parameter.
13518         * output.h (class Output_segment): Remove
13519         add_initial_output_section and overloaded add_output_section.
13520         Update declaration of remaining add_output_section.
13521         * layout.cc (Layout::create_interp): Call add_output_section
13522         rather than add_initial_output_section.
13523         (Layout::finish_dynamic_section): Likewise.
13524
13525         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13526         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13527         know the dynamic type.
13528         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13529         field.  Initialize it in constructor.
13530         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13531         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13532         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13533         reloc.
13534
13535         * output.cc (Output_reloc::get_address): Change return type to
13536         Elf_Addr.
13537         * output.h (class Output_reloc): Update get_address declaration.
13538         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13539         for section addresses.
13540
13541 2008-05-09  Ian Lance Taylor  <iant@google.com>
13542
13543         PR 6493
13544         * gold.cc (gold_nomem): Use return value of write.
13545
13546 2008-05-08  Ian Lance Taylor  <iant@google.com>
13547
13548         * symtab.c (Symbol::init_base_output_data): Add version
13549         parameter.  Change all callers.
13550         (Symbol::init_base_output_segment): Likewise.
13551         (Symbol::init_base_constant): Likewise.
13552         (Symbol::init_base_undefined): Likewise.
13553         (Sized_symbol::init_output_data): Likewise.
13554         (Sized_symbol::init_output_segment): Likewise.
13555         (Sized_symbol::init_constant): Likewise.
13556         (Sized_symbol::init_undefined): Likewise.
13557         (Symbol_table::do_define_in_output_data): If the new symbol has a
13558         version, mark it as the default.
13559         (Symbol_table::do_define_in_output_segment): Likewise.
13560         (Symbol_table::do_define_as_constant): Likewise.
13561         * symtab.h (class Symbol): Update declarations.
13562         (class Sized_symbol): Likewise.
13563         * resolve.cc (Symbol::override_version): New function.
13564         (Symbol::override_base): Call override_version.
13565         (Symbol::override_base_with_special): Likewise.
13566         * testsuite/ver_script_8.script: New file.
13567         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13568         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13569         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13570         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13571
13572 2008-05-06  Ian Lance Taylor  <iant@google.com>
13573
13574         PR 6049
13575         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13576         functions.
13577         (class General_options): Remove existing --undefined, and add
13578         --no-undefined instead.  Add new --undefined as synonym for -u.
13579         * archive.cc (Archive::add_symbols): Check whether symbol was
13580         named with -u.
13581         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13582         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13583         all uses.  Add IS_UNDEFINED.  Update declarations to split
13584         different versions of init_base.  Declare init_base_undefined.
13585         (Symbol::is_defined): Handle IS_UNDEFINED.
13586         (Symbol::is_undefined): Likewise.
13587         (Symbol::is_weak_undefined): Call is_undefined.
13588         (Symbol::is_absolute): Handle IS_CONSTANT.
13589         (class Sized_symbol): Update declarations to split different
13590         versions of init.  Declare init_undefined.
13591         (class Symbol_table): Declare new functions.
13592         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13593         Change all callers.
13594         (Symbol::init_base_output_data): Likewise.
13595         (Symbol::init_base_output_segment): Likewise.
13596         (Symbol::init_base_constant): Likewise.
13597         (Symbol::init_base_undefined): New function.
13598         (Sized_symbol::init_object): Rename from init.  Change all
13599         callers.
13600         (Sized_symbol::init_output_data): Likewise.
13601         (Sized_symbol::init_output_segment): Likewise.
13602         (Sized_symbol::init_constant): Likewise.
13603         (Sized_symbol::init_undefined): New function.
13604         (Symbol_table::add_undefined_symbols_from_command_line): New
13605         function.
13606         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13607         function.
13608         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13609         (Symbol::output_section): Likewise.
13610         (Symbol::set_output_section): Likewise.
13611         (Symbol_table::sized_finalize_symbol): Likewise.
13612         (Symbol_table::sized_write_globals): Likewise.
13613         * resolve.cc (Symbol_table::should_override): Likewise.
13614         (Symbol::override_base_with_special): Likewise.
13615
13616         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13617         symbol, change it to have default visibility.
13618         * testsuite/protected_1.cc: New file.
13619         * testsuite/protected_2.cc: New file.
13620         * testsuite/protected_3.cc: New file.
13621         * testsuite/protected_main_1.cc: New file.
13622         * testsuite/protected_main_2.cc: New file.
13623         * testsuite/protected_main_3.cc: New file.
13624         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13625         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13626         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13627         (protected_1.so): New target.
13628         (protected_1_pic.o, protected_2_pic.o): New targets.
13629         (protected_3_pic.o): New target.
13630         (check_PROGRAMS): Add protected_2.
13631         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13632         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13633         * testsuite/Makefile.in: Rebuild.
13634
13635         * options.h (DEFINE_var): Add set_user_set_##varname__.
13636         (DEFINE_bool_alias): New macro.
13637         (class General_options): Define -Bstatic using DEFINE_bool_alias
13638         rather than DEFINE_special.  Add --undefined as an alias for -z
13639         defs.
13640         * options.cc (General_options::parse_Bstatic): Remove.
13641
13642         * options.h (class General_options): Add --fatal-warnings.
13643         * main.cc (main): Implement --fatal-warnings.
13644         * errors.h (Errors::warning_count): New function.
13645
13646         * options.h (class General_options): Add -Bsymbolic-functions.
13647         * symtab.h (Symbol::is_preemptible): Check for
13648         -Bsymbolic-functions.
13649
13650 2008-05-05  Ian Lance Taylor  <iant@google.com>
13651
13652         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13653         as noVARNAME rather than no-VARNAME.
13654         (class General_options): Add option -z combreloc.
13655         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13656         get_address.
13657         (Output_reloc::sort_before) [SHT_REL]: New function.
13658         (Output_reloc::sort_before) [SHT_RELA]: New function.
13659         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13660         Sort_relocs_comparison.
13661         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13662         parameter.  Change all callers.
13663         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13664         sort_relocs parameter.  Change all callers.
13665         * output.cc (Output_reloc::get_address): New function, broken out
13666         of write_rel.
13667         (Output_reloc::write_rel): Call it.
13668         (Output_reloc::compare): New function.
13669         (Output_data_reloc_base::do_write): Optionally sort relocs.
13670
13671         * configure.ac: If targ_extra_obj is set, link it in.
13672         * configure.tgt: Initialize all variables.
13673         (x86_64*): Set targ_extra_obj and targ_extra_size.
13674         * configure: Rebuild.
13675
13676         * object.cc (Sized_relobj::include_section_group): Adjust section
13677         indexes read from group data.  Build vector to pass to
13678         layout_group.
13679         * layout.cc (Layout::layout_group): Add flags and shndxes
13680         parameters.  Remove contents parameter.  Change caller.  Update
13681         explicit instantiations.
13682         * layout.h (class Layout): Update layout_group declaration.
13683         * output.cc (Output_data_group::Output_data_group): Add flags and
13684         input_shndxes parameters.  Remove contents parameter.  Change
13685         caller.
13686         (Output_data_group::do_write): Change input_sections_ to
13687         input_shndxes_.
13688         * output.h (class Output_data_group): Update constructor
13689         declaration.  Rename input_sections_ to input_shndxes_.
13690         * testsuite/many_sections_test.cc: Add template.
13691
13692 2008-04-30  Cary Coutant  <ccoutant@google.com>
13693
13694         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13695
13696         * layout.cc (Layout::include_section): Refactored check for debug
13697         info section.
13698         (Layout::add_comdat): Add new parameters.  Change type
13699         of signature parameter.  Add object and shndx to signatures table.
13700         (Layout::find_kept_object): New function.
13701         * layout.h: Include <cstring>.
13702         (Layout::is_debug_info_section): New function.
13703         (Layout::add_comdat): Add new parameters.
13704         (Layout::find_kept_object): New function.
13705         (Layout::Kept_section): New struct.
13706         (Layout::Signatures): Change type of map range.
13707         * object.cc (Relobj::output_section_address): New function.
13708         (Sized_relobj::include_section_group): Add new parameters.  Change
13709         calls to Layout::add_comdat.  Change to build table of kept comdat
13710         groups and table mapping discarded sections to kept sections.
13711         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13712         (Sized_relobj::do_layout): Change calls to include_section_group and
13713         include_linkonce_section.
13714         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13715         value to zero when section is discarded.
13716         (Sized_relobj::map_to_kept_section): New function.
13717         * object.h (Relobj::output_section_address): New function.
13718         (Relobj::Comdat_group): New type.
13719         (Relobj::find_comdat_group): New function.
13720         (Relobj::Comdat_group_table): New type.
13721         (Relobj::Kept_comdat_section): New type.
13722         (Relobj::Kept_comdat_section_table): New type.
13723         (Relobj::add_comdat_group): New function.
13724         (Relobj::set_kept_comdat_section): New function.
13725         (Relobj::get_kept_comdat_section): New function.
13726         (Relobj::comdat_groups_): New field.
13727         (Relobj::kept_comdat_sections_): New field.
13728         (Symbol_value::input_value): Update comment.
13729         (Sized_relobj::map_to_kept_section) New function.
13730         (Sized_relobj::include_linkonce_section): Add new parameter.
13731         * target-reloc.h (Comdat_behavior): New type.
13732         (get_comdat_behavior): New function.
13733         (relocate_section): Add code to map a discarded section to the
13734         corresponding kept section when applying a relocation.
13735
13736 2008-04-30  Craig Silverstein  <csilvers@google.com>
13737
13738         * dwarf_reader.cc (next_generation_count): New static var.
13739         (Addr2line_cache_entry): New struct.
13740         (addr2line_cache): New static var.
13741         (Dwarf_line_info::one_addr2line): Added caching.
13742         (Dwarf_line_info::clear_addr2line_cache): New function.
13743         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13744         cache-size parameter.
13745         (Dwarf_line_info::one_addr2line_cache): New function.
13746         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13747         new cache-size argument to one_addr2line(), and clear cache.
13748
13749 2008-04-28  Cary Coutant  <ccoutant@google.com>
13750
13751         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13752         R_386_PC8 relocations.
13753
13754 2008-04-23  Ian Lance Taylor  <iant@google.com>
13755
13756         * object.cc (Sized_relobj::include_section_group): Check for
13757         invalid section group.
13758
13759         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13760         header size.
13761
13762         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13763         than read for file header.
13764         * archive.cc (Archive::include_member): Likewise.
13765
13766 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13767
13768         * aclocal.m4: Regenerate.
13769         * configure: Regenerate.
13770
13771 2008-04-19  Ian Lance Taylor  <iant@google.com>
13772
13773         * version.cc (version_string): Bump to 1.6.
13774
13775         * testsuite/Makefile.am (many_sections_r_test): New target.
13776         (many_sections_r_test_SOURCES): Remove.
13777         (many_sections_r_test_DEPENDENCIES): Remove.
13778         (many_sections_r_test_LDFLAGS): Remove.
13779         (many_sections_r_test_LDADD): Remove.
13780
13781         * object.cc (Sized_relobj::do_add_symbols): Always pass
13782         local_symbol_count_ to add_from_relobj.
13783
13784         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13785         every thousand variables.
13786         * testsuite/Makefile.in: Rebuild.
13787
13788         * object.cc (Xindex::initialize_symtab_xindex): New function.
13789         (Xindex::read_symtab_xindex): New function.
13790         (Xindex::sym_xindex_to_shndx): New function.
13791         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13792         available.
13793         (Sized_relobj::do_initialize_xindex): New function.
13794         (Sized_relobj::do_read_symbols): Adjust section links.
13795         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13796         parameter.  Change all callers.
13797         (Sized_relobj::include_section_group): Adjust section links and
13798         symbol section indexes.
13799         (Sized_relobj::do_layout): Adjust section links.
13800         (Sized_relobj::do_count_local_symbols): Adjust section links and
13801         symbol section indexes.
13802         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13803         ordinary and special symbols.
13804         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13805         dynsym_xindex parameters.  Change all callers.  Adjust section
13806         links.  Use SHN_XINDEX when needed.
13807         (Sized_relobj::get_symbol_location_info): Adjust section links.
13808         Don't get fooled by special symbols.
13809         * object.h (class Xindex): Define.
13810         (class Object): Add xindex_ parameter.  Declare virtual functoin
13811         do_initialize_xindex.
13812         (Object::adjust_sym_shndx): New function.
13813         (Object::set_xindex): New protected function.
13814         (class Symbol_value): Add is_ordinary_shndx_ field.
13815         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13816         (Symbol_value::value): Assert ordinary section.
13817         (Symbol_value::initialize_input_to_output_map): Likewise.
13818         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13819         Change all callers.
13820         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13821         all callers.
13822         (class Sized_relobj): Update declarations.
13823         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13824         parameter.  Change all callers.
13825         (Sized_relobj::adjust_shndx): New function.
13826         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13827         field.
13828         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13829         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13830         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13831         (Sized_dynobj::read_dynsym_section): Adjust section links.
13832         (Sized_dynobj::read_dynamic): Likewise.
13833         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13834         section links.
13835         (Sized_dynobj::do_initialize_xindex): New function.
13836         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13837         do_initialize_xindex.
13838         (Sized_dynobj::adjust_shndx): New function.
13839         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13840         dynsym_xindex_ fields.
13841         (Layout::finalize): Add a call to set_section_indexes before
13842         creating the symtab sections.
13843         (Layout::set_section_indexes): Don't do anything if the section
13844         already has a section index.
13845         (Layout::create_symtab_sections): Add shnum parameter.  Change
13846         caller.  Create .symtab_shndx section if needed.
13847         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13848         caller.
13849         (Layout::allocated_output_section_count): New function.
13850         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13851         needed.
13852         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13853         fields.  Update declarations.
13854         (Layout::symtab_xindex): New function.
13855         (Layout::dynsym_xindex): New function.
13856         (class Write_symbols_task): Add layout_ field.
13857         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13858         Change caller.
13859         * output.cc (Output_section_headers::Output_section_headers): Add
13860         shstrtab_section parameter.  Change all callers.
13861         (Output_section_headers::do_sized_write): Store overflow values
13862         for section count and section string table section index in
13863         section header zero.
13864         (Output_file_header::do_sized_write): Check for overflow of
13865         section count and section string table section index.
13866         (Output_symtab_xindex::do_write): New function.
13867         (Output_symtab_xindex::endian_do_write): New function.
13868         * output.h (class Output_section_headers): Add shstrtab_section_.
13869         Update declarations.
13870         (class Output_symtab_xindex): Define.
13871         (Output_section::has_out_shndx): New function.
13872         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13873         field.
13874         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13875         Change all callers.
13876         (Sized_symbol::init): Likewise.
13877         (Symbol::output_section): Check for ordinary symbol.
13878         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13879         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13880         callers.
13881         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13882         Change all callers.  Simplify handling of symbols from sections
13883         not included in the link.
13884         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13885         distinction.
13886         (Weak_alias_sorter::operator()): Assert that symbols are
13887         ordinary.
13888         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13889         distinction.
13890         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13891         parameters.  Change all callers.
13892         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13893         symbol distinction.  Use SHN_XINDEX when needed.
13894         (Symbol_table::write_section_symbol): Add symtab_xindex
13895         parameter.  Change all callers.
13896         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13897         SHN_XINDEX when needed.
13898         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13899         declarations.
13900         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13901         (Symbol::is_defined): Check is_ordinary.
13902         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13903         (Symbol::is_absolute, Symbol::is_common): Likewise.
13904         (class Sized_symbol): Update declarations.
13905         (class Symbol_table): Update declarations.
13906         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13907         parameters.  Change all callers.
13908         (Sized_symbol::override): Likewise.
13909         (Symbol_table::override): Likewise.
13910         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13911         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13912         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13913         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13914         to be in an ordinary section.
13915         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13916         object and is_ordinary parameters.  Change all callers.
13917         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13918         Change all callers.  Don't add undefined or non-ordinary symbols
13919         to reloc_map_.
13920         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13921         Change all callers.
13922         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13923         declarations.
13924         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13925         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13926         (Sized_relobj::relocate_sections): Likewise.
13927         * target-reloc.h (scan_relocs): Adjust section symbol index.
13928         (scan_relocatable_relocs): Likewise.
13929         * i386.cc (Scan::local): Check for ordinary symbols.
13930         * sparc.cc (Scan::local): Likewise.
13931         * x86_64.cc (Scan::local): Likewise.
13932         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13933         to symbol_section_and_value.
13934         * testsuite/many_sections_test.cc: New file.
13935         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13936         (check_PROGRAMS): Add many_sections_test.
13937         (many_sections_test_SOURCES): Define.
13938         (many_sections_test_DEPENDENCIES): Define.
13939         (many_sections_test_LDFLAGS): Define.
13940         (BUILT_SOURCES): Add many_sections_define.h.
13941         (many_sections_define.h): New target.
13942         (BUILT_SOURCES): Add many_sections_check.h.
13943         (many_sections_check.h): New target.
13944         (check_PROGRAMS): Add many_sections_r_test.
13945         (many_sections_r_test_SOURCES): Define.
13946         (many_sections_r_test_DEPENDENCIES): Define.
13947         (many_sections_r_test_LDFLAGS): Define.
13948         (many_sections_r_test_LDADD): Define.
13949         (many_sections_r_test.o): New target.
13950         * testsuite/Makefile.in: Rebuild.
13951
13952 2008-04-17  Cary Coutant  <ccoutant@google.com>
13953
13954         * errors.cc (Errors::info): New function.
13955         (gold_info): New function.
13956         * errors.h (Errors::info): New function.
13957         * gold.h (gold_info): New function.
13958         * object.cc (Input_objects::add_object): Print trace output.
13959         * options.cc (options::parse_set): New function.
13960         (General_options::parse_wrap): Deleted.
13961         (General_options::General_options): Deleted initializer.
13962         * options.h (options::String_set): New typedef.
13963         (options::parse_set): New function.
13964         (DEFINE_set): New macro.
13965         (General_options::wrap): Changed to use DEFINE_set. Changed
13966         callers of any_wrap_symbols and is_wrap_symbol.
13967         (General_options::trace, General_options::trace_symbol):
13968         New options.
13969         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13970         (General_options::wrap_symbols_): Deleted.
13971         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13972
13973 2008-04-17  David S. Miller  <davem@davemloft.net>
13974
13975         * options.cc (General_options::parse_V): New function.
13976         * options.h: Add entries for -V and -Qy.
13977
13978 2008-04-17  Ian Lance Taylor  <iant@google.com>
13979
13980         * common.cc (Symbol_table::allocate_commons): Remove options
13981         parameter.  Change caller.
13982         (Symbol_table::do_allocate_commons): Remove options parameter.
13983         Change caller.  Just call do_allocate_commons_list twice.
13984         (Symbol_table::do_allocate_commons_list): New function, broken out
13985         of do_allocate_commons.
13986         * common.h (class Allocate_commons_task): Remove options_ field.
13987         Update constructor.
13988         * symtab.cc (Symbol_table::Symbol_table): Initialize
13989         tls_commons_.
13990         (Symbol_table::add_from_object): Put TLS common symbols on
13991         tls_commons_ list.
13992         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13993         which are IN_OUTPUT_DATA.
13994         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13995         allocate_commons and do_allocate_commons declarations.  Declare
13996         do_allocate_commons_list.
13997         * gold.cc (queue_middle_tasks): Update creation of
13998         Allocate_commons_task to not pass options.
13999         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14000         (TLS_TEST_C_FLAGS): New variable.
14001         (tls_test_c_pic.o): New target.
14002         (tls_test_shared.so): Link in tls_test_c_pic.o.
14003         (tls_test_c_pic_ie.o): New target.
14004         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14005         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14006         (tls_test_c.o): New target.
14007         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14008         (tls_pic_test_LDADD): Likewise.
14009         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14010         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14011         (tls_test_c_gnu2.o): New target.
14012         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14013         tls_test_c_gnu2.o.
14014         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14015         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14016         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14017         * testsuite/tls_test.cc: Include "config.h".
14018         (t_last): Call t11_last.
14019         * testsuite/tls_test.h (t11, t11_last): Declare.
14020         * testsuite/tls_test_c.c: New file.
14021         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14022         * configure.ac: Check for OpenMP support.
14023         * configure, config.in, Makefile.in: Rebuild.
14024         * testsuite/Makefile.in: Rebuild.
14025
14026 2008-04-16  Cary Coutant  <ccoutant@google.com>
14027
14028         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14029         (Target_i386::tls_base_symbol_defined_): New field.
14030         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14031         (Target_i386::Scan::global): Likewise.
14032         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14033         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14034         (Target_x86_64::tls_base_symbol_defined_): New field.
14035         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14036         (Target_x86_64::Scan::global): Likewise.
14037
14038 2008-04-16  Cary Coutant  <ccoutant@google.com>
14039
14040         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14041         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14042         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14043         building shared libraries.
14044         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14045         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14046         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14047         * testsuite/Makefile.in: Rebuild.
14048         * testsuite/weak_undef.h: New file.
14049         * testsuite/weak_undef_file1.cc: Add extra test cases.
14050         * testsuite/weak_undef_file2.cc: Likewise.
14051         * testsuite/weak_undef_test.cc: Likewise.
14052
14053 2008-04-16  David S. Miller  <davem@davemloft.net>
14054
14055         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14056         Add issued_non_pic_error_ field.  Declare check_non_pic.
14057         (Target_sparc::Scan::check_non_pic): New function.
14058         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14059         (Target_sparc::Scan::global): Likewise.
14060
14061         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14062         * configure: Rebuild.
14063
14064         * options.h (DEFINE_enable): New macro.
14065         (new_dtags): New enable option.
14066         (initfirst, interpose, loadfltr, nodefaultlib,
14067         nodelete, nodlopen, nodump): New -z options.
14068         * layout.cc (Layout:finish_dynamic_section): If new
14069         dtags enabled, emit DT_RUNPATH.  Also, emit a
14070         DT_FLAGS_1 containing any specified -z flags.
14071
14072 2008-04-16  Ian Lance Taylor  <iant@google.com>
14073
14074         * copy-relocs.cc: New file.
14075         * copy-relocs.h: New file.
14076         * reloc.cc: Remove Copy_relocs code.
14077         * reloc.h: Likewise.
14078         * reloc-types.h (struct Reloc_types) [both versions]: Add
14079         get_reloc_addend_noerror.
14080         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14081         variants of add_global which take an addend which must be zero.
14082         * i386.cc: Include "copy-relocs.h".
14083         (class Target_i386): Change type of copy_relocs_ to variable,
14084         update initializer.
14085         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14086         Change all callers.
14087         (Target_i386::do_finalize_sections): Change handling of
14088         copy_relocs_.
14089         * sparc.cc: Include "copy-relocs.h".
14090         (class Target_sparc): Change type of copy_relocs_ to variable,
14091         update initializer.
14092         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14093         Change all callers.
14094         (Target_sparc::do_finalize_sections): Change handling of
14095         copy_relocs_.
14096         * x86_64.cc: Include "copy-relocs.h".
14097         (class Target_x86_64): Change type of copy_relocs_ to variable,
14098         update initializer.
14099         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14100         class.  Change all callers.
14101         (Target_x86_64::do_finalize_sections): Change handling of
14102         copy_relocs_.
14103         * Makefile.am (CCFILES): Add copy-relocs.cc.
14104         (HFILES): Add copy-relocs.h.
14105
14106         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14107
14108         * testsuite/script_test_4.sh: Permit leading zeroes.
14109
14110 2008-04-15  Ian Lance Taylor  <iant@google.com>
14111
14112         * script-sections.cc (Script_sections::create_segments): Use
14113         header_size_adjustment even when there is enough room for the
14114         headers.
14115         * testsuite/script_test_4.sh: New file.
14116         * testsuite/script_test_4.t: New file.
14117         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14118         (check_DATA): Add script_test_4.stdout.
14119         (MOSTLYCLEANFILES): Likewise.
14120         (script_test_4): New target.
14121         (script_test_4.stdout): New target.
14122         * testsuite/Makefile.in: Rebuild.
14123
14124         * sparc.cc: Add definitions for Output_data_plt_sparc class
14125         constants.
14126
14127 2008-04-14  David S. Miller  <davem@davemloft.net>
14128
14129         * sparc.cc: New file.
14130         * Makefile.am (TARGETSOURCES): Add sparc.cc
14131         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14132         * configure.tgt: Document targ_extra_size and
14133         targ_extra_big_endian.  Add entries for sparc-* and
14134         sparc64-*.
14135         * configure.ac: Handle targ_extra_size and
14136         targ_extra_big_endian.
14137         * Makefile.in: Rebuild.
14138         * configure: Likewise.
14139         * po/POTFILES.in: Likewise.
14140         * po/gold.pot: Likewise.
14141
14142 2008-04-14  Ian Lance Taylor  <iant@google.com>
14143
14144         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14145         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14146         in the name/type/flags to section mapping.  Don't call
14147         allocate_output_section.
14148         (Layout::choose_output_section): Change parameter from adjust_name
14149         to is_input_section.  Don't permit input sections after sections
14150         are attached to segments.  Don't call allocate_output_section.
14151         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14152         not write_enable_output_section.
14153         (Layout::make_output_section): Don't push to
14154         unattached_section_list_ nor call attach_to_segment.  Call
14155         attach_section_to_segment if sections are attached.
14156         (Layout::attach_sections_to_segments): New function.
14157         (Layout::attach_section_to_segment): New function.
14158         (Layout::attach_allocated_section_to_segment): Rename from
14159         attach_to_segment.  Remove flags parameter.
14160         (Layout::allocate_output_section): Remove function.
14161         (Layout::write_enable_output_section): Remove function.
14162         * layout.h (class Layout): Update for above changes.  Add new
14163         field sections_are_attached_.
14164         * output.h (Output_section::update_flags_for_input_section): New
14165         function.
14166         * output.cc (Output_section::add_input_section): Call
14167         update_flags_for_input_section.
14168         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14169
14170 2008-04-11  Cary Coutant  <ccoutant@google.com>
14171
14172         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14173         thought unnecessary.
14174         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14175
14176 2008-04-11  Ian Lance Taylor  <iant@google.com>
14177
14178         * output.h (class Output_section_data): Remove inline definition
14179         of set_addralign.
14180         * output.cc (Output_section_data::set_addralign): New function.
14181
14182 2008-04-11  Cary Coutant  <ccoutant@google.com>
14183
14184         Add support for TLS descriptors for i386 and x86_64.
14185         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14186         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14187         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14188         GOT_TYPE_TLS_DESC.
14189         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14190         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14191         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14192         relocations.
14193         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14194         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14195         Fix problem with initial-exec relocations.
14196         (Target_i386::Relocate::relocate_tls): Likewise.
14197         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14198         relaxation.
14199         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14200         support for section-plus-offset dynamic table entries.
14201         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14202         (Output_data_dynamic::Dynamic_entry): Add support for
14203         section-plus-offset dynamic table entries.
14204         (Output_data_dynamic::Classification): Likewise.
14205         (Output_data_dynamic::classification_): Renamed offset_.
14206         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14207         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14208         (Target_x86_64::make_plt_section): New function.
14209         (Target_x86_64::reserve_tlsdesc_entries): New function.
14210         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14211         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14212         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14213         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14214         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14215         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14216         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14217         add extra PLT entry for TLS descriptors.
14218         (Output_data_plt_x86_64::got_): New field.
14219         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14220         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14221         fields.
14222         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14223         descriptors.
14224         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14225         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14226         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14227         R_386_TLS_DESC_CALL relocations.
14228         (Target_x86_64::Scan::global): Likewise.
14229         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14230         for TLS descriptors.
14231         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14232         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14233         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14234         GD-to-IE relaxation.
14235         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14236         and TLS_DESCRIPTORS.
14237         * Makefile.in: Rebuild.
14238         * configure: Rebuild.
14239         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14240         (tls_test_shared2.so): New target.
14241         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14242         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14243         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14244         (tls_shared_gd_to_ie_test_LDADD): New variable.
14245         (tls_shared_gnu2_gd_to_ie_test): New target.
14246         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14247         New targets.
14248         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14249         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14250         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14251         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14252         (tls_shared_gnu2_test): New target.
14253         (tls_test_gnu2_shared.so): New target.
14254         (tls_shared_gnu2_test_SOURCES): New variable.
14255         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14256         (tls_shared_gnu2_test_LDFLAGS): New variable.
14257         (tls_shared_gnu2_test_LDADD): New variable.
14258         * testsuite/Makefile.in: Rebuild.
14259         * testsuite/Makefile.
14260
14261 2008-04-11  Ian Lance Taylor  <iant@google.com>
14262
14263         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14264         justsyms.t.
14265         * testsuite/Makefile.in: Rebuild.
14266
14267         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14268         long.
14269         * testsuite/script_test_2.cc (main): Adjust test.
14270
14271 2008-04-11  David S. Miller  <davem@davemloft.net>
14272             Ian Lance Taylor  <iant@google.com>
14273
14274         * options.h (General_options): Add entries for '-Y' and
14275         '-relax'.
14276         * options.cc (General_options:finalize): If -Y was used, add those
14277         entries to the library path instead of the default "/lib" and
14278         "/usr/lib".
14279
14280 2008-04-11  David S. Miller  <davem@davemloft.net>
14281
14282         * testsuite/justsyms.t: Start at 0x100.
14283         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14284         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14285         long.
14286         * testsuite/script_test_2.cc: Adjust string and section length
14287         checks.
14288
14289 2008-04-09  Ian Lance Taylor  <iant@google.com>
14290
14291         PR gold/5996
14292         * script-sections.cc (Sections_element::allocate_to_segment): Add
14293         orphan parameter.
14294         (Output_section_definition::allocate_to_segment): Likewise.
14295         (Orphan_output_section::allocate_to_segment): Likewise.
14296         (Script_sections::attach_sections_using_phdrs_clause): Don't
14297         propagate non-PT_LOAD segments to orphan sections.
14298         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14299         readelf rather than objdump.
14300         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14301         .interp section and PT_INTERP segment are the same size.
14302         * testsuite/Makefile.in: Rebuild.
14303
14304         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14305         aliases for symbols defined in the same object.
14306         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14307         (weak_alias_test_SOURCES): New variable.
14308         (weak_alias_test_DEPENDENCIES): New variable.
14309         (weak_alias_test_LDFLAGS): New variable.
14310         (weak_alias_test_LDADD): New variable.
14311         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14312         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14313         (weak_alias_test_3.o): New target.
14314         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14315         * testsuite/weak_alias_test_main.cc: New file.
14316         * testsuite/weak_alias_test_1.cc: New file.
14317         * testsuite/weak_alias_test_2.cc: New file.
14318         * testsuite/weak_alias_test_3.cc: New file.
14319
14320 2008-04-08  Ian Lance Taylor  <iant@google.com>
14321
14322         * options.h (class General_options): Add --noinhibit-exec option.
14323         * main.cc (main): Check --noinhibit-exec.
14324
14325         * options.h (class General_options): Define --wrap as a special
14326         option.  Add wrap_symbols_ field.
14327         (General_options::any_wrap_symbols): New function.
14328         (General_options::is_wrap_symbol): New function.
14329         * options.cc (General_options::parse_wrap): New function.
14330         (General_options::General_options): Initialize wrap_symbols_.
14331         * symtab.cc (Symbol_table::wrap_symbol): New function.
14332         (Symbol_table::add_from_object): Handle --wrap.
14333         * symtab.h (class Symbol_table): Declare wrap_symbol.
14334         * target.h (Target::wrap_char): New function.
14335         (Target::Target_info): Add wrap_char field.
14336         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14337         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14338         * testsuite/testfile.cc (Target_test::test_target_info):
14339         Likewise.
14340
14341         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14342         there is one.
14343
14344         * layout.h (class Layout): Add added_eh_frame_data_ field.
14345         * layout.cc (Layout::Layout): Initialize new field.
14346         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14347         output section until we find a section we merged successfully.
14348         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14349         that the size be non-zero.
14350
14351         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14352         qualifier.
14353
14354 2008-04-08  Craig Silverstein  <csilvers@google.com>
14355
14356         * configure.ac: Export new conditional variable HAVE_ZLIB.
14357         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14358         on HAVE_ZLIB.
14359         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14360         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14361
14362 2008-04-07  Ian Lance Taylor  <iant@google.com>
14363
14364         * version.cc (version_string): Set to "1.5".
14365
14366         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14367         Add issued_non_pic_error_ field.  Declare check_non_pic.
14368         (Target_x86_64::Scan::check_non_pic): New function.
14369         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14370         (Target_x86_64::Scan::global): Likewise.
14371
14372         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14373         addend parameter.  Change caller.  Handle merge sections.
14374         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14375         Address to Addend.  Don't add in the result of
14376         local_section_offset, pass down the addend and use the returned
14377         value.
14378         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14379         Update declarations of local_section_offset and symbol_value.
14380         * testsuite/two_file_test_1.cc (t18): New function.
14381         * testsuite/two_file_test_2.cc (f18): New function.
14382         * testsuite/two_file_test_main.cc (main): Call t18.
14383         * testsuite/two_file_test.h (t18, f18): Declare.
14384
14385         * configure.ac: Don't test for objdump, c++filt, or readelf.
14386         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14387         conditionals.
14388         (TEST_READELF): New variable.
14389         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14390         (check_PROGRAMS): Add two_file_strip_test.
14391         (two_file_strip_test): New target.
14392         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14393         (two_file_same_shared_strip_test_SOURCES): New variable.
14394         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14395         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14396         (two_file_same_shared_strip_test_LDADD): New variable.
14397         (two_file_shared_strip.so): New target.
14398         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14399         (ver_test_5.syms, ver_test_7.syms): Likewise.
14400         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14401         (strip_test_3.stdout): Use TEST_OBJDUMP.
14402         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14403
14404 2008-04-04  Cary Coutant  <ccoutant@google.com>
14405
14406         * symtab.h (Symbol::is_weak_undefined): New function.
14407         (Symbol::is_strong_undefined): New function.
14408         (Symbol::is_absolute): New function.
14409         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14410         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14411         absolute symbols.
14412         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14413         (weak_undef_test): New target.
14414         * testsuite/Makefile.in: Rebuild.
14415         * testsuite/weak_undef_file1.cc: New file.
14416         * testsuite/weak_undef_file2.cc: New file.
14417         * testsuite/weak_undef_test.cc: New file.
14418
14419 2008-04-03  Craig Silverstein  <csilvers@google.com>
14420
14421         * compressed_output.h (class Output_compressed_section): Use
14422         unsigned buffer.
14423         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14424         add zlib header.
14425         (zlib_compressed_suffix): Removed.
14426         (Output_compressed_section::set_final_data_size): Use unsigned
14427         buffers.
14428         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14429         Fix linker invocation.
14430         (flagstest_o_specialfile_and_compress_debug_sections):
14431         Likewise.
14432         * testsuite/Makefile.in: Regenerated.
14433
14434 2008-04-02  David S. Miller  <davem@davemloft.net>
14435
14436         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14437         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14438
14439 2008-04-02  Craig Silverstein  <csilvers@google.com>
14440
14441         * TODO: New file.
14442
14443 2008-04-02  Ian Lance Taylor  <iant@google.com>
14444
14445         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14446         parameters.  Update for new key type to views_.  Change all
14447         callers.
14448         (File_read::read): Adjust for byteshift in returned view.
14449         (File_read::add_view): New function, broken out of
14450         find_and_make_view.
14451         (File_read::make_view): New function, broken out of
14452         find_and_make_view.
14453         (File_read::find_or_make_view): Add offset and aligned
14454         parameters.  Rewrite accordingly.  Change all callers.
14455         (File_read::get_view): Add offset and aligned parameters.  Adjust
14456         for byteshift in return value.
14457         (File_read::get_lasting_view): Likewise.
14458         * fileread.h (class File_read): Update declarations.
14459         (class File_read::View): Add byteshift_ field.  Add byteshift to
14460         constructor.  Add byteshift method.
14461         * archive.h (Archive::clear_uncached_views): New function.
14462         (Archive::get_view): Add aligned parameter.  Change all callers.
14463         * object.h (Object::get_view): Add aligned parameter.  Change all
14464         callers.
14465         (Object::get_lasting_view): Likewise.
14466
14467         * fileread.cc (File_read::release): Don't call clear_views if
14468         there are multiple objects.
14469         * fileread.h (File_read::clear_uncached_views): New function.
14470         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14471         on the archive.
14472
14473 2008-03-31  Cary Coutant  <ccoutant@google.com>
14474
14475         Add thin archive support.
14476         * archive.cc (Archive::armagt): New const.
14477         (Archive::setup): Remove task parameter and calls to unlock.
14478         (Archive::unlock_nested_archives): New function.
14479         (Archive::read_header): Add nested_off parameter. Change
14480         all callers.
14481         (Archive::interpret_header): Likewise.
14482         (Archive::include_all_members): Change to handle thin
14483         archives.
14484         (Archive::include_member): Likewise.
14485         * archive.h (Archive::Archive): Add new parameters and
14486         initializers.
14487         (Archive::armagt): New const.
14488         (Archive::setup): Remove task parameter.
14489         (Archive::unlock_nested_archives): New function.
14490         (Archive::read_header): Add nested_off parameter.
14491         (Archive::interpret_header): Likewise.
14492         (Archive::Nested_archive_table): New typedef.
14493         (Archive::is_thin_archive_): New field.
14494         (Archive::nested_archives_): New field.
14495         (Archive::options_): New field.
14496         (Archive::dirpath_): New field.
14497         (Archive::task_): New field.
14498         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14499         for thin archives.  Pass additional parameters to
14500         Archive::Archive.  Unlock the archive file after calling
14501         Archive::setup.
14502
14503 2008-03-29  Ian Lance Taylor  <iant@google.com>
14504
14505         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14506         version symbol to be local.
14507         * testsuite/ver_test_4.sh: New file.
14508         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14509         (check_DATA): Add ver_test_4.syms.
14510         (ver_test_4.syms): New target.
14511         * testsuite/Makefile.in: Rebuild.
14512
14513         * output.cc
14514         (Output_section::Input_section_sort_entry::has_priority): New
14515         function.
14516         (Output_section::Input_section_sort_entry::match_file_name): New
14517         function.
14518         (Output_section::Input_section_sort_entry::match_section_name):
14519         Remove.
14520         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14521         Remove.
14522         (Output_section::Input_section_sort_entry::match_section_file):
14523         Remove.
14524         (Output_section::Input_section_sort_compare::operator()): Rewrite
14525         using new Input_section_sort_entry functions.  Sort crtbegin and
14526         crtend first.  Sort sections with no priority before sections with
14527         a priority.
14528         * testsuite/initpri1.c (d3): Check j != 4.
14529         (cd5): New constructor/destructor function.
14530         (main): Check j != 2.
14531
14532         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14533         new symbol when resolving, don't call set_is_default.
14534         * testsuite/ver_test_7.cc: New file.
14535         * testsuite/ver_test_7.sh: New file.
14536         * testsuite/Makefile.am (ver_test_7.so): New target.
14537         (ver_test_7.o): New target.
14538         (check_SCRIPTS): Add ver_test_7.sh.
14539         (check_DATA): Add ver_test_7.syms.
14540         (ver_test_7.syms): New target.
14541
14542 2008-03-28  Ian Lance Taylor  <iant@google.com>
14543
14544         * layout.cc (Layout::layout): If we see an input section with a
14545         name that needs sorting, set the must_sort flag for the output
14546         section.
14547         (Layout::make_output_section): If the name of the output section
14548         indicates that it might require sorting, set the may_sort flag.
14549         * output.h (Output_section::may_sort_attached_input_sections): New
14550         function.
14551         (Output_section::set_may_sort_attached_input_sections): New
14552         function.
14553         (Output_section::must_sort_attached_input_sections): New
14554         function.
14555         (Output_section::set_must_sort_attached_input_sections): New
14556         function.
14557         (class Output_section): Declare Input_section_sort_entry.  Define
14558         Input_section_sort_compare.  Declare
14559         sort_attached_input_sections.  Add new fields:
14560         may_sort_attached_input_sections_,
14561         must_sort_attached_input_sections_,
14562         attached_input_sections_are_sorted_.
14563         * output.cc (Output_section::Output_section): Initialize new
14564         fields.
14565         (Output_section::add_input_section): Add an entry to
14566         input_sections_ if may_sort or must_sort are true.
14567         (Output_section::set_final_data_size): Call
14568         sort_attached_input_sections if necessary.
14569         (Output_section::Input_section_sort_entry): Define new class.
14570         (Output_section::Input_section_sort_compare::operator()): New
14571         function.
14572         (Output_section::sort_attached_input_sections): New function.
14573         * configure.ac: Check whether the compiler supports constructor
14574         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14575         * testsuite/initpri1.c: New file.
14576         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14577         CONSTRUCTOR_PRIORITY.
14578         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14579         (initpri1_LDFLAGS): New variable.
14580         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14581
14582 2008-03-27  Ian Lance Taylor  <iant@google.com>
14583
14584         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14585         * testsuite/common_test_1.c: New file.
14586         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14587         (common_test_1_SOURCES): New variable.
14588         (common_test_1_DEPENDENCIES): New variable.
14589         (common_test_1_LDFLAGS): New variable.
14590
14591         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14592         and commons_ correctly when NAME/VERSION does not override
14593         NAME/NULL.
14594         * testsuite/ver_test_6.c: New file.
14595         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14596         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14597         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14598
14599 2008-03-26  Ian Lance Taylor  <iant@google.com>
14600
14601         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14602         of an undefined symbol from a version script.
14603         * testsuite/Makefile.am (ver_test_5.so): New target.
14604         (ver_test_5.o): New target.
14605         (check_SCRIPTS): Add ver_test_5.sh.
14606         (check_DATA): Add ver_test_5.syms.
14607         (ver_test_5.syms): New target.
14608         * testsuite/ver_test_5.cc: New file.
14609         * testsuite/ver_test_5.script: New file.
14610         * testsuite/ver_test_5.sh: New file.
14611         * Makefile.in, testsuite/Makefile.in: Rebuild.
14612
14613         PR gold/5986
14614         Fix problems building gold with gcc 4.3.0.
14615         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14616         (gold_error_at_location, gold_warning_at_location): Use it.
14617         * configure.ac: Check whether we can compile and use a template
14618         function with a printf attribute.
14619         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14620         when jumping over bytes.
14621         * object.cc: Instantiate Object::read_section_data.
14622         * debug.h: Include <cstring>
14623         * dwarf_reader.cc: Include <algorithm>
14624         * main.cc: Include <cstring>.
14625         * options.cc: Include <cstring>.
14626         * output.cc: Include <cstring>.
14627         * script.cc: Include <cstring>.
14628         * script.h: Include <string>.
14629         * symtab.cc: Include <cstring> and <algorithm>.
14630         * target-select.cc: Include <cstring>.
14631         * version.cc: Include <string>.
14632         * testsuite/testmain.cc: Include <cstdlib>.
14633         * configure, config.in: Rebuild.
14634
14635 2008-03-25  Ian Lance Taylor  <iant@google.com>
14636
14637         * options.cc: Include "../bfd/bfdver.h".
14638         (options::help): Print bug reporting address.
14639
14640         * version.cc (print_version): Adjust output for current value of
14641         BFD_VERSION_STRING.
14642
14643         * NEWS: New file.
14644
14645         * options.cc (options::help): Print list of supported targets.
14646         * target-select.h: Include <vector>.
14647         (class Target_selector): Make machine_, size_, and is_big_endian_
14648         fields const.  Add bfd_name_ and instantiated_target_ fields.
14649         (Target_selector::Target_selector): Add bfd_name parameter.
14650         (Target_selector::recognize): Make non-virtual, call
14651         do_recognize.
14652         (Target_selector::recognize_by_name): Make non-virtual, call
14653         do_recognize_by_name.
14654         (Target_selector::supported_names): New function.
14655         (Target_selector::bfd_name): New function.
14656         (Target_selector::do_instantiate_target): New pure virtual
14657         function.
14658         (Target_selector::do_recognize): New virtual function.
14659         (Target_selector::do_recognize_by_name): New virtual function.
14660         (Target_selector::instantiate_target): New private function.
14661         (supported_target_names): Declare.
14662         * target-select.cc (Target_selector::Target_selector): Update for
14663         new parameter and fields.
14664         (select_target_by_name): Check that the name matches before
14665         calling recognize_by_name.
14666         (supported_target_names): New function.
14667         * i386.cc (class Target_selector_i386): Update Target_selector
14668         constructor call.  Remove recognize and recognize_by_name.  Add
14669         do_instantiate_target.
14670         * x86_64.cc (class Target_selector_x86_64): Likewise.
14671         * testsuite/testfile.cc (class Target_selector_test): Update for
14672         changes to Target_selector.
14673
14674         * README: Rewrite, with some notes on unsupported features.
14675
14676 2008-03-24  Cary Coutant  <ccoutant@google.com>
14677
14678         * i386.cc (Target_i386::Got_type): New enum declaration.
14679         (Target_i386::Scan::local): Updated callers of Output_data_got
14680         member functions.
14681         (Target_i386::Scan::global): Likewise.
14682         (Target_i386::Relocate::relocate): Likewise.
14683         (Target_i386::Relocate::relocate_tls): Likewise.
14684         * object.h (Got_offset_list): New class.
14685         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14686         (Sized_relobj::local_got_offset): Likewise.
14687         (Sized_relobj::set_local_got_offset): Likewise.
14688         (Sized_relobj::local_has_tls_got_offset): Removed.
14689         (Sized_relobj::local_tls_got_offset): Removed.
14690         (Sized_relobj::set_local_tls_got_offset): Removed.
14691         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14692         * output.cc (Output_data_got::add_global): Added got_type parameter.
14693         (Output_data_got::add_global_with_rel): Likewise.
14694         (Output_data_got::add_global_with_rela): Likewise.
14695         (Output_data_got::add_global_pair_with_rel): New function.
14696         (Output_data_got::add_global_pair_with_rela): New function.
14697         (Output_data_got::add_local): Added got_type parameter.
14698         (Output_data_got::add_local_with_rel): Likewise.
14699         (Output_data_got::add_local_with_rela): Likewise.
14700         (Output_data_got::add_local_pair_with_rel): New function.
14701         (Output_data_got::add_local_pair_with_rela): New function.
14702         (Output_data_got::add_global_tls): Removed.
14703         (Output_data_got::add_global_tls_with_rel): Removed.
14704         (Output_data_got::add_global_tls_with_rela): Removed.
14705         (Output_data_got::add_local_tls): Removed.
14706         (Output_data_got::add_local_tls_with_rel): Removed.
14707         (Output_data_got::add_local_tls_with_rela): Removed.
14708         * output.h (Output_data_got::add_global): Added got_type parameter.
14709         (Output_data_got::add_global_with_rel): Likewise.
14710         (Output_data_got::add_global_with_rela): Likewise.
14711         (Output_data_got::add_global_pair_with_rel): New function.
14712         (Output_data_got::add_global_pair_with_rela): New function.
14713         (Output_data_got::add_local): Added got_type parameter.
14714         (Output_data_got::add_local_with_rel): Likewise.
14715         (Output_data_got::add_local_with_rela): Likewise.
14716         (Output_data_got::add_local_pair_with_rel): New function.
14717         (Output_data_got::add_local_pair_with_rela): New function.
14718         (Output_data_got::add_global_tls): Removed.
14719         (Output_data_got::add_global_tls_with_rel): Removed.
14720         (Output_data_got::add_global_tls_with_rela): Removed.
14721         (Output_data_got::add_local_tls): Removed.
14722         (Output_data_got::add_local_tls_with_rel): Removed.
14723         (Output_data_got::add_local_tls_with_rela): Removed.
14724         * resolve.cc (Symbol::override_base_with_special): Removed
14725         reference to has_got_offset_ field.
14726         * symtab.cc (Symbol::init_fields): Replaced initialization
14727         of got_offset_ with got_offsets_.  Removed initialization
14728         of has_got_offset_
14729         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14730         (Symbol::got_offset): Likewise.
14731         (Symbol::set_got_offset): Likewise.
14732         (Symbol::has_tls_got_offset): Removed.
14733         (Symbol::tls_got_offset): Removed.
14734         (Symbol::set_tls_got_offset): Removed.
14735         (Symbol::got_offset_): Removed.
14736         (Symbol::tls_mod_got_offset_): Removed.
14737         (Symbol::tls_pair_got_offset_): Removed.
14738         (Symbol::got_offsets_): New field.
14739         (Symbol::has_got_offset): Removed.
14740         (Symbol::has_tls_mod_got_offset): Removed.
14741         (Symbol::has_tls_pair_got_offset): Removed.
14742         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14743         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14744         member functions.
14745         (Target_x86_64::Scan::global): Likewise.
14746         (Target_x86_64::Relocate::relocate): Likewise.
14747         (Target_x86_64::Relocate::relocate_tls): Likewise.
14748
14749 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14750
14751         * yyscript.y: Fix spelling error in comment.
14752
14753 2008-03-24  Ian Lance Taylor  <iant@google.com>
14754
14755         * options.h (class General_options): Define build_id option.
14756         * layout.h (class Layout): Declare write_build_id, create_note,
14757         create_build_id.  Add build_id_note_ member.
14758         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14759         "libiberty.h", "md5.h", "sha1.h".
14760         (Layout::Layout): Initialize eh_frame_data_,
14761         eh_frame_hdr_section_, and build_id_note_.
14762         (Layout::finalize): Call create_build_id.
14763         (Layout::create_note): New function, broken out of
14764         Layout::create_gold_note.
14765         (Layout::create_gold_note): Call create_note.
14766         (Layout::create_build_id): New function.
14767         (Layout::write_build_id): New function.
14768         (Close_task_runner::run): Call write_build_id.
14769
14770         * x86_64.cc: Correct license to GPLv3.
14771
14772 2008-03-23  Ian Lance Taylor  <iant@google.com>
14773
14774         * options.cc: Include "demangle.h".
14775         (parse_optional_string): New function.
14776         (parse_long_option): Handle takes_optional_argument.
14777         (parse_short_option): Update dash_z initializer.  Handle
14778         takes_optional_argument.
14779         (General_options::General_options): Initialize do_demangle_.
14780         (General_options::finalize): Set do_demangle_.  Handle demangling
14781         style.
14782         * options.h (parse_optional_string): Declare.
14783         (struct One_option): Add optional_arg field.  Update constructor.
14784         Update call constructor calls.  Add takes_optional_argument
14785         function.
14786         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14787         (DEFINE_optional_string): Define.
14788         (General_options::demangle): Change from DEFINE_bool to
14789         DEFINE_optional_string.
14790         (General_options::no_demangle): New function.
14791         (General_options::do_demangle): New function.
14792         (General_options::set_do_demangle): New function.
14793         (General_options::execstack_status_): Move definition to end of
14794         class definition.
14795         (General_options::static_): Likewise.
14796         (General_options::do_demangle_): New field.
14797         * object.cc (big_endian>::get_symbol_location_info): Call
14798         Options::do_demangle, not Options::demangle.
14799         * symtab.cc (demangle): Likewise.
14800
14801 2008-03-22  Ian Lance Taylor  <iant@google.com>
14802
14803         * gold.h: Include <cstddef> and <sys/types.h>
14804         * options.h: Include <cstring>.
14805
14806 2008-03-21  Ian Lance Taylor  <iant@google.com>
14807
14808         * Added source code to GNU binutils.
14809 \f
14810 Copyright (C) 2008-2013 Free Software Foundation, Inc.
14811
14812 Copying and distribution of this file, with or without modification,
14813 are permitted in any medium without royalty provided the copyright
14814 notice and this notice are preserved.
14815
14816 Local Variables:
14817 mode: change-log
14818 left-margin: 8
14819 fill-column: 74
14820 version-control: never
14821 End: