gold/
[external/binutils.git] / gold / ChangeLog
1 2013-07-19  Roland McGrath  <mcgrathr@google.com>
2
3         * options.h (General_options): Add -Trodata-segment option.
4         * parameters.cc (Parameters::check_rodata_segment): New function.
5         (Parameters::set_target_once): Call it.
6         * parameters.h (Parameters): Declare it (private member function).
7         * layout.cc (load_seg_unusable_for_headers): New function, broken
8         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
9         then validate rodata segment rather than text segment.
10         (relaxation_loop_body): Call that.
11         (is_text_segment): New function.  Don't admit a non-executable
12         segment if TARGET->isolate_execinstr().
13         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
14
15 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
16
17         PR gold/15070
18         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
19         * nacl.h (Sniff_file::View::View): Request aligned view.
20
21 2013-07-11  Cary Coutant  <ccoutant@google.com>
22
23         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
24         correct BRLT entry size.
25
26 2013-07-03  Alan Modra  <amodra@gmail.com>
27
28         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
29         comment.
30
31 2013-07-01  Cary Coutant  <ccoutant@google.com>
32
33         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
34         reloc_type_.
35         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
36         (Dwarf_ranges_table::lookup_reloc): New function.
37         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
38         reloc_type_.
39         (Dwarf_ranges_table::lookup_reloc): New function.
40         (Dwarf_ranges_table::reloc_type_): New data member.
41
42 2013-06-27  Jing Yu  <jingyu@google.com>
43
44         PR gold/15662
45         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
46         function.
47         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
48         (Target_powerpc::do_relax): Call the above.
49
50 2013-06-27  Cary Coutant  <ccoutant@google.com>
51
52         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
53         on garbage collected .opd section.
54
55 2013-06-27  Alan Modra  <amodra@gmail.com>
56
57         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
58         is non-zero.
59         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
60         (Target_powerpc::do_function_location): Likewise for loc->shndx.
61
62 2013-06-14  Cary Coutant  <ccoutant@google.com>
63
64         * resolve.cc (Symbol::override_base): Don't override st_type
65         from plugin placeholder symbols.
66         (Symbol_table::resolve): Likewise.
67         (Symbol_table::should_override): Don't complain about TLS mismatch
68         if the TO symbol is a plugin placeholder.
69         * testsuite/Makefile.am (plugin_test_tls): New test.
70         * testsuite/Makefile.in: Regenerate.
71         * testsuite/plugin_test_tls.sh: New test script.
72         * testsuite/two_file_test_2_tls.cc: New test source.
73         * testsuite/two_file_test_tls.cc: New test source.
74
75 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
76
77         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
78         the maximum segment alignment is larger than the page size.
79         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
80         correctly aligns the symbols with large alignemnt.
81         * testsuite/Makefile.in: Regenerate.
82         * testsuite/large_symbol_alignment.cc: New file.
83
84 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
85             Sriraman Tallam  <tmsriram@google.com>
86
87         * options.h (sort_section): New option.
88         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
89         Rename from Input_section_sort_section_name_special_ordering_compare.
90         (Input_section_sort_section_name_compare): New struct.
91         * output.cc (Output_section::Input_section_sort_section_name_compare::
92         operator()): New function.
93         (Output_section::sort_attached_input_sections): Use new sort function
94         for .text if --sort-section=name is specified.
95         * layout.cc (Layout::make_output_section):
96         Add sorting by name when --sort-section=name is specified.
97         * testsuite/Makefile.am (text_section_grouping): Test option
98         --sort-section=name.
99         * testsuite/Makefile.in: Regenerate.
100         * testsuite/section_sorting_name.cc: New file.
101         * testsuite/section_sorting_name.sh: New file.
102
103 2013-05-21  Cary Coutant  <ccoutant@google.com>
104
105         * symtab.h (Symbol::is_cxx_vtable): New function.
106         * target-reloc.h (relocate_section): Check for vtable symbol.
107         * testsuite/Makefile.am (missing_key_func.sh): New test case.
108         * testsuite/Makefile.in: Regenerate.
109         * testsuite/missing_key_func.cc: New test source.
110         * testsuite/missing_key_func.sh: New test script.
111
112 2013-05-21  Cary Coutant  <ccoutant@google.com>
113
114         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
115         type of enclosing symbol.
116         (Relocate_info::location): Check symbol type when describing symbol.
117         * object.h (Symbol_location_info): Remove unused line_number;
118         add enclosing_symbol_type.
119         * testsuite/debug_msg.sh: Adjust expected output.
120
121 2013-05-13  Cary Coutant  <ccoutant@google.com>
122
123         * configure.ac: Export DEFAULT_TARGET.
124         * configure: Regenerate.
125         * Makefile.in: Regenerate.
126         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
127         * testsuite/Makefile.in: Regenerate.
128         * testsuite/debug_msg.sh: Delete duplicate tests.
129         Don't check undef_int error message match for powerpc where the
130         source file and line number aren't available.
131
132 2013-05-10  Roland McGrath  <mcgrathr@google.com>
133
134         * options.h (General_options): Add --rosegment-gap option.
135         * options.cc (finalize): --rosegment-gap implies --rosegment.
136         * layout.cc (set_segment_offsets): Let user option override
137         target->rosegment_gap().
138
139 2013-05-10  Roland McGrath  <mcgrathr@google.com>
140
141         * options.h (General_options): Remove leading space from help
142         messages for -nostdlib and --rosegment.
143
144 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
145
146         PR ld/15365
147         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
148
149 2013-05-03  Alan Modra  <amodra@gmail.com>
150
151         * merge.cc (Output_merge_string::do_add_input_section): Correct
152         scan for number of strings.  Rename vars to avoid shadowing.
153         Include missing terminator in input_size_.
154
155 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
156
157         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
158         Restore empty string handling.
159
160 2013-05-01  Cary Coutant  <ccoutant@google.com>
161
162         * stringpool.cc (Stringpool_template::new_key_offset): Fix
163         uninitialized warning.
164
165 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
166
167         * output.cc (Output_section::add_merge_input_section): Allow
168         to merge sections if the alignment is more than character size.
169         * merge.h (Output_merge_string::Output_merge_string): Remove
170         assert.
171         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
172         only not-null strings. Check the alignment of strings.
173         * stringpool.h
174         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
175         alignment as the argument.
176         (Stringpool_template<Stringpool_char>::addralign_): New class member.
177         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
178         Align non-zero length strings according to the addralign_.
179         (Stringpool_template<Stringpool_char>::set_string_offsets):
180         Updating offsets according to the given alignment.
181         * testsuite/Makefile.am (text_section_grouping): Test if string
182         literals are getting merged.
183         * testsuite/Makefile.in: Regenerate.
184         * testsuite/merge_string_literals_1.c: New file.
185         * testsuite/merge_string_literals_2.c: Ditto.
186         * testsuite/merge_string_literals.sh: Ditto.
187
188 2013-04-26  Ian Lance Taylor  <iant@google.com>
189
190         * target-reloc.h (relocate_section): If the reloc offset is out of
191         range, pass VIEW as NULL to relocate.relocate.
192         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
193         * i386.cc (Target_i386::Relocate::relocate): Likewise.
194         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
195         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
196         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
197         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
198
199 2013-04-26  Geoff Pike  <gpike@chromium.org>
200
201         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
202         * layout.cc (Hash_task): New class.
203         (Layout::queue_build_id_tasks): New function.
204         (Layout::write_build_id): Handle single-thread portion of build ID
205         computation.  (In some cases, all of it is single-threaded.)  Replace
206         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
207         functionality in fewer lines of code.
208         * layout.h (Layout::queue_build_id_tasks): New function declaration.
209         * options.h (General_options): make "--build-id" default to tree
210         rather than sha1.  Add two new options related to --build-id=tree:
211         --build-id-chunk-size-for-treehash and
212         --build-id-min-file-size-for-treehash.
213         * Makefile.am: add testing of --build-id=tree and related new options
214         (these tests will be invoked by "make check").
215         * Makefile.in: Regenerate.
216
217 2013-04-25  Alan Modra  <amodra@gmail.com>
218
219         * configure.tgt: Add powerpcle and powerpc64le.
220
221 2013-04-22  Alan Modra  <amodra@gmail.com>
222
223         PR gold/15355
224         * layout.cc (Layout::segment_precedes): Allow more than one
225         segment with the same type and flags.
226
227 2013-04-15  Cary Coutant  <ccoutant@google.com>
228
229         * layout.cc (Layout::set_relocatable_section_offsets): Don't
230         allocate space in file for BSS sections.
231
232 2013-04-15  Cary Coutant  <ccoutant@google.com>
233
234         * script-sections.cc (Orphan_output_section): Reset address
235         to zero after each orphaned section for relocatable links.
236
237 2013-04-15  Cary Coutant  <ccoutant@google.com>
238
239         * symtab.cc (Symbol_table::sized_write_globals): Subtract
240         section starting address for relocatable link.
241         * testsuite/Makefile.am (script_test_11): New test.
242         * testsuite/Makefile.in: Regenerate.
243         * testsuite/script_test_11.c: New source file.
244         * testsuite/script_test_11.t: New linker script.
245
246 2013-04-13  Alan Modra  <amodra@gmail.com>
247
248         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
249         owner when sections are not adjacent and exceed group size.
250         (Target_powerpc::group_sections): Handle corner case.
251         (Target_powerpc::Branch_info::make_stub): Handle case where
252         stub table doesn't exist due to branches in non-exec sections.
253         (Target_powerpc::Relocate::relocate): Likewise.
254
255 2013-04-11  Alan Modra  <amodra@gmail.com>
256
257         PR gold/15354
258         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
259         .branch_lt to match bfd ld.  Adjust comments throughout file.
260
261 2013-04-04  Ian Lance Taylor  <iant@google.com>
262
263         GCC PR c++/56840
264         * object.cc (do_layout_deferred_sections): Handle .eh_frame
265         sections before checking whether they are included in the link.
266
267 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
268
269         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
270         object before calling the plugin claim_file handler.  Pass the elf
271         object of the archive to the plugin. Delete the elf object if the
272         plugin claims the file.
273
274 2013-03-21  Alan Modra  <amodra@gmail.com>
275
276         * layout.cc (Layout::set_segment_offsets): Accept writable .text
277         segment when omagic.
278
279 2013-03-21  Alan Modra  <amodra@gmail.com>
280
281         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
282         comparison warning.
283         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
284         uninitialized" warning.
285
286 2013-03-20  Alan Modra  <amodra@gmail.com>
287
288         * symtab.h (Symbol::clear_version): New function.
289         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
290         is_needed by weak references.  Clear version for symbols defined
291         in as-needed objects that are not needed.
292
293 2013-03-15  Alan Modra  <amodra@gmail.com>
294
295         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
296         static and public.  Add report_err param.  Return false for data refs.
297         (Target_powerpc::rela_dyn_section): New overloaded function.
298         (Target_powerpc::plt_, iplt_): Elucidate.
299         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
300         (Output_data_plt_powerpc::do_write): Don't write .iplt.
301         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
302         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
303         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
304         push_branch and make_plt_entry for ifunc syms when
305         reloc_needs_plt_for_ifunc.
306         (Target_powerpc::Relocate::relocate): Don't use plt entry value
307         for ifunc unless reloc_needs_plt_for_ifunc.
308
309 2013-03-15  Alan Modra  <amodra@gmail.com>
310
311         * gc.h (gc_process_relocs): Don't look through function descriptors.
312         * icf.cc (get_section_contents): Do so here instead.
313
314 2013-03-13  Alan Modra  <amodra@gmail.com>
315
316         * powerpc.cc (is_branch_reloc): Forward declare.
317         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
318         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
319         false for 64-bit, true for 32-bit non-branch relocs.
320         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
321         * testsuite/Makefile.am (icf_test): Use linker map file instead of
322         nm output.
323         (icf_safe_test): Generate linker map file as well as nm output.
324         (icf_safe_so_test): Likewise.
325         * testsuite/Makefile.in: Regenerate.
326         * testsuite/icf_test.sh: Parse linker map file to determine
327         section folding.
328         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
329         * testsuite/icf_safe_so_test.sh: Likewise.
330         (X86_32_or_ARM_specific_safe_fold): Merge into..
331         (arch_specific_safe_fold): ..this.
332         (X86_64_specific_safe_fold): Delete unused function.
333
334 2013-03-12  Alan Modra  <amodra@gmail.com>
335
336         * gc.h (gc_process_relocs): Look through function descriptors
337         to determine shndx, symvalue and addend used by ICF.  Tidy
338         variable duplication.
339
340 2013-03-11  Alan Modra  <amodra@gmail.com>
341
342         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
343         * layout.cc (Layout_task_runner::run): ..to here.
344         * symtab.h (struct Symbol_location): Extract from..
345         (class Symbol_table): ..here.
346         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
347         * target.h (class Target): Add function_location and
348         do_function_location functions.
349         (class Sized_target): Add do_function_location.
350         * object.h (class Sized_relobj_file): Move find_shdr..
351         (class Object): ..to here.
352         * object.cc: Likewise.  Update to suit.  Instantiate.
353         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
354         * powerpc.cc (class Powerpc_dynobj): New.
355         (Target_powerpc::do_function_location): New function.
356         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
357         (Powerpc_dynobj::do_read_symbols): New function.
358         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
359
360 2013-03-08  Ian Lance Taylor  <iant@google.com>
361
362         * options.cc (General_options::string_to_object_format): Accept
363         "default".
364
365 2013-03-08  Alan Modra  <amodra@gmail.com>
366
367         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
368         pointer to Post_fde.
369         (struct Post_fde): Move definition to here..
370         * ehframe.cc (struct Post_fde): ..from here.
371         (Cie::write): Don't alloc Post_fde.
372         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
373
374 2013-03-07  Alan Modra  <amodra@gmail.com>
375
376         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
377         relocation referencing .LC0.
378         * testsuite/discard_locals_test.sh: Remove FIXMEs.
379
380 2013-03-07  Alan Modra  <amodra@gmail.com>
381
382         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
383         always_inline.  Add assembly for powerpc to avoid GOT.
384
385 2013-03-07  Alan Modra  <amodra@gmail.com>
386
387         * testsuite/script_test_10.sh: Don't test .bss section
388         header number.
389
390 2013-03-06  Alan Modra  <amodra@gmail.com>
391
392         * powerpc.cc (class Powerpc_relobj): Move some member functions.
393         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
394         all callers.  Handle folded sections.
395         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
396         to Powerpc_relobj.
397         (Global_symbol_visitor_opd::operator()): Likewise.
398
399 2013-03-04  Alan Modra  <amodra@gmail.com>
400
401         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
402         * testsuite/Makefile.in: Regenerate.
403
404 2013-03-01  Cary Coutant  <ccoutant@google.com>
405
406         Add dwp support for v2 DWARF package file format.
407         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
408         tu_length parameter.  Adjust all callers.
409         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
410         * dwp.cc: Include dwarf.h.
411         (Section_bounds): New struct type.
412         (Unit_set): New struct type.
413         (Dwo_file::Dwo_file): Initialize new data member.
414         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
415         Combine and rename to...
416         (Dwo_file::read_unit_index): ...this.
417         (Dwo_file::sized_read_compunit_index)
418         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
419         (Dwo_file::sized_read_unit_index): ...this.
420         (Dwo_file::copy_section): Remove section_name, is_str_offsets
421         parameters; add section_id parameter.
422         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
423         (Dwo_file::add_unit_set): ...this.
424         (Dwo_file::shndx_map_): Remove.
425         (Dwo_file::sect_offsets_): New data member.
426         (Dwp_output_file::Dwp_output_file): Initialize new data members.
427         (Dwp_output_file::add_section): Rename to...
428         (Dwp_output_file::add_contribution): ...this.
429         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
430         (Dwp_output_file::add_tu_set): Likewise.
431         (Dwp_output_file::Contribution): New type.
432         (Dwp_output_file::Section::contributions): New data member.
433         (Dwp_output_file::Cu_or_tu_set): Remove.
434         (Dwp_output_file::Section::Section): New ctor.
435         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
436         (Dwp_output_file::Dwp_index::Section_table): New type.
437         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
438         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
439         parameter.
440         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
441         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
442         (Dwp_output_file::Dwp_index::section_table): New member function.
443         (Dwp_output_file::Dwp_index::section_table_end): New member function.
444         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
445         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
446         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
447         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
448         (Dwp_output_file::Dwp_index::section_table_): New data member.
449         (Dwp_output_file::Dwp_index::section_mask_): New data member.
450         (Dwp_output_file::add_output_section): New member function.
451         (Dwp_output_file::write_new_section): New member function.
452         (Dwp_output_file::write_contributions): New member function.
453         (Dwp_output_file::section_id_map_): New data member.
454         (class Dwo_id_info_reader): Remove.
455         (class Unit_reader): New class.
456         (get_dwarf_section_name): New function.
457         (Dwo_file::read_executable): Adjust initializations of class data.
458         (Dwo_file::read): Add support for v2 package file format.
459         (Dwo_file::read_unit_index): Likewise.
460         (Dwo_file::sized_read_unit_index): Likewise.
461         (Dwo_file::copy_section): Likewise.
462         (Dwo_file::add_unit_set): Likewise.
463         (Dwp_output_file::add_output_section): Likewise.
464         (Dwp_output_file::add_contribution): Likewise.
465         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
466         for empty slot.
467         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
468         file format.
469         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
470         slot.
471         (Dwp_output_file::initialize): Remove unused function.
472         (Dwp_output_file::finalize): Add support for v2 package file format.
473         (Dwp_output_file::write_index): Likewise.
474         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
475         function prototype.
476
477 2013-03-01  Cary Coutant  <ccoutant@google.com>
478
479         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
480         function into class definition in header file.
481         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
482         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
483         New function.
484         (Dwarf_info_reader::check_buffer): Move here from .cc file.
485
486 2013-02-28  Alan Modra  <amodra@gmail.com>
487
488         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
489         * target.cc (Target::do_plt_fde_location): New function.
490         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
491         accessor function, and constructor param.
492         (struct Post_fde, Post_fdes): Declare.
493         (Cie::write): Add post_fdes param.
494         * ehframe.cc (Fde::write): Use plt_fde_location.
495         (struct Post_fde): Define.
496         (Cie::write): Stash FDEs added post merge mapping.
497         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
498         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
499         (Eh_frame::do_sized_write): Arrange to write post map FDES after
500         other FDEs.
501         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
502         (Target_powerpc::has_glink): New function.
503         (Target_powerpc::do_relax): Add eh_frame info for stubs.
504         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
505         glink_eh_frame_fde_32, default_fde): New data.
506         (Stub_table::eh_frame_added_): New var.
507         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
508         Make const.
509         (Stub_table::add_eh_frame): New function.
510         (Output_data_glink::add_eh_frame): New function.
511         (Target_powerpc::make_glink_section): Call add_eh_frame.
512
513 2013-02-15  Ian Lance Taylor  <iant@google.com>
514
515         * options.h (DEFINE_uint64_alias): Define.
516         (class General_options): Add -Ttext-segment as an alias for
517         -Ttext.
518
519 2013-02-15  Alan Modra  <amodra@gmail.com>
520
521         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
522         (Stub_table::do_write): ..here, two places.
523         (Stub_table::plt_call_size): Use it here too.
524
525 2013-02-11  Ian Lance Taylor  <iant@google.com>
526
527         * descriptors.cc (Descriptors::close_all): New function.
528         * descriptors.h (class Descriptors): Declare close_all.
529         (close_all_descriptors): New inline function.
530         * plugin.cc: Include "descriptors.h".
531         (Plugin_manager::cleanup): Call close_all_descriptors.
532
533 2013-02-06  Alan Modra  <amodra@gmail.com>
534
535         * README: Update coding style link.
536
537 2013-01-28  Cary Coutant  <ccoutant@google.com>
538
539         * dwp.cc (File_list): New typedef.
540         (Dwo_name_info_reader): New class.
541         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
542         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
543         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
544         (Dwo_file::read_executable): New function.
545         (Dwo_file::read): Move common setup code to ...
546         (Dwo_file::make_object): ... here.
547         (dwp_options): Add --exec/-e.
548         (usage): Likewise.
549         (main): Likewise.
550
551 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
552
553         * layout.cc (Layout::layout): Check for option text_reorder.
554         (Layout::make_output_section): Ditto.
555         * options.h (text_reorder): New option.
556         * output.cc (Input_section_sort_compare): Remove special ordering
557         of section names.
558         (Output_section::
559          Input_section_sort_section_name_special_ordering_compare::
560          operator()): New function.
561         (Output_section::sort_attached_input_sections): Use new sort function
562         for .text.
563         * output.h (Input_section_sort_section_name_special_ordering_compare):
564         New struct.
565         * testsuite/Makefile.am (text_section_grouping): Test option
566         --no-text-reorder
567         * testsuite/Makefile.in: Regenerate.
568         * testsuite/text_section_grouping.sh: Check order of functions without
569         default text reordering.
570
571 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
572
573         * options.h (General_options): Change default to true for new_dtags.
574
575 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
576
577         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
578         when enable_new_dtags is false.  Only add DT_RUNPATH when
579         enable_new_dtags is true.
580
581 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
582
583         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
584         used in declaration and definition consistent.
585         (Target_powerpc::symval_for_branch): Ditto.
586
587 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
588
589         * testsuite/plugin_final_layout.cc: Fix comment.
590
591 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
592
593         * layout.cc (Layout::layout): Do not do default sorting for
594         text sections when section ordering is specified.
595         (make_output_section): Ditto.
596         * testsuite/plugin_final_layout.cc: Name the function sections
597         to catch reordering issues.
598
599 2013-01-15  Alan Modra  <amodra@gmail.com>
600
601         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
602         plt-thread-safe.
603
604 2013-01-15  Alan Modra  <amodra@gmail.com>
605
606         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
607         * testsuite/Makefile.in: Regenerate.
608
609 2013-01-14  Alan Modra  <amodra@gmail.com>
610
611         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
612         * testsuite/Makefile.in: Regenerate.
613
614 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
615
616         PR bfd/14430
617         Fix mingw gold build with plugins enabled
618         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
619         * configure.ac: Export DLOPEN_LIBS and add headers check.
620         * plugin.cc: Handle non-dlfcn case.
621         * Makefile.in: Regenerate.
622         * config.in: Regenerate.
623         * configure: Regenerate.
624         * testsuite/Makefile.in: Regenerate.
625
626 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
627
628         * output.h (sort_attached_input_sections): Change to be public.
629         * script-sections.cc
630         (Output_section_definition::set_section_addresses): Sort
631         attached input sections according to section order before linker
632         script assigns section addresses.
633         (Orphan_output_section::set_section_addresses): Sort
634         attached input sections according to section order before linker
635         script assigns section addresses.
636         * Makefile.am (final_layout.sh): Use a simple linker script to
637         check if section ordering still works.
638         * Makefile.in: Regenerate.
639
640 2013-01-09  Ben Cheng  <bccheng@google.com>
641
642         * arm.cc (Target_arm::attributes_accept_div): New function.
643         (Target_arm::attributes_forbid_div): New function.
644         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
645         attribute using the same new functions as what bfd/elf32_arm.c
646         does.
647
648 2013-01-07  Cary Coutant  <ccoutant@google.com>
649
650         PR gold/14993
651         * output.cc (Output_section::add_input_section): For incremental
652         updates, don't track input sections that are allocated from patch
653         space.
654
655 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
656             Ian Lance Taylor  <iant@google.com>
657
658         PR gold/14897
659         * configure.ac (--enable-ld): Removed.
660         (install_as_default): Set to yes only for --enable-gold=default
661         or --disable-ld.
662         * configure: Regenerated.
663
664 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
665
666         * options.h (General_options): Add -fuse-ld= for GCC linker
667         option compatibility.
668
669 2013-01-04  Cary Coutant  <ccoutant@google.com>
670
671         * configure.ac: Fix typo restoring CXXFLAGS.
672         * configure: Regenerate.
673
674 2013-01-04  Cary Coutant  <ccoutant@google.com>
675
676         * testsuite/Makefile.am (CXXLINK_S): New macro.
677         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
678         * testsuite/Makefile.in: Regenerate.
679
680 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
681
682         * version.cc (print_version): Update copyright year to 2013.
683
684 2012-12-20  Ian Lance Taylor  <iant@google.com>
685
686         * layout.cc (Layout::special_ordering_of_input_section): New
687         function.
688         (Layout::layout): If input section requires special ordering, must
689         sort input sections.
690         (Layout::make_output_section): May sort .text input sections.
691         (Layout::is_section_name_prefix_grouped): Remove.
692         * layout.h (class Layout): Declare
693         special_ordering_of_input_section.  Don't declare
694         is_section_name_prefix_grouped.
695         * output.cc (Output_section::add_input_section): Revert last
696         change.
697         (Output_section::Input_section_sort::match_file_name): Don't crash
698         if called on output section data.
699         (Output_section::Input_section_sort_compare): Sort based on
700         special ordering.
701         (Output_section::Input_section_sort_section_order_index_compare):
702         Revert last patch.
703         (Output_section::sort_attached_input_sections): Likewise.
704
705 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
706
707         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
708         * layout.h (Layout::is_section_name_prefix_grouped): New function.
709         * output.cc (Output_section::add_input_section): Check if section
710         name contains special prefix.  Keep input sections to sort such
711         sections.
712         (Output_section::Input_section_sort_section_order_index_compare
713          ::operator()): Group sections according to prefixes.
714         (Output_section::sort_attached_input_sections): Add condition to
715         Input_section_entry constructor call.
716         * testsuite/Makefile.am (text_section_grouping): New test.
717         * testsuite/Makefile.in: Regenerate.
718         * testsuite/text_section_grouping.cc: New file.
719         * testsuite/text_section_grouping.sh: New file.
720
721 2012-12-17  Nick Clifton  <nickc@redhat.com>
722
723         * Makefile.am: Add copyright notice.
724         * NEWS: Likewise.
725         * README: Likewise.
726         * configure.ac: Likewise.
727         * ftruncate.c: Likewise.
728         * Makefile.in: Regenerate.
729
730 2012-12-14  Cary Coutant  <ccoutant@google.com>
731
732         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
733         --no-as-needed flag.
734         (exception_separate_shared_12_test): Likewise.
735         (incremental_copy_test): Likewise.
736         * testsuite/Makefile.in: Regenerate.
737
738 2012-12-14  Cary Coutant  <ccoutant@google.com>
739
740         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
741         (Dwp_output_file::Dwp_index::enter_set): Add assert.
742
743 2012-12-12  Alan Modra  <amodra@gmail.com>
744
745         * powerpc.cc (class Track_tls): New.
746         (class Relocate, class Scan): Inherit Track_tls.
747         (Target_powerpc::Scan::local, global): Track tls optimization
748         and avoid creating plt entry for __tls_get_addr if all uses
749         are optimized away.
750         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
751
752 2012-12-12  Alan Modra  <amodra@gmail.com>
753
754         * options.h (General_options): Add --toc-sort/--no-toc-sort.
755         Replace no_toc_optimize with toc_optimize.
756         * output.h (Output_section::input_sections): Provide non-const variant.
757         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
758         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
759         accessors.
760         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
761         (class Sort_toc_sections): New.
762         (Target_powerpc::do_finalize_sections): Sort toc sections.
763         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
764
765 2012-12-10  Roland McGrath  <mcgrathr@google.com>
766
767         * testsuite/binary_unittest.cc (read_all): New function.
768         (Sized_binary_test): Use it instead of ::read.
769         * fileread.cc (do_read): Don't assume pread always reads the whole
770         amount in a single call.
771
772 2012-12-10  Alan Modra  <amodra@gmail.com>
773
774         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
775         Set EM_PPC64 or EM_PPC here.
776         (Target_selector_powerpc::do_recognize): Delete.
777
778 2012-12-10  Alan Modra  <amodra@gmail.com>
779
780         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
781         stub_table_.
782         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
783
784 2012-12-07  Roland McGrath  <mcgrathr@google.com>
785
786         * testsuite/binary_unittest.cc (Sized_binary_test):
787         Use open_descriptor rather than ::open.
788
789 2012-12-07  Alan Modra  <amodra@gmail.com>
790
791         * powerpc.cc (Stub_table::do_write): Delete redundant Address
792         typedef and invalid_address constant.
793         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
794         instantiate constants.
795
796 2012-12-06  Roland McGrath  <mcgrathr@google.com>
797
798         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
799         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
800         * aclocal.m4: Regenerate.
801         * configure: Regenerate.
802         * Makefile.in: Regenerate.
803         * testsuite/Makefile.in: Regenerate.
804
805 2012-12-07  Alan Modra  <amodra@gmail.com>
806
807         * options.h (General_options): Add no_toc_optimize.
808         * powerpc.cc (ok_lo_toc_insn): New function.
809         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
810
811 2012-12-06  Alan Modra  <amodra@gmail.com>
812
813         * options.h (General_options): Add plt_align, plt_static_chain,
814         plt_thread_safe.  Update stub_group_size help text.
815         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
816         for new plt_thread_safe_ var.
817         (use_plt_offset): Correct comments.
818         (Target_powerpc::do_relax): Look for thread creation symbols to
819         determine default plt_thread_safe value.  Clear plt call stubs
820         as well as branch stubs each iteration.
821         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
822         insn constants.
823         (l, hi, ha, write_insn): Move earlier.
824         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
825         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
826         plt stubs too.
827         (Stub_table::update_size): Adjust.
828         (Stub_table::prev_size, set_prev_size): Delete.
829         (Stub_table::stub_align): Let --plt-align affect result.
830         (Stub_table::plt_call_size): Calculate sizes for various stubs.
831         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
832         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
833         (Stub_table::do_write): Support more stub variants.
834
835 2012-12-04  Alan Modra  <amodra@gmail.com>
836
837         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
838         (Target_powerpc::do_define_standard_symbols): New function.
839
840 2012-12-03  Alan Modra  <amodra@gmail.com>
841
842         * output.h: Formatting, whitespace.
843
844 2012-12-03  Alan Modra  <amodra@gmail.com>
845
846         * layout.h (Layout::get_executable_sections): Declare.
847         * layout.cc (Layout::get_executable_sections): New function.
848         * arm.cc (Target_arm::group_sections): Use it.
849         (Arm_output_section::group_sections): Delete now redundant test.
850         * output.cc (Output_reloc::Output_reloc): Add is_relative.
851         param to handle relative relocs.
852         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
853         (Output_data_reloc::add_absolute): Adjust.
854         (Output_data_reloc::add_relative): New function.
855         (Output_data::reset_data_size): New function.
856         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
857         (Output_section::set_addralign): New function.
858         (Output_section::checkpoint_set_addralign): New function.
859         (Output_section::clear_section_offsets_need_adjustment): New function.
860         (Output_section::input_sections): Make public.
861         * powerpc.cc (class Output_data_brlt_powerpc): New.
862         (class Stub_table, class Stub_control): New.
863         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
864         stub_table_, set_stub_table, stub_table): New vectors and accessor
865         functions.
866         (Target_powerpc::do_may_relax, do_relax, push_branch,
867         new_stub_table, stub_tables, brlt_section, group_sections,
868         add_branch_lookup_table, find_branch_lookup_table,
869         write_branch_lookup_table, make_brlt_section): New functions.
870         (Target_powerpc::struct Sort_sections, class Branch_info): New.
871         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
872         branch_info_): New vars.
873         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
874         make call stubs here.
875         (Output_data_glink): Remove all call stub handling from this class.
876         (Target_powerpc::Scan::local, global): Save interesting branch
877         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
878         (Target_powerpc::do_finalize_sections): Only make reg save/restore
879         functions on final link.
880         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
881         Handle long branch destinations too.
882         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
883         do_plt_address_for_local): Adjust lookup of plt call stubs.
884
885 2012-11-30  Alan Modra  <amodra@gmail.com>
886
887         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
888         relocs against protected symbols when building 32-bit shared libs.
889
890 2012-11-30  Alan Modra  <amodra@gmail.com>
891
892         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
893         param.  Call got_section() to make .got.  Update all callers
894         and their callers and so on.
895
896 2012-11-30  Alan Modra  <amodra@gmail.com>
897
898         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
899         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
900         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
901         value if it already exists.
902
903 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
904
905         PR gold/14858
906         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
907
908 2012-11-14  Roland McGrath  <mcgrathr@google.com>
909
910         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
911         than bfc instruction for data sandboxing.
912
913 2012-11-08  Alan Modra  <amodra@gmail.com>
914
915         * po/POTFILES.in: Regenerate.
916
917 2012-11-05  Alan Modra  <amodra@gmail.com>
918
919         * configure.ac: Apply 2012-09-10 change to config.in here.
920         * configure: Regenerate.
921
922 2012-11-05  Alan Modra  <amodra@gmail.com>
923
924         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
925         (struct Opd_ent): Use "Address" rather than "Offset".
926         (Output_data_got_powerpc::got_base_offset): Return Valtype.
927         (Target_powerpc::got_section): Make public.
928         (Target_powerpc::scan_relocs): Move code setting symbols..
929         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
930         Create _SDA_BASE_ only when referenced.
931
932 2012-11-02  Roland McGrath  <mcgrathr@google.com>
933
934         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
935         from last change.
936
937 2012-11-01  Roland McGrath  <mcgrathr@google.com>
938
939         * target.h (Sized_target::relocate_relocs): Use Elf_Off
940         for offset_in_output_section parameter.
941         (Sized_target::relocate_special_relocatable): Likewise.
942         * arm.cc (Target_arm::relocate_relocs): Likewise.
943         (Target_arm::relocate_special_relocatable): Likewise.
944         * i386.cc (Target_i386::relocate_relocs): Likewise.
945         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
946         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
947         * target-reloc.h (relocate_relocs): Likewise.
948         * testsuite/testfile.cc (Target_test): Likewise.
949         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
950         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
951
952         * system.h: Move inclusion of <clocale> to after <libintl.h> in
953         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
954
955         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
956         parameter, which is unused in the [!F_SETFD] case.
957
958         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
959         SYMNDX to off_t before comparing it to this->data_size().
960         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
961         * incremental.cc (Output_section_incremental_inputs::do_write):
962         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
963
964         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
965
966 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
967
968         * gold.cc (Target_arm::do_adjust_elf_header): Add the
969         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
970         in EABI_VER5.
971
972 2012-10-29  Cary Coutant  <ccoutant@google.com>
973
974         * dwp.cc (usage): Add file and exit status parameters;
975         add --help and --version options.
976         (print_version): New function.
977         (main): Add --help and --version options.
978
979 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
980
981         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
982         final_layout_sequence.txt.
983         * testsuite/Makefile.in: Regenerated.
984
985 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
986
987         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
988         COMPILE generated by automake.
989         (LINK1): Likewise.
990         (CXXCOMPILE1): Likewise.
991         (CXXLINK1): Likewise.
992         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
993         (LINK): Likewise.
994         (CXXCOMPILE): Likewise.
995         (CXXLINK): Likewise.
996         * testsuite/Makefile.in: Regenerated.
997
998 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
999
1000         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1001         on bad fwrite return.
1002
1003 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1004
1005         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1006         on val.
1007
1008 2012-10-23  Cary Coutant  <ccoutant@google.com>
1009
1010         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1011         * testsuite/Makefile.in: Regenerate.
1012         * testsuite/dwp_test.h: New source file.
1013         * testsuite/dwp_test_1.cc: New source file.
1014         * testsuite/dwp_test_1.s: New source file.
1015         * testsuite/dwp_test_1.sh: New source file.
1016         * testsuite/dwp_test_1b.cc: New source file.
1017         * testsuite/dwp_test_1b.s: New source file.
1018         * testsuite/dwp_test_2.cc: New source file.
1019         * testsuite/dwp_test_2.s: New source file.
1020         * testsuite/dwp_test_2.sh: New source file.
1021         * testsuite/dwp_test_main.cc: New source file.
1022         * testsuite/dwp_test_main.s: New source file.
1023
1024 2012-10-23  Cary Coutant  <ccoutant@google.com>
1025
1026         * dwp.h: New header file.
1027         * dwp.cc: New source file.
1028         * gold.h: Move shared declarations to system.h.
1029         * system.h: New header file.
1030         * Makefile.am: Add dwp.
1031         * Makefile.in: Regenerate.
1032
1033 2012-10-23  Cary Coutant  <ccoutant@google.com>
1034
1035         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1036         Dwarf_info_reader::read_from_pointer.
1037         (Dwarf_pubnames_table::read_header): Likewise.
1038         (Dwarf_pubnames_table::next_name): Likewise.
1039         (Dwarf_die::read_attributes): Likewise.
1040         (Dwarf_die::skip_attributes): Likewise.
1041         (Dwarf_info_reader::read_from_pointer): New function template.
1042         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1043         (Dwarf_pubnames_table): Likewise.
1044         (Dwarf_info_reader::read_from_pointer): New function template.
1045         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1046         Dwarf_pubnames_table ctor.
1047
1048 2012-10-23  Cary Coutant  <ccoutant@google.com>
1049
1050         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1051         abbrev_shndx.
1052         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1053         abbrev_shndx_.
1054         (Dwarf_info_reader::set_abbrev_shndx): New method.
1055         (Dwarf_info_reader::abbrev_shndx_): New data member.
1056
1057 2012-10-23  Cary Coutant  <ccoutant@google.com>
1058
1059         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1060         from object, not parameters.
1061         (Dwarf_info_reader::parse): Likewise.
1062         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1063         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1064         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1065         methods.
1066
1067 2012-10-23  Cary Coutant  <ccoutant@google.com>
1068
1069         * fileread.cc (Input_file::Input_file): New constructor.
1070         * fileread.h (class Input_file): Add new constructor.
1071
1072 2012-10-18  Alan Modra  <amodra@gmail.com>
1073
1074         PR gold/14727
1075         * object.cc (Relobj::is_section_name_included): Also match
1076         .sdata personality section.
1077
1078 2012-10-18  Alan Modra  <amodra@gmail.com>
1079
1080         * target-reloc.h (class Default_comdat_behavior): New, package up..
1081         (get_comdat_behaviour): ..this.
1082         (relocate_section): Add Relocate_comdat_behavior template arg,
1083         adjust code to suit.
1084         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1085         (Target_arm::scan_reloc_section): Likewise.
1086         * i386.cc (Target_i386::relocate_section): Likewise.
1087         * sparc.cc (Target_sparc::relocate_section): Likewise.
1088         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1089         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1090         * powerpc.cc (class Relocate_comdat_behavior): New.
1091         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1092         gold::relocate_section with new template arg.
1093
1094 2012-10-18  Alan Modra  <amodra@gmail.com>
1095
1096         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1097         dynamic relocs for GOT_TPREL got entries, without symbol if
1098         resolving locally.
1099         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1100         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1101         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1102
1103 2012-10-17  Alan Modra  <amodra@gmail.com>
1104
1105         PR gold/14726
1106         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1107
1108 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1109
1110         * layout.cc (Layout::include_section): Keep sections marked
1111         SHF_EXCLUDE when doing relocatable links.
1112
1113 2012-10-16  Alan Modra  <amodra@gmail.com>
1114
1115         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1116         (Target_powerpc::do_finalize_sections): Call it.
1117         (Output_data_save_res): New class and supporting functions.
1118         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1119         normal symbols defined in object files.
1120
1121 2012-10-12  Alan Modra  <amodra@gmail.com>
1122
1123         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1124         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1125         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1126         section if scan_opd_relocs not yet called.
1127         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1128
1129 2012-10-12  Alan Modra  <amodra@gmail.com>
1130
1131         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1132         add_local_ifunc_entry): Revert last change.
1133         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1134
1135 2012-10-05  Alan Modra  <amodra@gmail.com>
1136
1137         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1138         do_plt_address_for_global): New functions.
1139         (Output_data_got_powerpc::do_write): Don't segfault when linking
1140         statically.
1141         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1142         add_local_ifunc_entry): Return true on adding entry..
1143         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1144         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1145         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1146         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1147         set up symbols here.
1148         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1149         syms here.  Do so even when no .iplt.  Don't segfault when linking
1150         statically.
1151         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1152         new variants without reloc param.
1153         (Glink_sym_ent::Glink_sym_ent): Likewise.
1154         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1155         reloc when refs will resolve to plt call stub.
1156         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1157         R_PPC_PLTREL24 to resolve locally.
1158         (Target_powerpc::Scan::global): Correct ifunc handling.
1159         (Target_powerpc::Relocate::relocate): Correct local sym glink
1160         lookup.  Don't destroy "value" when we have a plt call stub,
1161         and when checking plt call validity.
1162         (Target_powerpc::do_dynsym_value): Simplify.
1163
1164 2012-10-05  Alan Modra  <amodra@gmail.com>
1165
1166         * i386.cc (Output_data_plt_i386::address_for_global,
1167         address_for_local): Add plt offset to returned value.  Adjust uses.
1168         * sparc.cc (Output_data_plt_sparc::address_for_global,
1169         address_for_local): Likewise.
1170         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1171         address_for_local): Likewise.
1172         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1173         address_for_local): Likewise.
1174         * target.h (Target::plt_address_for_global, plt_address_for_local):
1175         Update comment.
1176         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1177         (Output_data_got::Got_entry::write): Nor here.
1178         * output.h: Comment fix.
1179
1180 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1181
1182         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1183         global_offset_table_ value for larget got.
1184         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1185
1186 2012-09-29  Alan Modra  <amodra@gmail.com>
1187
1188         * powerpc.cc (Target_powerpc::iplt_): New output section.
1189         (Target_powerpc::iplt_section, make_iplt_section,
1190         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1191         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1192         Target_powerpc::plt_entry_count): Count iplt entries too.
1193         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1194         reloc section in constructor.  New params.
1195         (Target_powerpc::make_plt_section): Create reloc section here instead.
1196         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1197         functions.
1198         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1199         (Output_data_glink::add_entry, find_entry): New functions to
1200         deal with local syms.
1201         (Glink_sym_ent): Add support for local syms.
1202         (Output_data_glink::do_write): Handle ifunc plt entries.
1203         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1204         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1205         (Target_powerpc::Relocate::relocate): Likewise.
1206         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1207
1208 2012-09-25  Alan Modra  <amodra@gmail.com>
1209
1210         * object.h (Sized_relobj_file::adjust_local_symbol,
1211         do_adjust_local_symbol): New functions.
1212         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1213         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1214         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1215         and irregular opd entry spacing.
1216         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1217         (Global_symbol_visitor_opd): New functor.
1218         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1219         on deleted opd entries.
1220
1221 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1222
1223         * tilegx.cc: New file.
1224         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1225         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1226         * configure.tgt: Add entries for tilegx*.
1227         * configure.ac: Likewise.
1228         * Makefile.in: Rebuild.
1229         * configure: Likewise.
1230         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1231         tilegx.
1232
1233 2012-09-13  Alan Modra  <amodra@gmail.com>
1234
1235         * target-reloc.h (scan_relocs): Call scan.local for relocs
1236         against symbols in discarded sections.  Pass is_discarded
1237         param.
1238         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1239         Add is_discarded param.
1240         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1241         is_discarded to flag opd entry as discarded.  Don't emit dyn
1242         relocs on such entries.
1243         (Target_powerpc::Scan::global): Similarly detect and handle
1244         such opd entries.
1245         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1246         opd_ent_.  Update all uses.
1247         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1248         (Target_powerpc::relocate_section): Zero out discarded opd
1249         entry relocs.
1250
1251 2012-09-12  Ian Lance Taylor  <iant@google.com>
1252
1253         PR gold/14570
1254         * output.cc: Rename Output_data_got template parameter from size
1255         to got_size for all functions.  Compile all variants of
1256         Output_data_got.
1257         (Output_data_got::Got_entry::write): Correct use of size for
1258         symbol value.  Use local_is_tls rather than casting to
1259         Sized_relobj_file.
1260         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1261         (class Sized_relobj_file): Add do_local_is_tls.
1262         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1263
1264 2012-09-11  Alan Modra  <amodra@gmail.com>
1265
1266         PR gold/14566
1267         * layout.cc (Layout::set_segment_offsets): When using
1268         common-page-size alignment, ensure we are on a new max-page-size
1269         page.
1270         * output.cc (Output_segment::set_section_addresses): Use
1271         abi_pagesize, not common_pagesize for relro boundary.
1272         (Output_segment::set_offset): Likewise.
1273
1274 2012-09-11  Alan Modra  <amodra@gmail.com>
1275
1276         * output.h (Output_data_got::add_global_tls, add_local_tls,
1277         add_local_tls_pair): New functions.
1278         (Output_data_got::add_local_pair_with_rel): Remove second
1279         reloc param.  Expand comment.
1280         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1281         use_plt_or_tls_offset_, similarly for constructor param.
1282         (Output_data_got::Got_entry::write): Add got_index param.
1283         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1284         add_local_tls_pair): New functions.
1285         (Output_data_got::Got_entry::write): Handle tls symbols
1286         with use_plt_or_tls_offset_ set specially.
1287         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1288         (Output_data_got::do_write): Replace iterator with index, pass
1289         index to entry write function.
1290         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1291         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1292         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1293         call.
1294         * i386.cc (Target_i386::Scan::local): Likewise.
1295         * sparc.cc (Target_sparc::Scan::local): Likewise.
1296         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1297         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1298         do_tls_offset_for_global): New functions.
1299         (Target_powerpc::Scan::local): Correct TLS relocations and got
1300         entry values.
1301         (Target_powerpc::Scan::global): Don't emit unnecessary
1302         dynamic relocations on TLS GOT entries.
1303
1304 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1305
1306         * config.in: Disable sanity check for kfreebsd.
1307
1308 2012-09-10  Sterling Augustine  <saugustine@google.com>
1309
1310         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1311         (Gdb_index::pubtypes_read): New parameter.
1312         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1313         to calls.
1314         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1315         pubtypes_object_.
1316
1317 2012-09-09  Alan Modra  <amodra@gmail.com>
1318
1319         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1320         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1321         * gc.h (gc_process_relocs): Call target gc_add_reference.
1322         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1323         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1324         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1325         unnecessary cast.
1326         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1327         to cater for when we don't need code offset.  Update use.
1328         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1329         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1330         set_opd_valid): New functions.
1331         (Target_powerpc::do_gc_add_reference): New function.
1332         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1333         stashed refs.
1334         (Target_powerpc::do_gc_mark_symbol): New function.
1335
1336 2012-09-06  Cary Coutant  <ccoutant@google.com>
1337
1338         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1339         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1340         (Dwarf_die::skip_attributes): Likewise.
1341         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1342         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1343         (main): Call it.
1344         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1345
1346 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1347
1348         * testsuite/script_test_3.t: Add .got.plt output section
1349         statement.
1350         * testsuite/script_test_4.t: Likewise.
1351
1352 2012-09-05  Alan Modra  <amodra@gmail.com>
1353
1354         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1355         update all uses and lose "enum" when using type.
1356
1357 2012-09-05  Alan Modra  <amodra@gmail.com>
1358
1359         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1360         * configure: Regenerate.
1361         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1362         (plugin_final_layout.stdout): Likewise.
1363         (memory_test): Set page sizes to 0x1000.
1364         * testsuite/Makefile.in: Regenerate.
1365         * testsuite/discard_locals_test.sh: Add FIXME comment.
1366         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1367         * testsuite/pr14265.t: Add .got output section statement.
1368         * testsuite/script_test_2.t: Likewise.
1369         * testsuite/script_test_3.t: Likewise.
1370         * testsuite/script_test_4.t: Likewise.
1371         * testsuite/script_test_5.t: Likewise.
1372         * testsuite/script_test_6.t: Likewise.
1373         * testsuite/script_test_7.t: Likewise.
1374         * testsuite/script_test_9.t: Likewise.
1375
1376 2012-09-05  Alan Modra  <amodra@gmail.com>
1377
1378         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1379         (Powerpc_relocate_functions::Status): New typedef.
1380         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1381         (Target_powerpc::Scan::local): Handle REL64.
1382         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1383         for REL32 and REL64.
1384         (Target_powerpc::symval_for_branch): New function, extracted from..
1385         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1386         checks.  Report overflow errors.
1387
1388 2012-09-05  Alan Modra  <amodra@gmail.com>
1389
1390         * object.h (Sized_relobj_file::emit_relocs): Delete.
1391         (Sized_relobj_file::emit_relocs_reltype): Delete.
1392         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1393         relocate_relocs for --emit-relocs.
1394         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1395         * output.h: Update comment.
1396         (Output_segment::first_section): New function.
1397         (Output_segment::first_section_load_address): Use first_section.
1398         * output.cc (Output_segment::first_section): New function extracted..
1399         (Output_segment::first_section_load_address): ..from here.  Delete.
1400         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1401         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1402         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1403         adjust call to target.h function.
1404         * i386.cc (Target_i386): Likewise.
1405         * sparc.cc (Target_sparc): Likewise.
1406         * x86_64.cc (Target_x86_64): Likewise.
1407         * powerpc.cc (Target_powerpc): Likewise.
1408         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1409         first tls section has section symbol for optimised local dynamic
1410         output relocs.
1411         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1412         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1413         optimised tls code.
1414         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1415         Rename to relocate_relocs.  Update error message.
1416
1417 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1418
1419         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1420         --just-symbols.
1421
1422 2012-08-31  Alan Modra  <amodra@gmail.com>
1423
1424         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1425         (Powerpc_relobj::toc_base_offset): New stub function.
1426         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1427         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1428         (Target_powerpc::Relocate::enum skip_tls): New.
1429         (Target_powerpc::call_tls_get_addr_): New var.
1430         (Target_powerpc::is_branch_reloc): Move to file scope.
1431         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1432         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1433         New functions.
1434         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1435         (powerpc_info): Correct common_pagesize for ppc64.
1436         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1437         (Powerpc_relocate_functions): Add overflow check enums and functions.
1438         Add non-shift version of rela, rela_ua.  Delete all rel public
1439         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1440         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1441         addr16_ha3, addr14 functions.
1442         (Output_data_got_powerpc::add_constant_pair): New function.
1443         (Output_data_got_powerpc::got_base_offset): Likewise.
1444         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1445         (instruction constants): Sort, add some more.
1446         (Output_data_glink::do_write): Add and use Address typedef.  Use
1447         object->toc_base_offset() stub for 64-bit.
1448         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1449         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1450         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1451         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1452         Always treat .opd relocs as against locally defined symbol.
1453         Correct condition for RELATIVE relocs.
1454         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1455         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1456         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1457         calculations.  Handle TLS relocs, and more.  Add overflow
1458         checking and adjust for Powerpc_relocate_functions changes.
1459         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1460         Reinstate --emit-relocs code with FIXME.
1461
1462 2012-08-30  Alan Modra  <amodra@gmail.com>
1463
1464         * layout.cc (Layout::set_segment_offsets): Set p_align to
1465         abi_pagesize, not common_pagesize.
1466         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1467         to determine whether file header can go in segment.
1468
1469 2012-08-30  Alan Modra  <amodra@gmail.com>
1470
1471         * output.h (Output_reloc::Output_reloc <output section>): Add
1472         is_relative param.  Adjust calls.
1473         (Output_reloc::add_output_section_relative): New functions.
1474         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1475         is_relative.
1476         (Output_reloc::symbol_value): Handle SECTION_CODE.
1477
1478 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1479
1480         * gold.cc (queue_middle_tasks): Call layout again when unique
1481         segments for sections is desired.
1482         * layout.cc (Layout::Layout): Initialize new members.
1483         (Layout::get_output_section_flags): New function.
1484         (Layout::choose_output_section): Call get_output_section_flags.
1485         (Layout::layout): Make output section for mapping to a unique segment.
1486         (Layout::insert_section_segment_map): New function.
1487         (Layout::attach_allocated_section_to_segment): Make unique segment for
1488         output sections marked so.
1489         (Layout::segment_precedes): Check for unique segments when sorting.
1490         * layout.h (Layout::Unique_segment_info): New struct.
1491         (Layout::Section_segment_map): New typedef.
1492         (Layout::insert_section_segment_map): New function.
1493         (Layout::get_output_section_flags): New function.
1494         (Layout::is_unique_segment_for_sections_specified): New function.
1495         (Layout::set_unique_segment_for_sections_specified): New function.
1496         (Layout::unique_segment_for_sections_specified_): New member.
1497         (Layout::section_segment_map_): New member.
1498         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1499         Rename is_gc_pass_one to is_pass_one.
1500         Rename is_gc_pass_two to is_pass_two.
1501         Rename is_gc_or_icf to is_two_pass.
1502         Check for which pass based on whether symbols data is present.
1503         Make it two pass when unique segments for sections is desired.
1504         * output.cc (Output_section::Output_section): Initialize new
1505         members.
1506         * output.h (Output_section::is_unique_segment): New function.
1507         (Output_section::set_is_unique_segment): New function.
1508         (Output_section::is_unique_segment_): New member.
1509         (Output_section::extra_segment_flags): New function.
1510         (Output_section::set_extra_segment_flags): New function.
1511         (Output_section::extra_segment_flags_): New member.
1512         (Output_section::segment_alignment): New function.
1513         (Output_section::set_segment_alignment): New function.
1514         (Output_section::segment_alignment_): New member.
1515         (Output_segment::Output_segment): Initialize is_unique_segment_.
1516         (Output_segment::is_unique_segment): New function.
1517         (Output_segment::set_is_unique_segment): New function.
1518         (Output_segment::is_unique_segment_): New member.
1519         * plugin.cc (allow_unique_segment_for_sections): New function.
1520         (unique_segment_for_sections): New function.
1521         (Plugin::load): Add new functions to transfer vector.
1522         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1523         * Makefile.in: Regenerate.
1524         * testsuite/plugin_final_layout.sh: Check if unique segment
1525         functionality works.
1526         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1527         are available.
1528         (allow_unique_segment_for_sections): New global.
1529         (unique_segment_for_sections): New global.
1530         (claim_file_hook): Call allow_unique_segment_for_sections.
1531         (all_symbols_read_hook): Call unique_segment_for_sections.
1532
1533 2012-08-22  Cary Coutant  <ccoutant@google.com>
1534
1535         * layout.cc (Layout::include_section): Don't assert on GROUP
1536         sections with --emit-relocs.
1537
1538 2012-08-21  Cary Coutant  <ccoutant@google.com>
1539
1540         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1541         if --export-dynamic-symbol names an undef symbol.
1542
1543 2012-08-18  Alan Modra  <amodra@gmail.com>
1544
1545         * powerpc.cc: Formatting and white space.
1546         (Powerpc_relobj): Rename got2_section_ to special_.
1547         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1548         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1549         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1550         (Target_powerpc): Add Address typedef and invalid_address.  Use
1551         throughout.
1552         (Target_powerpc::is_branch_reloc): New function.
1553         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1554         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1555         for dst_mask, value and addend.
1556         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1557         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1558         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1559         uint16_t for 24-bit offset.  Use get_output_section_offset and
1560         check return.
1561         (Target_powerpc::Scan::local): Handle more relocs.
1562         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1563         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1564         Plug in toc restoring insn after plt calls.  Translate branches
1565         to function descriptor symbols to corresponding entry point.
1566         (Target_powerpc::relocate_for_relocatable): Check return from
1567         get_output_section_offset.
1568         * symtab.h: Comment typo.
1569
1570 2012-08-14  Ian Lance Taylor  <iant@google.com>
1571
1572         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1573         unsupported_relocal_local to call unsupported_reloc_global.
1574
1575 2012-08-14  Nick Clifton  <nickc@redhat.com>
1576
1577         PR ld/14265
1578         * script-sections.cc (Sections_element::output_section_name): Add
1579         keep return parameter.
1580         (Output_section_element::match_name): Add keep return parameter.
1581         Return the value of the keep_ member.
1582         * script-sections.h (class Output_section): Update
1583         output_section_name prototype.
1584         * layout.cc (Layout::keep_input_section): New public member
1585         function.
1586         (Layout::choose_output_section): Pass keep parameter to
1587         output_section_name.
1588         * layout.h (class Layout): Add keep_input_section.
1589         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1590         sections.
1591         * testsuite/Makefile.am: Add a test.
1592         * testsuite/Makefile.in: Regenerate.
1593         * testsuite/pr14265.c: Source file for the test.
1594         * testsuite/pr14265.t: Linker script for the test.
1595         * testsuite/pr14265.sh: Shell script for the test.
1596
1597 2012-08-14  Alan Modra  <amodra@gmail.com>
1598
1599         * target.h (Target::output_section_name): New function.
1600         (Target::do_output_section_name): New function.
1601         * layout.cc (Layout::choose_output_section): Call the above.
1602         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1603
1604 2012-08-14  Alan Modra  <amodra@gmail.com>
1605
1606         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1607         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1608         for replace_constant call.
1609         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1610         (Output_data_glink::do_print_to_mapfile): New function.
1611         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1612         (Target_powerpc::Relocate::relocate): Likewise.
1613
1614 2012-08-14  Alan Modra  <amodra@gmail.com>
1615
1616         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1617         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1618         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1619         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1620         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1621         here.
1622         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1623         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1624         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1625         here.
1626         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1627         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1628
1629 2012-08-12  Alan Modra  <amodra@gmail.com>
1630
1631         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1632         (glink insn constants): Use uint32_t.
1633         (Output_data_glink::add_entry): Use insert, not [] operator.
1634
1635 2012-08-11  Alan Modra  <amodra@gmail.com>
1636
1637         * object.h (Sized_relobj_file::find_shdr): New function.
1638         (Sized_relobj_file::find_special_sections): New function.
1639         * object.cc (Sized_relobj_file::find_shdr): New function.
1640         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1641         (Sized_relobj_file::find_special_sections): New function, split out..
1642         (Sized_relobj_file::do_read_symbols): ..from here.
1643         * output.h (Output_data_got::replace_constant): New function.
1644         (Output_data_got::num_entries): New function.
1645         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1646         (Output_data_got::got_offset): Protected rather than private.
1647         (Output_data_got::replace_got_entry): New function.
1648         * output.cc (Output_data_got::replace_got_entry): New function.
1649         * powerpc.cc (class Powerpc_relobj): New.
1650         (class Powerpc_relocate_functions): Delete all psymval variants or
1651         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1652         Implement _ha functions using corresponding _hi function.
1653         (Powerpc_relobj::find_special_sections): New function.
1654         (Target_powerpc::do_make_elf_object): New function.
1655         (class Output_data_got_powerpc): New.
1656         (class Output_data_glink): New.
1657         (class Powerpc_scan_relocatable_reloc): New.
1658         Many more changes througout file.
1659
1660 2012-08-09  Nick Clifton  <nickc@redhat.com>
1661
1662         * po/vi.po: Updated Vietnamese translation.
1663
1664 2012-08-07  Ian Lance Taylor  <iant@google.com>
1665
1666         * layout.cc (Layout::add_target_dynamic_tags): If
1667         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1668         plt_rel.
1669
1670 2012-07-30  Nick Clifton  <nickc@redhat.com>
1671
1672         * po/gold.pot: Updated template.
1673         * po/es.po: Updated Spanish translation.
1674
1675 2012-07-18  Cary Coutant  <ccoutant@google.com>
1676
1677         PR gold/14344
1678         * configure.ac: Add check for -gpubnames support.
1679         * configure: Regenerate.
1680         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1681         support; force -gno-pubnames.
1682         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1683         support.
1684         (gdb_index_test_4): New test.
1685         * testsuite/Makefile.in: Regenerate.
1686         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1687         * testsuite/gdb_index_test_2.sh: Likewise.
1688         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1689         * testsuite/gdb_index_test_4.sh: New script.
1690         * testsuite/gdb_index_test_comm.sh: New script with common code;
1691         don't look for space after colon.
1692
1693 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1694
1695         * gold.cc (queue_middle_tasks): Update function order only after
1696         deferred objects due to plugins are processed.
1697
1698 2012-07-11  Ian Lance Taylor  <iant@google.com>
1699
1700         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1701         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1702         (Target_arm::scan_reloc_for_stub): Likewise.
1703         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1704         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1705         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1706         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1707         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1708
1709 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1710             Ian Lance Taylor  <iant@google.com>
1711
1712         PR gold/14309
1713         * configure.ac: Test whether std::tr1::hash<off_t> works.
1714         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1715         needed.
1716         * output.h (class Output_fill): Add virtual destructor.
1717         * configure, config.in: Rebuild.
1718
1719 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1720
1721         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1722
1723 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1724
1725         * plugin.cc (Plugin::load): Handle position independent executables.
1726
1727 2012-06-06  Cary Coutant  <ccoutant@google.com>
1728
1729         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1730         add .debug_macro.
1731         (lines_only_debug_sections): Likewise.
1732         (gdb_fast_lookup_sections): New static array.
1733         (is_gdb_debug_section): Rename formal parameter.
1734         (is_lines_only_debug_section): Likewise.
1735         (is_gdb_fast_lookup_section): New function.
1736         (Layout::include_section): Check for ".zdebug_" prefix; pass
1737         section name suffix to is_gdb_debug_section, et al.; check for
1738         fast-lookup sections when building .gdb_index.
1739         * options.h (--strip-debug-gdb): Update GDB version number.
1740
1741 2012-06-06  Cary Coutant  <ccoutant@google.com>
1742
1743         * configure.ac: Add check for fallocate.
1744         * configure: Regenerate.
1745         * config.in: Regenerate.
1746
1747         * options.h (class General_options): Add --mmap-output-file and
1748         --posix-fallocate options.
1749         * output.cc: (posix_fallocate): Remove; replace with...
1750         (gold_fallocate): New function.
1751         (Output_file::map_no_anonymous): Call gold_fallocate.
1752         (Output_file::map): Check --mmap-output-file option.
1753
1754 2012-06-05  Jing Yu  <jingyu@google.com>
1755
1756         * gold.h (textdomain): Add do {} to empty while(0).
1757         (bindtextdomain): Likewise.
1758
1759 2012-06-04  Cary Coutant  <ccoutant@google.com>
1760
1761         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1762         has_dynsym_index.
1763
1764 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1765
1766         * symtab.cc (Symbol_table::define_special_symbol):
1767         Initialize *poldsym to prevent uninitialized variable errors.
1768
1769 2012-05-23  Cary Coutant  <ccoutant@google.com>
1770
1771         * layout.cc (Layout::section_name_mapping): Add rules to handle
1772         exact match on .data.rel.ro.local or .data.rel.ro.
1773         (Layout::output_section_name): Check for exact matches.
1774
1775 2012-05-23  Cary Coutant  <ccoutant@google.com>
1776
1777         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1778         more carefully.
1779
1780 2012-05-22  Cary Coutant  <ccoutant@google.com>
1781
1782         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1783         object before exporting symbol.
1784
1785 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1786
1787         * testsuite/tls_test.cc: Include "config.h" first.
1788         * testsuite/tls_test_c.c: Likewise.
1789
1790 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1791             Nick Clifton  <nickc@redhat.com>
1792
1793         PR 14072
1794         * configure.in: Add check that sysdep.h has been included before
1795         any system header files.
1796         * configure: Regenerate.
1797         * config.in: Regenerate.
1798
1799 2012-05-14  Cary Coutant  <ccoutant@google.com>
1800
1801         * layout.cc (Layout::make_output_section): Mark .tdata section
1802         as RELRO.
1803         * testsuite/relro_test.cc: Add a TLS variable.
1804
1805 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1806
1807         PR gold/14091
1808         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1809         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1810         R_X86_64_64.
1811
1812 2012-05-08  Cary Coutant  <ccoutant@google.com>
1813
1814         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1815         (lines_only_debug_sections): Likewise.
1816
1817 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1818
1819         * nacl.cc: New file.
1820         * nacl.h: New file.
1821         * Makefile.am (CCFILES, HFILES): Add them.
1822         * Makefile.in: Regenerate.
1823         * i386.cc (Output_data_plt_i386_nacl): New class.
1824         (Output_data_plt_i386_nacl_exec): New class.
1825         (Output_data_plt_i386_nacl_dyn): New class.
1826         (Target_i386_nacl): New class.
1827         (Target_selector_i386_nacl): New class.
1828         (target_selector_i386): Use it instead of Target_selector_i386.
1829         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1830         (Target_x86_64_nacl): New class.
1831         (Target_selector_x86_64_nacl): New class.
1832         (target_selector_x86_64, target_selector_x32): Use it instead of
1833         Target_selector_x86_64.
1834         * arm.cc (Output_data_plt_arm_nacl): New class.
1835         (Target_arm_nacl): New class.
1836         (Target_selector_arm_nacl): New class.
1837         (target_selector_arm, target_selector_armbe): Use it instead of
1838         Target_selector_arm.
1839
1840         * target-select.cc (select_target): Take new Input_file* and off_t
1841         arguments, pass them on to recognize method of selector.
1842         * object.cc (make_elf_sized_object): Update caller.
1843         * parameters.cc (parameters_force_valid_target): Likewise.
1844         * incremental.cc (make_sized_incremental_binary): Likewise.
1845         * target-select.h: Update decl.
1846         (Target_selector::recognize): Take new Input_file* argument,
1847         pass it on to do_recognize.
1848         (Target_selector::do_recognize): Take new Input_file* argument.
1849         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1850         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1851         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1852         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1853
1854         * target.h (Target::Target_info): New members isolate_execinstr
1855         and rosegment_gap.
1856         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1857         * arm.cc (Target_arm::arm_info): Update initializer.
1858         * i386.cc (Target_i386::i386_info): Likewise.
1859         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1860         * sparc.cc (Target_sparc::sparc_info): Likewise.
1861         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1862         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1863         * layout.cc (Layout::attach_allocated_section_to_segment):
1864         Take new const Target* argument.  If target->isolate_execinstr(), act
1865         like --rosegment.
1866         (Layout::find_first_load_seg): Take new const Target* argument;
1867         if target->isolate_execinstr(), reject PF_X segments.
1868         (Layout::relaxation_loop_body): Update caller.
1869         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1870         reset file offset to zero when we hit LOAD_SEG, and then do a second
1871         loop over the segments before LOAD_SEG to reassign offsets after
1872         addresses have been determined.  Handle target->rosegment_gap().
1873         (Layout::attach_section_to_segment): Take new const Target* argument;
1874         pass it to attach_allocated_section_to_segment.
1875         (Layout::make_output_section): Update caller.
1876         (Layout::attach_sections_to_segments): Take new const Target* argument;
1877         pass it to attach_section_to_segment.
1878         * gold.cc (queue_middle_tasks): Update caller.
1879         * layout.h (Layout): Update method decls with new arguments.
1880
1881         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1882         Target_info pointer to use.
1883         (Target_arm::do_make_data_plt): New virtual method.
1884         (Target_arm::make_data_plt): New method that calls it.
1885         (Target_arm::make_plt_entry): Use it.
1886         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1887         for the section alignment.
1888         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1889         method.
1890         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1891         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1892         method.
1893         (Output_data_plt_arm::get_plt_entry_size): Call it.
1894         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1895         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1896         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1897         method.
1898         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1899         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1900         method instead of sizeof(plt_entry).
1901         (Output_data_plt_arm::add_entry): Likewise.
1902         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1903         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1904         than static method.
1905         (Target_arm::plt_entry_size): Likewise.
1906         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1907         Move to ...
1908         (Output_data_plt_arm_standard): ... here, new class.
1909         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1910         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1911         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1912
1913         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1914         Take additional argument for the PLT entry size.
1915         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1916         Use get_plt_entry_size method rather than plt_entry_size variable.
1917         (Output_data_plt_x86_64::reserve_slot): Likewise.
1918         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1919         (Output_data_plt_x86_64::add_entry): Likewise.
1920         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1921         (Output_data_plt_x86_64::address_for_global): Likewise.
1922         (Output_data_plt_x86_64::address_for_local): Likewise.
1923         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1924         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1925         Make method non-static.
1926         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1927         method.
1928         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1929         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1930         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1931         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1932         virtual method.
1933         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1934         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1935         virtual method.
1936         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1937         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1938         virtual method.
1939         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1940         (Output_data_plt_x86_64::plt_entry_size)
1941         (Output_data_plt_x86_64::first_plt_entry)
1942         (Output_data_plt_x86_64::plt_entry)
1943         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1944         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1945         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1946         (Output_data_plt_x86_64_standard): ... here, new class.
1947         (Target_x86_64::Target_x86_64): Take optional argument for the
1948         Target_info pointer to use.
1949         (Target_x86_64::do_make_data_plt): New virtual method.
1950         (Target_x86_64::make_data_plt): New method to call it.
1951         (Target_x86_64::init_got_plt_for_update): Use that.
1952         Call this->plt_->add_eh_frame method here.
1953         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1954         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1955         rather than static method.
1956         (Target_x86_64::plt_entry_size): Likewise.
1957         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1958         rather than plt_entry_size variable.  Move guts of PLT filling to...
1959         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1960         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1961         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1962
1963         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1964         additional argument for the section alignment.
1965         Don't do add_eh_frame_for_plt here.
1966         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1967         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1968         variable.
1969         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1970         method.
1971         (Output_data_plt_i386::get_plt_entry_size): Call it.
1972         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1973         (Output_data_plt_i386::add_eh_frame): New method to call it.
1974         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1975         method.
1976         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1977         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1978         method.
1979         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1980         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1981         method instead of plt_entry_size.
1982         (Output_data_plt_i386::plt_entry_size)
1983         (Output_data_plt_i386::plt_eh_frame_fde_size)
1984         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1985         (Output_data_plt_i386_standard): ... here, new class.
1986         (Output_data_plt_i386_exec): New class.
1987         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1988         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1989         (Output_data_plt_i386::exec_plt_entry): Move to ...
1990         (Output_data_plt_i386_exec::plt_entry): ... here.
1991         (Output_data_plt_i386_dyn): New class.
1992         (Output_data_plt_i386::first_plt_entry): Move to ...
1993         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1994         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1995         (Output_data_plt_i386_dyn::plt_entry): ... here.
1996         (Target_i386::Target_i386): Take optional argument for the Target_info
1997         pointer to use.
1998         (Target_i386::do_make_data_plt): New virtual method.
1999         (Target_i386::make_data_plt): New method to call it.
2000         (Target_i386::make_plt_section): Use that.
2001         Call this->plt_->add_eh_frame method here.
2002         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2003         rather than plt_entry_size variable.
2004         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2005         (Output_data_plt_i386::address_for_local): Likewise.
2006         (Output_data_plt_i386::do_write): Likewise.
2007         Move guts of PLT filling to...
2008         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2009         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2010         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2011         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2012
2013 2012-05-01  Cary Coutant  <ccoutant@google.com>
2014
2015         * dwarf_reader.cc (Dwarf_die::read_attributes)
2016         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2017         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2018         * reduced_debug_output.cc
2019         (Output_reduced_debug_info_section::get_die_end): Remove
2020         DW_FORM_GNU_ref_index.  Add default case.
2021
2022 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2023
2024         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2025         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2026         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2027         DW_AT_high_pc as offset from DW_AT_low_pc.
2028
2029         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2030         * testsuite/Makefile.in: Regenerate.
2031         * testsuite/gdb_index_test_3.c: New test source file.
2032         * testsuite/gdb_index_test_3.sh: New test source file.
2033
2034 2012-04-25  Ian Lance Taylor  <iant@google.com>
2035
2036         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2037         pointer.
2038         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2039         as a class, not a struct.
2040         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2041         (Target_arm::apply_cortex_a8_workaround): Likewise.
2042         * gc.h: Declare Reloc_types as a struct, not a class.
2043         * object.h: Declare Symbols_data as a struct.
2044         * reloc.h: Declare Read_relocs_data as a struct.
2045         * target.h: Declare Relocate_info as a struct.
2046
2047 2012-04-24  David S. Miller  <davem@davemloft.net>
2048
2049         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2050         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2051         and R_SPARC_WPLT30.
2052
2053 2012-04-24  Cary Coutant  <ccoutant@google.com>
2054
2055         * incremental-dump.cc (find_input_containing_global): Replace
2056         magic number with symbolic constant.
2057         (dump_incremental_inputs): Update version number.
2058         * incremental.cc (Output_section_incremental_inputs): Update version
2059         number; import symbolic constants from Incremental_inputs_reader.
2060         (Incremental_inputs::create_data_sections): Align relocations
2061         section correctly for 64-bit targets.
2062         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2063         constants; add padding.
2064         (Output_section_incremental_inputs::write_header): Add assert for
2065         header_size.
2066         (Output_section_incremental_inputs::write_input_files): Add assert
2067         for input_entry_size.
2068         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2069         add assert for object_info_size, input_section_entry_size,
2070         global_sym_entry_size.
2071         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2072         for data structure sizes; use them.
2073         (Incremental_input_entry_reader): Import symbolic constants from
2074         Incremental_inputs_reader; use them.
2075
2076 2012-04-23  David S. Miller  <davem@davemloft.net>
2077
2078         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2079         and elf_flags_set_.
2080         (Target_sparc::Target_sparc): Initialize new fields.
2081         (Target_sparc::do_make_elf_object): New function.
2082         (Target_sparc::do_adjust_elf_header): New function.
2083
2084 2012-04-23  Cary Coutant  <ccoutant@google.com>
2085
2086         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2087         CU range table of gdb index.
2088
2089 2012-04-20  David S. Miller  <davem@davemloft.net>
2090
2091         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2092         instead of false.
2093
2094 2012-04-16  David S. Miller  <davem@davemloft.net>
2095
2096         * sparc.cc (Target_sparc::got_address): New function.
2097         (Sparc_relocate_functions::gdop_hix22): New function.
2098         (Sparc_relocate_functions::gdop_lox10): New function.
2099         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2100         relocs.
2101         (Target_sparc::Scan::local): Likewise if the global symbol is not
2102         preemptible and is not IFUNC.
2103         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2104         transformations for local and non-preemptible non-IFUNC global
2105         symbols.
2106
2107         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2108         writing out 64-bit part of ranges.
2109
2110         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2111         -fpic and -fpie respectively.
2112         * Makefile.in: Regenerate.
2113
2114         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2115         (Target_sparc::Target_sparc): Initialize new field.
2116         (Target_sparc::do_plt_section_for_global): New function.
2117         (Target_sparc::do_plt_section_for_local): New function.
2118         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2119         (Target_sparc::make_plt_section): New function, broken out of
2120         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2121         (Target_sparc::make_plt_entry): Call make_plt_section.
2122         (Target_sparc::make_local_ifunc_plt_entry): New function.
2123         (Target_sparc::rela_ifunc_section): New function.
2124         (Target_sparc::plt_section): Remove const.
2125         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2126         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2127         and ifunc_count_ fields.
2128         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2129         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2130         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2131         (Output_data_plt_sparc::rela_ifunc): New function.
2132         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2133         (Output_data_plt_sparc::has_ifunc_section): New function.
2134         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2135         (Output_data_plt_sparc::address_for_global): New function.
2136         (Output_data_plt_sparc::address_for_local): New function.
2137         (Output_data_plt_sparc::plt_index_to_offset): New function.
2138         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2139         and entry_count.
2140         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2141         entry_count.
2142         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2143         R_SPARC_JMP_IREL to switch.
2144         (Target_sparc::Scan::check_non_pic): Likewise.
2145         (Target_sparc::Scan::local): Handle IFUNC symbols.
2146         (Target_sparc::Scan::local): Likewise.
2147         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2148         and plt_address_for_local.
2149         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2150         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2151
2152         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2153         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2154         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2155         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2156         global relocs too.
2157         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2158         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2159         calls.
2160         * sparc.cc (Target_sparc::Scan::global): Likewise.
2161         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2162
2163 2012-04-16  Cary Coutant  <ccoutant@google.com>
2164
2165         * archive.cc (Library_base::should_include_member): Check for
2166         --export-dynamic-symbol.
2167         * options.h (class General_options): Add --export-dynamic-symbol.
2168         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2169         --export-dynamic-symbol.
2170         (Symbol_table::gc_mark_undef_symbols): Likewise.
2171         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2172
2173 2012-04-12  David S. Miller  <davem@davemloft.net>
2174
2175         * sparc.cc (Reloc::wdisp10): New relocation method.
2176         (Reloc::h34): Likewise.
2177         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2178         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2179         R_SPARC_WDISP10.
2180         (Target_sparc::Scan::local): Likewise.
2181         (Target_sparc::Scan::global): Likewise.
2182         (Target_sparc::Relocate::relocate): Likewise.
2183
2184 2012-04-09  Cary Coutant  <ccoutant@google.com>
2185
2186         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2187         low_pc == 0.
2188
2189 2012-04-06  Ian Lance Taylor  <iant@google.com>
2190
2191         * timer.cc: #include <unistd.h>.
2192
2193 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2194
2195         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2196         * config.in: Regenerate.
2197         * configure: Regenerate.
2198
2199 2012-04-05  Nick Clifton  <nickc@redhat.com>
2200
2201         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2202         (AM_LC_MESSAGES): Add.
2203         * aclocal.m4: Regenerate.
2204         * config.in: Regenerate.
2205         * configure: Regenerate.
2206
2207 2012-03-21  Cary Coutant  <ccoutant@google.com>
2208
2209         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2210         * Makefile.in: Regenerate.
2211         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2212         (Sized_elf_reloc_mapper::symbol_section): New function.
2213         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2214         (make_elf_reloc_mapper): New function.
2215         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2216         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2217         (Dwarf_abbrev_table::do_get_abbrev): New function.
2218         (Dwarf_ranges_table::read_ranges_table): New function.
2219         (Dwarf_ranges_table::read_range_list): New function.
2220         (Dwarf_pubnames_table::read_section): New function.
2221         (Dwarf_pubnames_table::read_header): New function.
2222         (Dwarf_pubnames_table::next_name): New function.
2223         (Dwarf_die::Dwarf_die): New function.
2224         (Dwarf_die::read_attributes): New function.
2225         (Dwarf_die::skip_attributes): New function.
2226         (Dwarf_die::set_name): New function.
2227         (Dwarf_die::set_linkage_name): New function.
2228         (Dwarf_die::attribute): New function.
2229         (Dwarf_die::string_attribute): New function.
2230         (Dwarf_die::int_attribute): New function.
2231         (Dwarf_die::uint_attribute): New function.
2232         (Dwarf_die::ref_attribute): New function.
2233         (Dwarf_die::child_offset): New function.
2234         (Dwarf_die::sibling_offset): New function.
2235         (Dwarf_info_reader::check_buffer): New function.
2236         (Dwarf_info_reader::parse): New function.
2237         (Dwarf_info_reader::do_parse): New function.
2238         (Dwarf_info_reader::do_read_string_table): New function.
2239         (Dwarf_info_reader::lookup_reloc): New function.
2240         (Dwarf_info_reader::get_string): New function.
2241         (Dwarf_info_reader::visit_compilation_unit): New function.
2242         (Dwarf_info_reader::visit_type_unit): New function.
2243         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2244         Sized_elf_reloc_mapper.
2245         (Sized_dwarf_line_info::symbol_section): Remove function.
2246         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2247         (Sized_dwarf_line_info::read_line_mappings): Remove object
2248         parameter, adjust callers.
2249         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2250         * dwarf_reader.h: Include <sys/types.h>.
2251         (class Track_relocs): Remove forward declaration.
2252         (class Elf_reloc_mapper): New class.
2253         (class Sized_elf_reloc_mapper): New class.
2254         (class Dwarf_abbrev_table): New class.
2255         (class Dwarf_range_list): New class.
2256         (class Dwarf_ranges_table): New class.
2257         (class Dwarf_pubnames_table): New class.
2258         (class Dwarf_die): New class.
2259         (class Dwarf_info_reader): New class.
2260         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2261         (Sized_dwarf_line_info::symbol_section): Remove member function.
2262         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2263         base class.
2264         * gdb-index.cc: New source file.
2265         * gdb-index.h: New source file.
2266         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2267         and .debug_types sections, call Layout::add_to_gdb_index.
2268         (Sized_relobj_incr::do_section_name): Implement.
2269         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2270         return type; Implement.
2271         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2272         return type.
2273         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2274         parameter list and return type.
2275         (Sized_incr_dynobj::do_section_contents): Likewise.
2276         * layout.cc: Include gdb-index.h.
2277         (Layout::Layout): Initialize gdb_index_data_.
2278         (Layout::init_fixed_output_section): Check for .gdb_index section.
2279         (Layout::add_to_gdb_index): New function. Instantiate.
2280         * layout.h: Add forward declaration for class Gdb_index.
2281         (Layout::add_to_gdb_index): New member function.
2282         (Layout::gdb_index_data_): New data member.
2283         * main.cc: Include gdb-index.h.
2284         (main): Print statistics for gdb index.
2285         * object.cc (Object::section_contents): Move code into
2286         do_section_contents.
2287         (need_decompressed_section): Check for sections needed when building
2288         gdb index.
2289         (build_compressed_section_map): Likewise.
2290         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2291         gdb index.
2292         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2293         sections; call Layout::add_to_gdb_index.
2294         (Sized_relobj_file::do_decompressed_section_contents): Call
2295         do_section_contents directly.
2296         * object.h (Object::do_section_contents): Adjust parameter list and
2297         return type.
2298         (Object::do_decompressed_section_contents): Call do_section_contents
2299         directly.
2300         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2301         return type.
2302         * options.h (class General_options): Add --gdb-index option.
2303         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2304         list and return type.
2305         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2306         * reloc.h (Track_relocs::checkpoint): New function.
2307         (Track_relocs::reset): New function.
2308
2309         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2310         New test cases.
2311         * testsuite/Makefile.in: Regenerate.
2312         * testsuite/gdb_index_test.cc: New test source file.
2313         * testsuite/gdb_index_test_1.sh: New test source file.
2314         * testsuite/gdb_index_test_2.sh: New test source file.
2315
2316 2012-03-19  Doug Kwan  <dougkwan@google.com>
2317
2318         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2319         (Target_arm::do_finalize_sections): Remove code which defines
2320         __exidx_start and __exidx_end.  Make symbol table parameter
2321         anonymous as it is not used.
2322         * gold.cc (queue_middle_tasks): Call target hook to define any
2323         target-specific symbols.
2324         * target.h (Target::define_standard_symbols): New method.
2325         (Target::do_define_standard_symbols): Same.
2326         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2327         * testsuite/Makefile.in: Regenerate.
2328         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2329         and __exidx_end.
2330         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2331         relocations are generated for __exidx_start and __exidx_end.
2332
2333 2012-03-16  Doug Kwan  <dougkwan@google.com>
2334
2335         * testsuite/Makefile.am: Disable test initpri3b.
2336         * testsuite/Makefile.in: Regenerate.
2337
2338 2012-03-15  Doug Kwan  <dougkwan@google.com>
2339
2340         * arm.cc (Target_arm::got_section): Make .got section read-only
2341         if -z now is given.
2342
2343 2012-03-15  Ian Lance Taylor  <iant@google.com>
2344
2345         PR gold/13850
2346         * layout.cc (Layout::make_output_section): Correctly mark
2347         SHT_INIT_ARRAY, et. al., as relro.
2348
2349 2012-03-14  Doug Kwan  <dougkwan@google.com>
2350
2351         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2352         dynamic relocations for protected symbols in shared objects.
2353
2354 2012-03-13  Ian Lance Taylor  <iant@google.com>
2355
2356         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2357         keep the larger alignment.
2358
2359 2012-03-12  Cary Coutant  <ccoutant@google.com>
2360
2361         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2362         handling of DW_LNE_define_file.
2363
2364 2012-03-12  Cary Coutant  <ccoutant@google.com>
2365
2366         * reduced_debug_output.cc
2367         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2368         codes to switch.
2369
2370 2012-02-29  Cary Coutant  <ccoutant@google.com>
2371
2372         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2373
2374 2012-02-29  Cary Coutant  <ccoutant@google.com>
2375
2376         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2377         Call Object::decompressed_section_contents.
2378         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2379         New dtor.
2380         (Sized_dwarf_line_info::buffer_start_): New data member.
2381         * merge.cc (Output_merge_data::do_add_input_section): Call
2382         Object::decompressed_section_contents.
2383         (Output_merge_string::do_add_input_section): Likewise.
2384         * object.cc (need_decompressed_section): New function.
2385         (build_compressed_section_map): Decompress sections needed later.
2386         (Sized_relobj_file::do_decompressed_section_contents): New function.
2387         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2388         * object.h (Object::decompressed_section_contents): New function.
2389         (Object::discard_decompressed_sections): New function.
2390         (Object::do_decompressed_section_contents): New function.
2391         (Object::do_discard_decompressed_sections): New function.
2392         (Compressed_section_info): New type.
2393         (Compressed_section_map): Include decompressed section contents.
2394         (Sized_relobj_file::do_decompressed_section_contents): New function.
2395         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2396
2397 2012-02-16  Cary Coutant  <ccoutant@google.com>
2398
2399         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2400         * testsuite/Makefile.in: Regenerate.
2401
2402 2012-02-14  Cary Coutant  <ccoutant@google.com>
2403
2404         * options.cc (General_options::finalize): Disallow -pie and -static.
2405
2406 2012-02-03  Doug Kwan  <dougkwan@google.com>
2407
2408         * arm.cc (Arm_relocate_functions::abs8,
2409         Arm_relocate_functions::abs16): Use
2410         Bits::has_signed_unsigned_overflow32.
2411         (Arm_relocate_functions::thm_abs8): Correct range of
2412         overflow check.
2413         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2414         in assertions.
2415
2416 2012-02-02  Doug Kwan  <dougkwan@google.com>
2417
2418         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2419         position independent outputs, not just shared objects.
2420
2421 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2422
2423         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2424         * configure: Regenerated.
2425
2426 2012-01-27  Ian Lance Taylor  <iant@google.com>
2427
2428         * reloc.h (Bits): New class with static functions, copied from
2429         namespace utils in arm.cc.
2430         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2431         instead.
2432
2433 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2434
2435         * incremental.cc (write_info_blocks): Correct relocation offset.
2436
2437 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2438
2439         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2440         (Relocate::tls_gd_to_le): Likewise.
2441
2442 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2443
2444         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2445
2446 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2447
2448         * configure.ac: Check if -mcmodel=medium works.
2449         * configure: Regenerated.
2450
2451 2012-01-24  Cary Coutant  <ccoutant@google.com>
2452
2453         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2454         definition and ...
2455         (read_unsigned_LEB_128_x): ... this new function.
2456         (read_signed_LEB_128): Replaced with inline definition and ...
2457         (read_signed_LEB_128_x): ... this new function.
2458         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2459         (read_unsigned_LEB_128): Add inline definition.
2460         (read_signed_LEB_128_x): New function.
2461         (read_signed_LEB_128): Add inline definition.
2462         * testsuite/Makefile.am (leb128_unittest): New unit test.
2463         * testsuite/Makefile.in: Regenerate.
2464         * testsuite/leb128_unittest.cc: New unit test.
2465
2466 2012-01-23  Ian Lance Taylor  <iant@google.com>
2467
2468         PR gold/13617
2469         * i386.cc (Target_i386::do_code_fill): When using a jmp
2470         instruction, pad with nop instructions.
2471         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2472
2473 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2474
2475         * x86_64.cc (gc_process_relocs): Add typename on types used in
2476         template.
2477         (scan_relocs): Likewise.
2478         (relocate_section): Likewise.
2479         (apply_relocation): Likewise.
2480
2481 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2482
2483         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2484         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2485         under x32.
2486
2487 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2488
2489         * x86_64.cc: Initial support for x32.
2490
2491 2012-01-03  Cary Coutant  <ccoutant@google.com>
2492
2493         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2494         Use abstract base class for GOT.
2495         * gold/output.h (class Output_data_got_base): New abstract base class.
2496         (class Output_data_got): Derive from new base class, adjust ctors.
2497         (Output_data_got::reserve_slot): Make virtual; rename to
2498         do_reserve_slot; Adjust callers.
2499         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2500         pointer to abstract base class.
2501         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2502
2503 2011-12-18  Ian Lance Taylor  <iant@google.com>
2504
2505         * object.h (Relobj::local_symbol_value): New function.
2506         (Relobj::local_plt_offset): New function.
2507         (Relobj::local_has_got_offset): New function.
2508         (Relobj::local_got_offset): New function.
2509         (Relobj::set_local_got_offset): New function.
2510         (Relobj::do_local_symbol_value): New pure virtual function.
2511         (Relobj::do_local_plt_offset): Likewise.
2512         (Relobj::do_local_has_got_offset): Likewise.
2513         (Relobj::do_local_got_offset): Likewise.
2514         (Relobj::do_set_local_got_offset): Likewise.
2515         (Sized_relobj::do_local_has_got_offset): Rename from
2516         local_has_got_offset.
2517         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2518         (Sized_relobj::do_set_local_got_offset): Rename from
2519         set_local_got_offset.
2520         (Sized_relobj_file::do_local_plt_offset): Rename from
2521         local_plt_offset.
2522         (Sized_relobj_file::do_local_symbol_value): New function.
2523         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2524         local_plt_offset.
2525         * output.cc (Output_data_got::Got_entry::write): Change object to
2526         Relobj.  Use local_symbol_value.
2527         (Output_data_got::add_global_with_rel): Change rel_dyn to
2528         Output_data_reloc_generic*.  Use add_global_generic.
2529         (Output_data_got::add_global_with_rela): Remove.  Change all
2530         callers to use add_global_with_rel.
2531         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2532         Output_data_reloc_generic*.  Use add_global_generic.
2533         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2534         callers to use add_global_pair_with_rel.
2535         (Output_data_got::add_local): Change object to Relobj*.
2536         (Output_data_got::add_local_plt): Likewise.
2537         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2538         change rel_dyn to Output_data_reloc_generic*.  Use
2539         add_local_generic.
2540         (Output_data_got::add_local_with_rela): Remove.  Change all
2541         callers to use all_local_with_rel.
2542         (Output_data_got::add_local_pair_with_rel): Change object to
2543         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2544         add_output_section_generic.
2545         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2546         callers to use add_local_pair_with_rel.
2547         (Output_data_got::reserve_local): Change object to Relobj*.
2548         * output.h: (class Output_data_reloc_generic): Add pure virtual
2549         declarations for add_global_generic, add_local_generic,
2550         add_output_section_generic.
2551         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2552         functions for Output_data_reloc_generic.  Update declarations for
2553         changes listed in output.cc.
2554         (class Output_data_got): Change template parameter to got_size.
2555         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2556         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2557         function.
2558         (Sized_relobj_incr::do_local_plt_offset): New function.
2559         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2560         add_global_generic.
2561
2562 2011-12-17  Cary Coutant  <ccoutant@google.com>
2563
2564         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2565         * resolve.cc (Symbol_table::resolve): Likewise.
2566         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2567         arrays.
2568         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2569
2570 2011-12-16  Ian Lance Taylor  <iant@google.com>
2571
2572         * output.h (Output_data_reloc_generic::add): Only call
2573         add_dynamic_reloc if this is a dynamic reloc section.
2574
2575 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2576
2577         PR gold/13505
2578         * target-reloc.h (apply_relocation): Replace <64, false> with
2579         <size, big_endian>.
2580
2581 2011-11-25  Nick Clifton  <nickc@redhat.com>
2582
2583         * po/it.po: New Italian translation.
2584
2585 2011-11-17  Sterling Augustine  <saugustine@google.com>
2586
2587         * script.cc (script_include_directive): Implement.
2588         (read_script_file): New local variables name and search_path. Update
2589         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2590         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2591         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2592
2593 2011-11-11  Sterling Augustine  <saugustine@google.com>
2594
2595         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2596         (file_or_sections_cmd): Likewise.
2597
2598 2011-11-11  Doug Kwan  <dougkwan@google.com>
2599
2600         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2601         if --just-symbols is given.
2602
2603 2011-11-10  Doug Kwan  <dougkwan@google.com>
2604
2605         PR gold/13362
2606         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2607         when processing data relocs.
2608         * reloc.h (Relocate_functions::rel_unaligned): New method.
2609         (Relocate_functions::pcrel_unaligned): Ditto.
2610         (Relocate_functions::rel32_unaligned): Ditto.
2611         (Relocate_functions::pcrel32_unaligned): Ditto.
2612
2613 2011-11-09  Doug Kwan  <dougkwan@google.com>
2614
2615         PR gold/13362
2616         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2617         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2618         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2619         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2620         (Relocate_functions::rel_unaligned): New.
2621         (Relocate_functions::rel32_unaligned): New.
2622         * target-reloc.h (relocate_for_relocatable): Add code to handle
2623         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2624         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2625         arm_unaligned_reloc_r): New targets.
2626         * testsuite/Makefile.in: Regenerate.
2627         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2628         linking.
2629
2630 2011-11-02  Ian Lance Taylor  <iant@google.com>
2631
2632         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2633         NATIVE_LINKER.
2634         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2635         * options.cc (General_options::finalize): Use library search path
2636         from configure script if specified.  If not native and no sysroot,
2637         only search TOOLLIBDIR.
2638         * options.h (Search_directory::Search_directory): Change name to
2639         const std::string&.
2640         (General_options::add_to_library_path_with_sysroot): Change arg to
2641         const std::string&.
2642         * configure, Makefile.in, config.in: Rebuild.
2643
2644 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2645
2646         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2647         we are working around the ARM1176 Erratum.
2648         * options.h (General_options::fix_arm1176): Add option.
2649         * testsuite/Makefile.am: Add testcases, and keep current ones
2650         working.
2651         * testsuite/Makefile.in: Regenerate.
2652         * testsuite/arm_fix_1176.s: New file.
2653         * testsuite/arm_fix_1176.sh: Likewise.
2654
2655 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2656
2657         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2658         may_use_blx_.
2659         (Target_arm::may_use_blx): Remove method.
2660         (Target_arm::set_may_use_blx): Likewise.
2661         (Target_arm::may_use_v4t_interworking): New method.
2662         (Target_arm::may_use_v5t_interworking): Likewise.
2663         (Target_arm::may_use_blx_): Remove member variable.
2664         (Arm_relocate_functions::arm_branch_common): Check for v5T
2665         interworking.
2666         (Arm_relocate_functions::thumb_branch_common): Likewise.
2667         (Reloc_stub::stub_type_for_reloc): Likewise.
2668         (Target_arm::do_finalize_sections): Correct interworking checks.
2669         * testsuite/Makefile.am: Add new tests.
2670         * testsuite/Makefile.in: Regenerate.
2671         * testsuite/arm_farcall_arm_arm.s: New test.
2672         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2673         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2674         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2675         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2676         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2677         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2678         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2679
2680 2011-10-31  Cary Coutant  <ccoutant@google.com>
2681
2682         PR gold/13023
2683         * expression.cc (Expression::eval_with_dot): Add
2684         is_section_dot_assignment parameter.
2685         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2686         absolute and assigning to dot within a section.
2687         * script-sections.cc
2688         (Output_section_element_assignment::set_section_addresses): Pass
2689         dot_section to set_if_absolute.
2690         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2691         as is_section_dot_assignment flag to eval_with_dot.
2692         (Output_section_element_dot_assignment::set_section_addresses):
2693         Likewise.
2694         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2695         parameter.  Also set value if relative to dot_section; set the
2696         symbol's output_section.
2697         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2698         parameter.  Adjust all callers.
2699         (Expression::eval_maybe_dot): Likewise.
2700         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2701         Adjust all callers.
2702         * testsuite/script_test_2.t: Test assignment of an absolute value
2703         to dot within an output section element.
2704
2705 2011-10-31  Cary Coutant  <ccoutant@google.com>
2706
2707         * options.h (class General_options): Add --[no-]gnu-unique options.
2708         * symtab.cc (Symbol_table::sized_write_globals): Convert
2709         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2710
2711 2011-10-31  Cary Coutant  <ccoutant@google.com>
2712
2713         PR gold/13359
2714         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2715         unnecessary assertion.
2716         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2717
2718 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2719
2720         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2721         gc_mark_symbol.
2722         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2723         gc_mark_symbol.
2724         Change to just keep the section associated with symbol.
2725         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2726         they are externally visible and --export-dynamic is turned on.
2727         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2728
2729 2011-10-19  Ian Lance Taylor  <iant@google.com>
2730
2731         PR gold/13163
2732         * script-sections.cc
2733         (Output_section_element_dot_assignment::needs_output_section): New
2734         function.
2735
2736 2011-10-19  Ian Lance Taylor  <iant@google.com>
2737
2738         PR gold/13204
2739         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2740         --section-start option was seen.
2741         * options.h (General_options::any_section_start): New function.
2742
2743 2011-10-18  David S. Miller  <davem@davemloft.net>
2744
2745         PR binutils/13301
2746         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2747         member to track relocation locations that have moved during TLS
2748         reloc optimizations.
2749         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2750         (Target_sparc::Relocate::relocate): Adjust view down by 4
2751         bytes if it matches reloc_adjust_addr_.
2752         (Target_sparc::Relocate::relocate_tls): Always move the
2753         __tls_get_addr call delay slot instruction forward 4 bytes when
2754         performing relaxation.
2755
2756 2011-10-18  Cary Coutant  <ccoutant@google.com>
2757
2758         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2759         (Output_file::map_no_anonymous): Check for non-zero
2760         return code from posix_fallocate.
2761
2762 2011-10-17  Cary Coutant  <ccoutant@google.com>
2763
2764         PR gold/13245
2765         * plugin.cc (is_visible_from_outside): Check for symbols
2766         referenced from dynamic objects.
2767         * resolve.cc (Symbol_table::resolve): Don't count references
2768         from dynamic objects as references from real ELF files.
2769         * testsuite/plugin_test_2.sh: Adjust expected result.
2770
2771 2011-10-17  Cary Coutant  <ccoutant@google.com>
2772
2773         * gold.cc: Include timer.h.
2774         (queue_middle_tasks): Stamp time.
2775         (queue_final_tasks): Likewise.
2776         * main.cc (main): Store timer in parameters.  Print timers
2777         for each pass.
2778         * parameters.cc (Parameters::Parameters): Initialize timer_.
2779         (Parameters::set_timer): New function.
2780         (set_parameters_timer): New function.
2781         * parameters.h (Parameters::set_timer): New function.
2782         (Parameters::timer): New function.
2783         (Parameters::timer_): New data member.
2784         (set_parameters_timer): New function.
2785         * timer.cc (Timer::stamp): New function.
2786         (Timer::get_pass_time): New function.
2787         * timer.h (Timer::stamp): New function.
2788         (Timer::get_pass_time): New function.
2789         (Timer::pass_times_): New data member.
2790
2791 2011-10-17  Cary Coutant  <ccoutant@google.com>
2792
2793         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2794         task for members of lib groups.
2795
2796 2011-10-17  Cary Coutant  <ccoutant@google.com>
2797
2798         PR gold/13288
2799         * fileread.cc (File_read::find_view): Add assert.
2800         (File_read::make_view): Move bounds check (replace with assert)...
2801         (File_read::find_or_make_view): ... to here.
2802
2803 2011-10-12  Cary Coutant  <ccoutant@google.com>
2804
2805         * output.cc (Output_file::open_base_file): Handle case where
2806         ::read returns less than requested size.
2807
2808 2011-10-10  Cary Coutant  <ccoutant@google.com>
2809
2810         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2811         Initialize defined_count_.
2812         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2813         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2814         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2815         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2816         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2817         * incremental.h (Sized_relobj_incr::defined_count_): New data
2818         member.
2819         (Sized_incr_dynobj::defined_count_): New data member.
2820         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2821         Return zeroes instead of internal error.
2822
2823 2011-10-10  Cary Coutant  <ccoutant@google.com>
2824
2825         PR gold/13249
2826         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2827         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2828         * output.h (class Output_reloc): Add use_plt_offset flag.
2829         (Output_reloc::type_): Adjust size of bit field.
2830         (Output_reloc::use_plt_offset_): New bit field.
2831         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2832         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2833         flag.  Adjust all callers.
2834         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2835         creating RELATIVE relocations.
2836
2837 2011-10-10  Nick Clifton  <nickc@redhat.com>
2838
2839         * po/es.po: Updated Spanish translation.
2840         * po/fi.po: Updated Finnish translation.
2841
2842 2011-10-03   Diego Novillo  <dnovillo@google.com>
2843
2844         * options.cc (parse_uint): Fix dereference of RETVAL.
2845
2846 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2847
2848         * layout.h (section_order_map_): New member.
2849         (get_section_order_map): New member function.
2850         * output.cc (Output_section::add_input_section): Check for patterns
2851         only when --section-ordering-file is specified.
2852         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2853         output_sections have been formed.
2854         * layout.cc (Layout_Layout): Initialize section_order_map_.
2855         * plugin.cc (update_section_order): Store order in order_map. Do not
2856         update the order.
2857         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2858         * testsuite/Makefile.in: Regenerate.
2859         * testsuite/plugin_section_order.c: New file.
2860         * testsuite/plugin_final_layout.cc: New file.
2861         * testsuite/plugin_final_layout.sh: New file.
2862
2863 2011-09-29  Cary Coutant  <ccoutant@google.com>
2864
2865         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2866         Check for NULL.
2867         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2868         symbols during incremental update.
2869         (Symbol_table::add_from_dynobj): Likewise.
2870
2871 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2872             Ian Lance Taylor  <iant@google.com>
2873
2874         * symtab.cc (Symbol_table::define_special_symbol): Always
2875         canonicalize version string.
2876
2877 2011-09-26  Cary Coutant  <ccoutant@google.com>
2878
2879         * gold.cc (queue_initial_tasks): Move option checks ...
2880         * options.cc (General_options::finalize): ... to here. Disable
2881         some options; make others fatal.
2882
2883 2011-09-26  Cary Coutant  <ccoutant@google.com>
2884
2885         gcc PR lto/47247
2886         * plugin.cc (get_symbols_v2): New function.
2887         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2888         (is_referenced_from_outside): New function.
2889         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2890         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2891         (get_symbols): Pass version parameter.
2892         (get_symbols_v2): New function.
2893         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2894         parameter.
2895         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2896         (onload): Add LDPT_GET_SYMBOLS_V2.
2897         (all_symbols_read_hook): Use get_symbols_v2; check for
2898         LDPR_PREVAILING_DEF_IRONLY_EXP.
2899         * testsuite/plugin_test_3.sh: Update expected results.
2900
2901 2011-09-23  Simon Baldwin  <simonb@google.com>
2902
2903         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2904         configuration options.
2905         * configure: Regenerate.
2906         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2907         * Makefile.in: Regenerate.
2908         * testsuite/Makefile.in: Regenerate.
2909
2910 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2911
2912         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2913
2914 2011-09-19  Cary Coutant  <ccoutant@google.com>
2915
2916         * incremental.cc (can_incremental_update): Fix typo in comment.
2917         * incremental.h (can_incremental_update): Likewise.
2918
2919 2011-09-18  Cary Coutant  <ccoutant@google.com>
2920
2921         * incremental.cc (can_incremental_update): New function.
2922         * incremental.h (can_incremental_update): New function.
2923         * layout.cc (Layout::init_fixed_output_section): Call it.
2924         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2925         * object.cc (Sized_relobj_file::do_layout): Call
2926         can_incremental_update.
2927
2928 2011-09-13  Cary Coutant  <ccoutant@google.com>
2929
2930         * configure.ac: Check for glibc support for gnu_indirect_function
2931         support with static linking, setting automake conditional
2932         IFUNC_STATIC.
2933         * Makefile.in: Regenerate.
2934         * configure: Regenerate.
2935
2936         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2937         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2938         for IFUNC_STATIC.
2939         * testsuite/Makefile.in: Regenerate.
2940
2941 2011-09-13  Cary Coutant  <ccoutant@google.com>
2942
2943         * incremental.cc (Sized_relobj_incr::do_layout): Call
2944         report_comdat_group for kept comdat sections.
2945         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2946         * testsuite/Makefile.in: Regenerate.
2947         * testsuite/incr_comdat_test_1.cc: New source file.
2948         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2949         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2950         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2951
2952 2011-09-13  Ian Lance Taylor  <iant@google.com>
2953
2954         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2955         variable external_symbols_offset.
2956
2957 2011-09-12  Ian Lance Taylor  <iant@google.com>
2958
2959         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2960         triggered if object has no symbols.
2961
2962 2011-09-09  David S. Miller  <davem@davemloft.net>
2963
2964         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2965         (Output_fill_debug_line::do_write): Likewise.
2966
2967 2011-08-29  Cary Coutant  <ccoutant@google.com>
2968
2969         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2970         casts to match formatting specs.
2971         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2972
2973 2011-08-26  Cary Coutant  <ccoutant@google.com>
2974
2975         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2976         remaining hole size when allocating.
2977         (Layout::make_output_section): Set fill methods for debug sections.
2978         * layout.h (Free_list::Free_list_node): Move from private to
2979         public.
2980         (Free_list::set_min_hole_size): New function.
2981         (Free_list::begin, Free_list::end): New functions.
2982         (Free_list::min_hole_): New data member.
2983         * output.cc: Include dwarf.h.
2984         (Output_fill_debug_info::do_minimum_hole_size): New function.
2985         (Output_fill_debug_info::do_write): New function.
2986         (Output_fill_debug_line::do_minimum_hole_size): New function.
2987         (Output_fill_debug_line::do_write): New function.
2988         (Output_section::Output_section): Initialize new data member.
2989         (Output_section::set_final_data_size): Ensure patch space is larger
2990         than minimum hole size.
2991         (Output_section::do_write): Fill holes in debug sections.
2992         * output.h (Output_fill): New class.
2993         (Output_fill_debug_info): New class.
2994         (Output_fill_debug_line): New class.
2995         (Output_section::set_free_space_fill): New function.
2996         (Output_section::free_space_fill_): New data member.
2997         * testsuite/Makefile.am (incremental_test_3): Add
2998         --incremental-patch option.
2999         (incremental_test_4): Likewise.
3000         (incremental_test_5): Likewise.
3001         (incremental_test_6): Likewise.
3002         (incremental_copy_test): Likewise.
3003         (incremental_common_test_1): Likewise.
3004         * testsuite/Makefile.in: Regenerate.
3005
3006 2011-08-26  Nick Clifton  <nickc@redhat.com>
3007
3008         * po/es.po: Updated Spanish translation.
3009
3010 2011-08-01  Cary Coutant  <ccoutant@google.com>
3011
3012         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3013         * gold/testsuite/Makefile.in: Regenerate.
3014         * gold/testsuite/justsyms_exec.c: New source file.
3015         * gold/testsuite/justsyms_lib.c: New source file.
3016
3017 2011-08-01  Cary Coutant  <ccoutant@google.com>
3018
3019         * layout.cc (Layout::set_segment_offsets): Don't realign text
3020         segment if -Ttext was specified.
3021         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3022         file type.
3023         * object.h (Sized_relobj_file::e_type): New function.
3024         (Sized_relobj_file::e_type_): New data member.
3025         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3026         base address for ET_EXEC files.
3027         * target.cc (Target::do_make_elf_object_implementation): Allow
3028         ET_EXEC files with --just-symbols option.
3029
3030 2011-07-28  Cary Coutant  <ccoutant@google.com>
3031
3032         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3033         Add thread_number parameter.
3034         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3035         * workqueue-threads.cc
3036         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3037         current thread if its thread number is greater than desired thread
3038         count.
3039         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3040         Add thread_number parameter.
3041         (Workqueue::should_cancel_thread): Likewise.
3042         (Workqueue::find_runnable_or_wait): Pass thread_number to
3043         should_cancel_thread.
3044         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3045         parameter.
3046
3047 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3048
3049         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3050         only after checking if it cannot be forced local.
3051         * symtab.h (is_externally_visible): Check if the symbol is not forced
3052         local.
3053
3054 2011-07-15  Ian Lance Taylor  <iant@google.com>
3055
3056         * options.h (class General_options): Add --print-output-format.
3057         Move -EL next to -EB, for  better --help output.
3058         * target-select.cc: Include <cstdio>, "options.h", and
3059         "parameters.h".
3060         (Target_selector::do_target_bfd_name): New function.
3061         (print_output_format): New function.
3062         * target-select.h (class Target_selector): Update declarations.
3063         (Target_selector::target_bfd_name): New function.
3064         (print_output_format): Declare.
3065         * main.cc: Include "target-select.h".
3066         (main): Handle --print-output-format.
3067         * gold.cc: Include "target-select.h".
3068         (queue_initial_tasks): Handle --print-output-format when there are
3069         no input files.
3070         * parameters.cc (parameters_force_valid_target): Give a better
3071         error message if -EB/-EL does not match target.
3072         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3073         function.
3074
3075 2011-07-15  Ian Lance Taylor  <iant@google.com>
3076
3077         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3078         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3079         (Output_data_plt_i386::do_write): Write address of .dynamic
3080         section to first entry in .got.plt section.
3081         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3082         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3083         Initialize layout_.
3084         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3085         section to first entry in .got.plt section.
3086         * layout.h (Layout::dynamic_section): New function.
3087
3088 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3089
3090         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3091         to claim_file call.
3092         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3093         input_section_position_, and input_section_glob_.
3094         (read_layout_from_file): Call function section_ordering_specified.
3095         * layout.h (is_section_ordering_specified): New function.
3096         (section_ordering_specified): New function.
3097         (section_ordering_specified_): New boolean member.
3098         * main.cc(main): Call load_plugins after layout object is defined.
3099         * output.cc (Output_section::add_input_section): Use
3100         function section_ordering_specified to check if section ordering is
3101         needed.
3102         * output.cc (Output_section::add_relaxed_input_section): Use
3103         function section_ordering_specified to check if section ordering is
3104         needed.
3105         (Output_section::update_section_layout): New function.
3106         (Output_section::sort_attached_input_sections): Check if input section
3107         must be reordered.
3108         * output.h (Output_section::update_section_layout): New function.
3109         * plugin.cc (get_section_count): New function.
3110         (get_section_type): New function.
3111         (get_section_name): New function.
3112         (get_section_contents): New function.
3113         (update_section_order): New function.
3114         (allow_section_ordering): New function.
3115         (Plugin::load): Add the new interfaces to the transfer vector.
3116         (Plugin_manager::load_plugins): New parameter.
3117         (Plugin_manager::all_symbols_read): New parameter.
3118         (Plugin_manager::claim_file): New parameter. Save the elf object for
3119         unclaimed objects.
3120         (Plugin_manager::get_elf_object): New function.
3121         (Plugin_manager::get_view): Change to directly use the bool to check
3122         if get_view is called from claim_file_hook.
3123         * plugin.h (input_objects): New function
3124         (Plugin__manager::load_plugins): New parameter.
3125         (Plugin_manager::claim_file): New parameter.
3126         (Plugin_manager::get_elf_object): New function.
3127         (Plugin_manager::in_claim_file_handler): New function.
3128         (Plugin_manager::in_claim_file_handler_): New member.
3129         (layout): New function.
3130         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3131         handler with an extra parameter. Make the elf object before calling
3132         claim_file handler.
3133         * testsuite/plugin_test.c (get_section_count): New function pointer.
3134         (get_section_type): New function pointer.
3135         (get_section_name): New function pointer.
3136         (get_section_contents): New function pointer.
3137         (update_section_order): New function pointer.
3138         (allow_section_ordering): New function pointer.
3139         (onload): Check if the new interfaces exist.
3140
3141 2011-07-13  Ian Lance Taylor  <iant@google.com>
3142
3143         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3144         relro section.
3145         * x86_64.cc (Target_x86_64::got_section): Likewise.
3146         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3147         (relro_now_test_SOURCES): New variable.
3148         (relro_now_test_DEPENDENCIES): New variable.
3149         (relro_now_test_LDFLAGS): New variable.
3150         (relro_now_test_LDADD): New variable.
3151         (relro_now_test.so): New target.
3152         * testsuite/Makefile.in: Rebuild.
3153
3154 2011-07-12  Ian Lance Taylor  <iant@google.com>
3155
3156         PR gold/12980
3157         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3158         GLOB_DAT relocation rather than a RELATIVE relocation for a
3159         protected symbol when creating a shared library.
3160         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3161         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3162         * testsuite/protected_main_1.cc (main): Test that protected
3163         function has same address.
3164
3165 2011-07-11  Ian Lance Taylor  <iant@google.com>
3166
3167         PR gold/12979
3168         * options.h (class General_options): Add -Bgroup.
3169         * options.cc (General_options::finalize): If -Bgroup is set,
3170         default to --unresolved-symbols=report-all.
3171         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3172         * target-reloc.h (issue_undefined_symbol_error): Handle
3173         --unresolved-symbols=report-all.
3174
3175 2011-07-08  Ian Lance Taylor  <iant@google.com>
3176
3177         PR gold/11985
3178         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3179         if linker script discards key sections.
3180         (Layout::create_dynamic_symtab): Likewise.
3181         (Layout::assign_local_dynsym_offsets): Likewise.
3182         (Layout::sized_create_version_sections): Likewise.
3183         (Layout::create_interp): Likewise.
3184         (Layout::finish_dynamic_section): Likewise.
3185         (Layout::set_dynamic_symbol_size): Likewise.
3186
3187 2011-07-08  Ian Lance Taylor  <iant@google.com>
3188
3189         PR gold/12386
3190         * options.h (class General_options): Add --unresolved-symbols.
3191         * target-reloc.h (issue_undefined_symbol_error): Check
3192         --unresolved-symbols.  Add comments.
3193
3194 2011-07-08  Ian Lance Taylor  <iant@google.com>
3195
3196         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3197         expression more complex.
3198
3199 2011-07-08  Ian Lance Taylor  <iant@google.com>
3200
3201         PR gold/11317
3202         * target-reloc.h (issue_undefined_symbol_error): New inline
3203         function, broken out of relocate_section.
3204         (relocate_section): Call issue_undefined_symbol_error.
3205         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3206         there is no TLS segment if we are about to issue an undefined
3207         symbol error.
3208         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3209
3210 2011-07-08  Ian Lance Taylor  <iant@google.com>
3211
3212         PR gold/12279
3213         * resolve.cc (Symbol_table::should_override): Add fromtype
3214         parameter.  Change all callers.  Give error when linking together
3215         TLS and non-TLS symbol.
3216         (Symbol_table::should_override_with_special): Add fromtype
3217         parameter.  Change all callers.
3218         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3219         there is no TLS segment if we have reported some errors.
3220         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3221
3222 2011-07-08  Ian Lance Taylor  <iant@google.com>
3223
3224         PR gold/12372
3225         * target.h (Target::plt_address_for_global): New function.
3226         (Target::plt_address_for_local): New function.
3227         (Target::plt_section_for_global): Remove.
3228         (Target::plt_section_for_local): Remove.
3229         (Target::do_plt_address_for_global): New virtual function.
3230         (Target::do_plt_address_for_local): New virtual function.
3231         (Target::do_plt_section_for_global): Remove.
3232         (Target::do_plt_section_for_local): Remove.
3233         (Target::register_global_plt_entry): Add Symbol_table and Layout
3234         parameters.
3235         * output.cc (Output_data_got::Got_entry::write): Use
3236         plt_address_for_global and plt_address_for_local.
3237         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3238         address of output section.
3239         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3240         got_irelative_, and irelative_count_ fields.  Update
3241         declarations.
3242         (Output_data_plt_i386::has_irelative_section): New function.
3243         (Output_data_plt_i386::entry_count): Add irelative_count_.
3244         (Output_data_plt_i386::set_final_data_size): Likewise.
3245         (class Target_i386): Add got_irelative_ and rel_irelative_
3246         fields.  Update declarations.
3247         (Target_i386::Target_i386): Initialize new fields.
3248         (Target_i386::do_plt_address_for_global): New function replacing
3249         do_plt_section_for_global.
3250         (Target_i386::do_plt_address_for_local): New function replacing
3251         do_plt_section_for_local.
3252         (Target_i386::got_section): Create got_irelative_.
3253         (Target_i386::rel_irelative_section): New function.
3254         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3255         fields.  Don't define __rel_iplt_{start,end}.
3256         (Output_data_plt_i386::add_entry): Add symtab and layout
3257         parameters.  Change all callers.  Use different PLT and GOT for
3258         IFUNC symbols.
3259         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3260         layout parameters.  Change all callers.  Use different PLT and
3261         GOT.
3262         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3263         (Output_data_plt_i386::rel_irelative): New function.
3264         (Output_data_plt_i386::address_for_global): New function.
3265         (Output_data_plt_i386::address_for_local): New function.
3266         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3267         IRELATIVE GOT when changing IFUNC GOT entries.
3268         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3269         reloc.
3270         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3271         if we didn't create an IRELATIVE GOT.
3272         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3273         plt_address_for_local.
3274         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3275         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3276         got_irelative_, and irelative_count_ fields.  Update
3277         declarations.
3278         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3279         Initialize new fields.  Remove symtab parameter.  Change all
3280         callers.
3281         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3282         irelative_count_.
3283         (Output_data_plt_x86_64::has_irelative_section): New function.
3284         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3285         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3286         fields.  Update declarations.
3287         (Target_x86_64::Target_x86_64): Initialize new fields.
3288         (Target_x86_64::do_plt_address_for_global): New function replacing
3289         do_plt_section_for_global.
3290         (Target_x86_64::do_plt_address_for_local): New function replacing
3291         do_plt_section_for_local.
3292         (Target_x86_64::got_section): Create got_irelative_.
3293         (Target_x86_64::rela_irelative_section): New function.
3294         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3295         all callers.  Don't create __rel_iplt_{start,end}.
3296         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3297         parameters.  Change all callers.  Use different PLT and GOT for
3298         IFUNC symbols.
3299         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3300         layout parameters.  Change all callers.  Use different PLT and
3301         GOT.
3302         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3303         parameters.  Change all callers.  Use different PLT and GOT for
3304         IFUNC symbols.
3305         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3306         (Output_data_plt_x86_64::rela_irelative): New function.
3307         (Output_data_plt_x86_64::address_for_global): New function.
3308         (Output_data_plt_x86_64::address_for_local): New function.
3309         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3310         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3311         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3312         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3313         parameters.
3314         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3315         reloc.
3316         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3317         symbols if we didn't create an IRELATIVE GOT.
3318         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3319         plt_address_for_local.
3320         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3321         * testsuite/ifuncvar1.c: New test file.
3322         * testsuite/ifuncvar2.c: New test file.
3323         * testsuite/ifuncvar3.c: New test file.
3324         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3325         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3326         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3327         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3328         * testsuite/Makefile.in: Rebuild.
3329
3330 2011-07-07  Cary Coutant  <ccoutant@google.com>
3331
3332         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3333         (two_file_test_1_ndebug.o): Likewise.
3334         (two_file_test_1b_ndebug.o): Likewise.
3335         (two_file_test_2_ndebug.o): Likewise.
3336         (two_file_test_main_ndebug.o): Likewise.
3337         (incremental_test_2): Link with no-debug versions.
3338
3339 2011-07-06  Cary Coutant  <ccoutant@google.com>
3340
3341         * gold/incremental.cc
3342         (Output_section_incremental_inputs::write_info_blocks): Check for
3343         hidden and internal symbols.
3344
3345 2011-07-06  Cary Coutant  <ccoutant@google.com>
3346
3347         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3348         Check disposition for startup file.
3349         (Incremental_inputs::report_command_line): Ignore
3350         --incremental-startup-unchanged option.
3351         * options.cc (General_options::parse_incremental_startup_unchanged):
3352         New function.
3353         (General_options::General_options): Initialize new data member.
3354         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3355         (General_options): Add --incremental-startup-unchanged option.
3356         (General_options::incremental_startup_disposition): New function.
3357         (General_options::incremental_startup_disposition_): New data member.
3358
3359 2011-07-06  Cary Coutant  <ccoutant@google.com>
3360
3361         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3362         input file index to Script_info ctor.
3363         (Sized_incremental_binary::do_file_has_changed): Find the
3364         command-line argument for files named in scripts.
3365         * incremental.h (Script_info::Script_info): New ctor
3366         with input file index.
3367         (Script_info::input_file_index): New function.
3368         (Script_info::input_file_index_): New data member.
3369         (Incremental_binary::get_library): Add const.
3370         (Incremental_binary::get_script_info): Add const.
3371         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3372         * testsuite/Makefile.am (incremental_test_5): New test case.
3373         (incremental_test_6): New test case.
3374         * testsuite/Makefile.in: Regenerate.
3375
3376 2011-07-06  Cary Coutant  <ccoutant@google.com>
3377
3378         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3379         debug output when command lines differ.
3380
3381 2011-07-06  Cary Coutant  <ccoutant@google.com>
3382
3383         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3384         --incremental-patch option.
3385         * layout.cc (Free_list::allocate): Extend allocation beyond original
3386         end if enabled.
3387         (Layout::make_output_section): Mark sections that should get
3388         patch space.
3389         * options.cc (parse_percent): New function.
3390         * options.h (parse_percent): New function.
3391         (DEFINE_percent): New macro.
3392         (General_options): Add --incremental-patch option.
3393         * output.cc (Output_section::Output_section): Initialize new data
3394         members.
3395         (Output_section::add_input_section): Print section name when out
3396         of patch space.
3397         (Output_section::add_output_section_data): Likewise.
3398         (Output_section::set_final_data_size): Add patch space when
3399         doing --incremental-full.
3400         (Output_section::do_reset_address_and_file_offset): Remove patch
3401         space.
3402         (Output_segment::set_section_list_addresses): Print debug output
3403         only if --incremental-update.
3404         * output.h (Output_section::set_is_patch_space_allowed): New function.
3405         (Output_section::is_patch_space_allowed_): New data member.
3406         (Output_section::patch_space_): New data member.
3407         * parameters.cc (Parameters::incremental_full): New function.
3408         * parameters.h (Parameters::incremental_full): New function
3409         * testsuite/Makefile.am (incremental_test_2): Add test for
3410         --incremental-patch option.
3411         * testsuite/Makefile.in: Regenerate.
3412         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3413         (t18): Remove function body.
3414
3415 2011-07-05  Doug Kwan  <dougkwan@google.com>
3416
3417         PR gold/12771
3418         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3419         Arm_Address type for relocation result.
3420         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3421         overflow check.
3422         (Arm_relocate_functions::abs32): Use unaligned access.
3423         (Arm_relocate_functions::rel32): Ditto.
3424         (Arm_relocate_functions::prel31): Ditto.
3425         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3426         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3427         static data relocations.
3428         * testsuite/Makefile.in: Regnerate.
3429         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3430
3431 2011-07-05  Ian Lance Taylor  <iant@google.com>
3432
3433         PR gold/12392
3434         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3435         symbols if necessary.
3436         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3437
3438 2011-07-05  Ian Lance Taylor  <iant@google.com>
3439
3440         PR gold/12952
3441         * resolve.cc (Symbol::override_base_with_special): Simply override
3442         version with special symbol version, ignoring previous version.
3443
3444 2011-07-05  Ian Lance Taylor  <iant@google.com>
3445
3446         * object.cc (Sized_relobj_file::include_section_group): Add
3447         information to comment about signature location.
3448
3449 2011-07-02  Ian Lance Taylor  <iant@google.com>
3450
3451         PR gold/12957
3452         * options.h (class General_options): Add -f and -F.
3453         * options.cc (General_options::finalize): Fatal error if -f/-F
3454         are used without -shared.
3455         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3456
3457 2011-07-02  Ian Lance Taylor  <iant@google.com>
3458
3459         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3460
3461 2011-07-01  Ian Lance Taylor  <iant@google.com>
3462
3463         PR gold/12525
3464         PR gold/12952
3465         * resolve.cc (Symbol::override_base_with_special): Don't override
3466         the version if the overriding symbol has a different name.
3467         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3468         all callers.  If we give an error about an undefined version,
3469         define the base version if necessary.
3470         * dynobj.h (class Versions): Update declaration.
3471         * testsuite/weak_alias_test_5.cc: New file.
3472         * testsuite/weak_alias_test.script: New file.
3473         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3474         and versioned_alias have the right value, and call t2.
3475         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3476         weak_alias_test_5.so.
3477         (weak_alias_test_LDADD): Likewise.
3478         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3479         * testsuite/Makefile.in: Rebuild.
3480
3481 2011-07-01  Ian Lance Taylor  <iant@google.com>
3482
3483         PR gold/12525
3484         * options.h (class General_options): Support -z notext.
3485         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3486         -Wl,-z,notext.
3487         (two_file_shared_nonpic.so): Likewise.
3488         (two_file_shared_mixed.so): Likewise.
3489         (two_file_shared_mixed_1.so): Likewise.
3490         (weak_undef_lib_nonpic.so): Likewise.
3491         (alt/weak_undef_lib_nonpic.so): Likewise.
3492         (tls_test_shared_nonpic.so): Likewise.
3493         * testsuite/Makefile.in: Rebuild.
3494
3495 2011-07-01  Ian Lance Taylor  <iant@google.com>
3496
3497         PR gold/12525
3498         * configure.ac: Test whether static linking works, setting
3499         the automake conditional HAVE_STATIC.
3500         * testsuite/Makefile.am: Disable tests using -static if
3501         HAVE_STATIC is not true.
3502         * configure, testsuite/Makefile.in: Rebuild.
3503
3504 2011-07-01  Ian Lance Taylor  <iant@google.com>
3505
3506         PR gold/12525
3507         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3508         Assert if we see DW_EH_PE_indirect.
3509         * target.h (Target::ehframe_datarel_base): New function.
3510         (Target::do_ehframe_datarel_base): New target function.
3511         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3512         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3513         function.
3514
3515 2011-07-01  Ian Lance Taylor  <iant@google.com>
3516
3517         PR gold/12571
3518         * options.h (class General_options): Add
3519         --ld-generated-unwind-info.
3520         * ehframe.cc (Fde::write): Add address parameter.  Change all
3521         callers.  If associated with PLT, fill in address and size.
3522         (Cie::set_output_offset): Only add merge mapping if there is an
3523         object.
3524         (Cie::write): Add address parameter.  Change all callers.
3525         (Eh_frame::add_ehframe_for_plt): New function.
3526         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3527         input_offset_ fields into union u_, with new plt field.
3528         (Fde::Fde): Adjust for new union field.
3529         (Fde::Fde) [Output_data version]: New constructor.
3530         (Fde::add_mapping): Only add merge mapping if there is an object.
3531         (class Cie): Update declarations.
3532         (class Eh_frame): Declare add_ehframe_for_plt.
3533         * layout.cc (Layout::layout_eh_frame): Break out code into
3534         make_eh_frame_section, and call it.
3535         (Layout::make_eh_frame_section): New function.
3536         (Layout::add_eh_frame_for_plt): New function.
3537         * layout.h (class Layout): Update declarations.
3538         * merge.cc (Merge_map::add_mapping): Add assertion.
3539         * i386.cc: Include "dwarf.h".
3540         (class Output_data_plt_i386): Make first_plt_entry,
3541         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3542         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3543         and plt_eh_frame_fde.
3544         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3545         boundary.  Call add_eh_frame_for_plt if appropriate.
3546         * x86_64.cc: Include "dwarf.h".
3547         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3548         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3549         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3550         and plt_eh_frame_fde.
3551         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3552         appropriate.
3553
3554 2011-06-29  Ian Lance Taylor  <iant@google.com>
3555
3556         PR gold/12629
3557         * object.cc (Sized_relobj_file::layout_section): Change shdr
3558         parameter to be const.
3559         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3560         out of do_layout.
3561         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3562         appropriate.  Call layout_eh_frame_section.
3563         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3564         sections.
3565         * object.h (class Sized_relobj_file): Update declarations.
3566
3567 2011-06-29  Ian Lance Taylor  <iant@google.com>
3568
3569         PR gold/12652
3570         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3571         modifier.
3572         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3573
3574 2011-06-29  Ian Lance Taylor  <iant@google.com>
3575
3576         PR gold/12675
3577         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3578         SHT_X86_64_UNWIND.
3579         * layout.cc (Layout::layout_eh_frame): Likewise.
3580
3581 2011-06-29  Ian Lance Taylor  <iant@google.com>
3582
3583         PR gold/12695
3584         * layout.cc (Layout::symtab_section_shndx): New function.
3585         * layout.h (class Layout): Declare symtab_section_shndx.
3586         * output.cc (Output_section::write_header): Call it.
3587
3588 2011-06-29  Ian Lance Taylor  <iant@google.com>
3589
3590         PR gold/12818
3591         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3592         symbols which are not used in a relocation.
3593
3594 2011-06-28  Ian Lance Taylor  <iant@google.com>
3595
3596         PR gold/12898
3597         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3598         script create indistinguishable segments.
3599         (Layout::set_segment_offsets): Use stable_sort when sorting
3600         segments.  Pass this to Compare_segments constructor.
3601         * layout.h (class Layout): Make segment_precedes non-static.
3602         (class Compare_segments): Change from struct to class.  Add
3603         layout_ field.  Add constructor.
3604         * script-sections.cc
3605         (Script_sections::attach_sections_using_phdrs_clause): Rename
3606         local orphan to is_orphan.  Don't report failure to put empty
3607         section in segment.  On attachment failure, report name of
3608         section, and attach to first PT_LOAD segment.
3609
3610 2011-06-28  Ian Lance Taylor  <iant@google.com>
3611
3612         PR gold/12934
3613         * target-select.cc (Target_selector::Target_selector): Add
3614         emulation parameter.  Change all callers.
3615         (select_target_by_bfd_name): Rename from select_target_by_name.
3616         Change all callers.
3617         (select_target_by_emulation): New function.
3618         (supported_emulation_names): New function.
3619         * target-select.h (class Target_selector): Add emulation_ field.
3620         Update declarations.
3621         (Target_selector::recognize_by_bfd_name): Rename from
3622         recognize_by_name.  Change all callers.
3623         (Target_selector::supported_bfd_names): Rename from
3624         supported_names.  Change all callers.
3625         (Target_selector::recognize_by_emulation): New function.
3626         (Target_selector::supported_emulations): New function.
3627         (Target_selector::emulation): New function.
3628         (Target_selector::do_recognize_by_bfd_name): Rename from
3629         do_recognize_by_name.  Change all callers.
3630         (Target_selector::do_supported_bfd_names): Rename from
3631         do_supported_names.  Change all callers.
3632         (Target_selector::do_recognize_by_emulation): New function.
3633         (Target_selector::do_supported_emulations): New function.
3634         (select_target_by_bfd_name): Change name in declaration.
3635         (select_target_by_emulation): Declare.
3636         (supported_emulation_names): Declare.
3637         * parameters.cc (parameters_force_valid_target): Try to find
3638         target based on emulation from -m option.
3639         * options.h (class General_options): Change doc string for -m.
3640         * options.cc (help): Print emulations.
3641         (General_options::parse_V): Likewise.
3642         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3643         Add emulation parameter.  Change all callers.
3644
3645 2011-06-28  Ian Lance Taylor  <iant@google.com>
3646
3647         * target.h (class Target): Add osabi_ field.
3648         (Target::osabi): New function.
3649         (Target::set_osabi): New function.
3650         (Target::Target): Initialize osabi_.
3651         (Target::do_adjust_elf_header): Make pure virtual.
3652         (Sized_target::do_adjust_elf_header): Declare.
3653         * target.cc (Sized_target::do_adjust_elf_header): New function.
3654         (class Sized_target): Instantiate all versions.
3655         * freebsd.h (class Target_freebsd): Remove.
3656         (Target_selector_freebsd::do_recognize): Call set_osabi on
3657         Target.
3658         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3659         (Target_selector_freebsd::set_osabi): Remove.
3660         * i386.cc (class Target_i386): Inherit from Sized_target rather
3661         than Target_freebsd.
3662         * x86_64.cc (class Target_x86_64): Likewise.
3663
3664 2011-06-28  Ian Lance Taylor  <iant@google.com>
3665
3666         * target.h (Target::can_check_for_function_pointers): Rewrite.
3667         Make non-virtual.
3668         (Target::can_icf_inline_merge_sections): Likewise.
3669         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3670         (Target::Target_info): Add can_icf_inline_merge_sections field.
3671         (Target::do_can_check_for_function_pointers): New virtual
3672         function.
3673         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3674         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3675         from can_check_for_function_pointers, move in file.
3676         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3677         section_may_have_icf_unsafe_poineters, move in file.
3678         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3679         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3680         Rename from can_check_for_function_pointers, move in file.
3681         (Target_i386::can_icf_inline_merge_sections): Remove.
3682         (Target_i386::i386_info): Initialize
3683         can_icf_inline_merge_sections.
3684         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3685         Initialize can_icf_inline_merge_sections.
3686         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3687         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3688         Rename from can_check_for_function_pointers, move in file.
3689         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3690         (Target_x86_64::x86_64_info): Initialize
3691         can_icf_inline_merge_sections.
3692         * testsuite/testfile.cc (Target_test::test_target_info):
3693         Likewise.
3694         * icf.cc (get_section_contents): Correct formatting.
3695
3696 2011-06-27  Ian Lance Taylor  <iant@google.com>
3697
3698         * symtab.cc (Symbol::versioned_name): New function.
3699         (Symbol_table::add_to_final_symtab): Use versioned_name when
3700         appropriate.
3701         (Symbol_table::sized_write_symbol): Likewise.
3702         * symtab.h (class Symbol): Declare versioned_name.
3703         * stringpool.h (class Stringpool_template): Add variant of add
3704         which takes a std::basic_string.
3705         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3706         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3707         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3708         (ver_test_12.o): New target.
3709         * testsuite/Makefile.in: Rebuild.
3710
3711 2011-06-27  Doug Kwan  <dougkwan@google.com>
3712
3713         * arm.cc (Arm_relocate_functions::thm_jump8,
3714         Arm_relocate_functions::thm_jump11): Use a wider signed
3715         type to compute offset.
3716         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3717         arm_thm_jump8.
3718         * testsuite/Makefile.in: Regenerate.
3719         * testsuite/arm_branch_in_range.sh: Check test results of
3720         arm_thm_jump11 and arm_thm_jump8.
3721         * testsuite/arm_thm_jump11.s: New test source file.
3722         * testsuite/arm_thm_jump11.t: New linker script.
3723         * testsuite/arm_thm_jump8.s: New test source file.
3724         * testsuite/arm_thm_jump8.t: New linker script.
3725
3726 2011-06-24  Ian Lance Taylor  <iant@google.com>
3727
3728         * layout.cc: Include "object.h".
3729         (ctors_sections_in_init_array): New static variable.
3730         (Layout::is_ctors_in_init_array): New function.
3731         (Layout::layout): Add entry to ctors_sections_in_init_array if
3732         appropriate.
3733         * layout.h (class Layout): Declare is_ctors_in_init_array.
3734         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3735         is_ctors_reverse_view is set.
3736         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3737         all callers.  Set is_ctors_reverse_view field of View_size.
3738         (Sized_relobj_file::reverse_words): New function.
3739         * object.h (Sized_relobj_file::View_size): Add
3740         is_ctors_reverse_view field.
3741         (class Sized_relobj_file): Update declarations.
3742         * testsuite/initpri3.c: New test.
3743         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3744         initpri3b.
3745         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3746         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3747         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3748         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3749         * testsuite/Makefile.in: Rebuild.
3750
3751 2011-06-24  Cary Coutant  <ccoutant@google.com>
3752
3753         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3754         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3755         (debug_msg_cdebug.err): New targets.
3756         * testsuite/Makefile.in: Regenerate.
3757         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3758         Fix checks for link with shared library.
3759
3760 2011-06-24  Doug Kwan  <dougkwan@google.com>
3761
3762         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3763         skip empty text sections.
3764         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3765
3766 2011-06-22  Ian Lance Taylor  <iant@google.com>
3767
3768         PR gold/12910
3769         * options.h (class General_options): Add --ctors-in-init-array.
3770         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3771         friends as SHT_PROGBITS for merging sections.
3772         (Layout::layout): Remove special handling of .init_array and
3773         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3774         and .dtors if ctors_in_init_array.
3775         (Layout::make_output_section): Force correct section types for
3776         .init_array and friends.  Don't sort if doing relocatable link,
3777         Don't sort .ctors and .dtors if ctors_in_init_array.
3778         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3779         (Layout::output_section_name): Add relobj parameter.  Change all
3780         callers.  Handle .ctors. and .dtors. in code rather than table.
3781         Handle .ctors and .dtors if ctors_in_init_array.
3782         (Layout::match_file_name): New function, moved from output.cc.
3783         * layout.h (class Layout): Update declarations.
3784         * output.cc: Include "layout.h".
3785         (Input_section_sort_entry::get_priority): New function.
3786         (Input_section_sort_entry::match_file_name): Just call
3787         Layout::match_file_name.
3788         (Output_section::Input_section_sort_init_fini_compare::operator()):
3789         Handle .ctors and .dtors.  Sort by explicit priority rather than
3790         by name.
3791         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3792         * testsuite/initpri2.c: New test.
3793         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3794         (check_PROGRAMS): Add initpri2.
3795         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3796         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3797         * configure, testsuite/Makefile.in: Rebuild.
3798
3799 2011-06-19  Ian Lance Taylor  <iant@google.com>
3800
3801         PR gold/12880
3802         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3803         .interp section to a PT_INTERP segment even if we have seen a
3804         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3805         clause in a linker script.
3806         (Layout::finalize): Don't create a .interp section if we've
3807         already create a PT_INTERP segment.
3808         (Layout::create_interp): Always call choose_output_section (revert
3809         patch of 2011-06-17).  Don't create PT_INTERP segment.
3810         * script-sections.cc
3811         (Script_sections::create_note_and_tls_segments): Add a .interp
3812         section to a PT_INTERP segment even if we have seen a
3813         --dynamic-linker option.
3814
3815 2011-06-18  Ian Lance Taylor  <iant@google.com>
3816
3817         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3818         merely because a non-PT_LOAD segment has a dynamic reloc.
3819
3820 2011-06-18  Ian Lance Taylor  <iant@google.com>
3821
3822         * layout.cc (Layout::finish_dynamic_section): Don't create
3823         DT_FLAGS entry if not needed.
3824
3825 2011-06-18  Ian Lance Taylor  <iant@google.com>
3826
3827         PR gold/12745
3828         * layout.cc (Layout::layout_eh_frame): Correct handling of
3829         writable .eh_frame section.
3830
3831 2011-06-17  Ian Lance Taylor  <iant@google.com>
3832
3833         PR gold/12893
3834         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3835         symbol is redefined with the exact same object and value.
3836
3837 2011-06-17  Ian Lance Taylor  <iant@google.com>
3838
3839         PR gold/12880
3840         * layout.h (class Layout): Add interp_segment_ field.
3841         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3842         (Layout::attach_allocated_section_to_segment): If making shared
3843         library, put .interp section in PT_INTERP segment.
3844         (Layout::finalize): Also call create_interp if -dynamic-linker
3845         option was used.
3846         (Layout::create_interp): Assert that there is no PT_INTERP
3847         segment.  If not using a SECTIONS clause, use make_output_section.
3848         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3849         * script-sections.cc
3850         (Script_sections::create_note_and_tls_segments): If making shared
3851         library, put .interp section in PT_INTERP segment.
3852
3853 2011-06-17  Ian Lance Taylor  <iant@google.com>
3854
3855         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3856         when making a shared library.
3857
3858 2011-06-17  Ian Lance Taylor  <iant@google.com>
3859
3860         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3861         parameter.  Change all callers.  Don't issue warning about PC32
3862         against locally defined symbol.
3863
3864 2011-06-16  Ian Lance Taylor  <iant@google.com>
3865
3866         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3867         occurs in same object.
3868
3869 2011-06-14  Alan Modra  <amodra@gmail.com>
3870
3871         * po/POTFILES.in: Regenerate.
3872
3873 2011-06-09  Ian Lance Taylor  <iant@google.com>
3874
3875         * script-sections.cc
3876         (Orphan_output_section::set_section_addresses): For a relocatable
3877         link set address to 0.
3878
3879 2011-06-09  Cary Coutant  <ccoutant@google.com>
3880
3881         PR gold/12804
3882         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3883         used with --compress-debug-sections.
3884         * gold/object.cc (Sized_relobj_file::do_layout): Report
3885         uncompressed size of compressed input sections.
3886
3887 2011-06-08  Cary Coutant  <ccoutant@google.com>
3888
3889         PR gold/12804
3890         * testsuite/two_file_test_2_v1.cc: Change initialization of
3891         v2 to keep it in .data.
3892
3893 2011-06-07  Cary Coutant  <ccoutant@google.com>
3894
3895         * common.cc (Symbol_table::do_allocate_commons_list): Call
3896         gold_fallback.
3897         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3898         (Errors::fallback): New function.
3899         (gold_fallback): New function.
3900         * errors.h (Errors::fallback): New function.
3901         * gold.cc (gold_exit): Change status parameter to enum; adjust
3902         all callers.
3903         (queue_initial_tasks): Call gold_fallback.
3904         * gold.h: Include cstdlib.
3905         (Exit_status): New enum type.
3906         (gold_exit): Change status parameter to enum.
3907         (gold_fallback): New function.
3908         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3909         (Layout::create_symtab_sections): Likewise.
3910         (Layout::create_shdrs): Likewise.
3911         * main.cc (main): Adjust call to gold_exit.
3912         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3913         (Output_data_got::add_got_entry_pair): Likewise.
3914         (Output_section::add_input_section): Likewise.
3915         (Output_section::add_output_section_data): Likewise.
3916         (Output_segment::set_section_list_addresses): Likewise.
3917         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3918
3919 2011-06-07  Cary Coutant  <ccoutant@google.com>
3920
3921         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3922         for incremental links.
3923         * output.cc (Output_segment::set_section_list_addresses): Remove
3924         FIXME and test for TLS or BSS.
3925
3926 2011-06-07  Cary Coutant  <ccoutant@google.com>
3927
3928         * testsuite/Makefile.am: Add incremental_copy_test,
3929         incremental_common_test_1.
3930         * testsuite/Makefile.in: Regenerate.
3931         * testsuite/common_test_1_v1.c: New source file.
3932         * testsuite/common_test_1_v2.c: New source file.
3933         * testsuite/copy_test_v1.cc: New source file.
3934
3935 2011-06-07  Cary Coutant  <ccoutant@google.com>
3936
3937         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3938         update, allocate common from bss section's free list.
3939         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3940         linker-defined symbols.
3941         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3942         Skip GOT and PLT entries that are no longer referenced.
3943         (Output_section_incremental_inputs::write_info_blocks): Mark
3944         linker-defined symbols.
3945         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3946         * output.cc (Output_section::allocate): New function.
3947         * output.h (Output_section::allocate): New function.
3948         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3949         linker-defined symbols.
3950         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3951         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3952         (Symbol::init_base_output_data): Likewise.
3953         (Symbol::init_base_output_segment): Likewise.
3954         (Symbol::init_base_constant): Likewise.
3955         (Sized_symbol::init_output_data): Likewise.
3956         (Sized_symbol::init_output_segment): Likewise.
3957         (Sized_symbol::init_constant): Likewise.
3958         (Symbol_table::do_define_in_output_data): Likewise.
3959         (Symbol_table::do_define_in_output_segment): Likewise.
3960         (Symbol_table::do_define_as_constant): Likewise.
3961         * symtab.h (Symbol::is_predefined): New function.
3962         (Symbol::init_base_output_data): Add is_predefined parameter.
3963         (Symbol::init_base_output_segment): Likewise.
3964         (Symbol::init_base_constant): Likewise.
3965         (Symbol::is_predefined_): New data member.
3966         (Sized_symbol::init_output_data): Add is_predefined parameter.
3967         (Sized_symbol::init_output_segment): Likewise.
3968         (Sized_symbol::init_constant): Likewise.
3969         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3970
3971 2011-06-07  Cary Coutant  <ccoutant@google.com>
3972
3973         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3974         instead of emit_copy_reloc.
3975         (Copy_relocs::emit_copy_reloc): Refactor.
3976         (Copy_relocs::make_copy_reloc): New function.
3977         (Copy_relocs::add_copy_reloc): Remove.
3978         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3979         section.
3980         (Copy_relocs::make_copy_reloc): New function.
3981         (Copy_relocs::add_copy_reloc): Remove.
3982         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3983         unchanged input files.
3984         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3985         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3986         Reserve BSS space for COPY relocations.
3987         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3988         (Output_section_incremental_inputs::write_info_blocks): Record
3989         whether a symbol is copied from a shared object.
3990         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3991         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3992         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3993         (Incremental_input_entry_reader::get_output_symbol_index): Add
3994         is_copy parameter.
3995         (Incremental_binary::emit_copy_relocs): New function.
3996         (Incremental_binary::do_emit_copy_relocs): New function.
3997         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3998         new data member.
3999         (Sized_incremental_binary::add_copy_reloc): New function.
4000         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4001         (Sized_incremental_binary::Copy_reloc): New struct.
4002         (Sized_incremental_binary::Copy_relocs): New typedef.
4003         (Sized_incremental_binary::copy_relocs_): New data member.
4004         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4005         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4006         * target.h (Sized_target::emit_copy_reloc): New function.
4007         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4008
4009 2011-06-02  Cary Coutant  <ccoutant@google.com>
4010
4011         PR gold/12163
4012         * gold/archive.cc (Archive::Archive): Initialize new data member.
4013         (Archive::include_all_members): Return if archive has already been
4014         included.
4015         * gold/archive.h (Archive::include_all_members_): New data member.
4016
4017 2011-06-02  Nick Clifton  <nickc@redhat.com>
4018
4019         * dynobj.h: Fix spelling mistake in comment.
4020         * output.cc: Likewise.
4021
4022 2011-05-31  Doug Kwan  <dougkwan@google.com>
4023             Asier Llano
4024
4025         PR gold/12826
4026         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4027         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4028         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4029         redundant arm_exidx_test.so.
4030         * testsuite/Makefile.in: Regenerate.
4031         (check_SCRIPTS): Add pr12826.sh
4032         (check_DATA): Add pr12826.stdout
4033         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4034         * testsuite/pr12826.sh: New file.
4035         * testsuite/pr12826_1.s: Ditto.
4036         * testsuite/pr12826_1.s: Ditto.
4037
4038 2011-05-30  Ian Lance Taylor  <iant@google.com>
4039
4040         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4041         sections.
4042
4043 2011-05-29  Ian Lance Taylor  <iant@google.com>
4044
4045         PR gold/12804
4046         * testsuite/Makefile.am: Use different file name for two_file_test
4047         temporary file for each incremental test.
4048         * testsuite/Makefile.in: Rebuild.
4049
4050 2011-05-29  Ian Lance Taylor  <iant@google.com>
4051
4052         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4053         binary input file is empty.
4054
4055 2011-05-27  Ian Lance Taylor  <iant@google.com>
4056
4057         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4058         (ver_test_9.so): Likewise.
4059         * testsuite/Makefile.in: Rebuild.
4060
4061 2011-05-26 Cary Coutant  <ccoutant@google.com>
4062
4063         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4064         * incremental.cc (Incremental_inputs::report_input_section): Fix
4065         comment, indentation.
4066         (Incremental_inputs::report_comdat_group): New function.
4067         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4068         of data for incremental input file entry.
4069         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4070         group count, COMDAT group signatures.
4071         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4072         an unchanged input file.
4073         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4074         Initialize new data member.
4075         (Incremental_object_entry::add_comdat_group): New function.
4076         (Incremental_object_entry::get_comdat_group_count): New function.
4077         (Incremental_object_entry::get_comdat_signature_key): New function.
4078         (Incremental_object_entry::groups_): New data member.
4079         (Incremental_inputs::report_comdat_group): New function.
4080         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4081         data for incremental input file entry.
4082         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4083         (Incremental_input_entry_reader::get_input_section): Adjust size of
4084         data for incremental input file entry.
4085         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4086         (Incremental_input_entry_reader::get_comdat_group_signature): New
4087         function.
4088         * object.cc (Sized_relobj::include_section_group): Report kept
4089         COMDAT groups for incremental links.
4090
4091 2011-05-24  David Meyer  <pdox@google.com>
4092
4093         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4094         with name parameter.  Add found_name parameter.
4095         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4096         * dirsearch.h (class Dirsearch): Update declaration.
4097
4098 2011-05-24  Ian Lance Taylor  <iant@google.com>
4099
4100         * archive.cc (Library_base::should_include_member): Pull in object
4101         from archive if it defines the entry symbol.
4102         * parameters.cc (Parameters::entry): New function.
4103         * parameters.h (class Parameters): Declare entry.
4104         * output.h (class Output_file_header): Remove entry_ field.
4105         * output.cc (Output_file_header::Output_file_header): Remove entry
4106         parameter.  Change all callers.
4107         (Output_file_header::entry): Use parameters->entry.
4108         * gold.cc (queue_middle_tasks): Likewise.
4109         * plugin.cc (Plugin_hook::run): Likewise.
4110
4111 2011-05-24 Cary Coutant  <ccoutant@google.com>
4112
4113         * gold.cc (queue_initial_tasks): Pass incremental base filename
4114         to Output_file::open_base_file; don't print error message.
4115         * incremental-dump.cc (main): Adjust call to
4116         Output_file::open_for_modification.
4117         * incremental-dump.cc (main): Likewise.
4118         * incremental.cc (Incremental_inputs::report_command_line):
4119         Ignore --incremental-base option when comparing command lines.
4120         Ignore parameter when given as separate argument.
4121         * options.h (class General_options): Add --incremental-base.
4122         * output.cc (Output_file::Output_file):
4123         (Output_file::open_base_file): Add base_name and writable parameters;
4124         read base file into new file; print error message here.
4125         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4126         callers.
4127         * output.h (Output_file::open_for_modification): Rename to...
4128         (Output_file::open_base_file): ...this; add base_name and
4129         writable parameters; adjust all callers.
4130         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4131         callers.
4132         * testsuite/Makefile.am (incremental_test_4): Test
4133         --incremental-base.
4134         * testsuite/Makefile.in: Regenerate.
4135
4136 2011-05-24 Cary Coutant  <ccoutant@google.com>
4137
4138         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4139         incremental_test_4.
4140         * testsuite/Makefile.in: Regenerate.
4141         * testsuite/two_file_test_1_v1.cc: New test source file.
4142         * testsuite/two_file_test_1b_v1.cc: New test source file.
4143         * testsuite/two_file_test_2_v1.cc: New test source file.
4144
4145 2011-05-24 Cary Coutant  <ccoutant@google.com>
4146
4147         * dynobj.h (Dynobj::do_dynobj): New function.
4148         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4149         flag and soname for shared objects.
4150         * incremental.cc (Incremental_inputs::report_object): Make
4151         either Incremental_object_entry or Incremental_dynobj_entry; add
4152         soname to string table.
4153         (Incremental_inputs::report_input_section): Add assertion.
4154         (Output_section_incremental_inputs::set_final_data_size): Adjust
4155         type of input file entry for shared libraries; adjust size of
4156         shared library info entry.
4157         (Output_section_incremental_inputs::write_input_files): Write
4158         as_needed flag for shared libraries.
4159         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4160         of input file entry for shared libraries; write soname.
4161         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4162         soname from incremental info.
4163         * incremental.h (enum Incremental_input_flags): Add
4164         INCREMENTAL_INPUT_AS_NEEDED.
4165         (Incremental_input_entry::Incremental_input_entry): Initialize new
4166         data member.
4167         (Incremental_input_entry::set_as_needed): New function.
4168         (Incremental_input_entry::as_needed): New function.
4169         (Incremental_input_entry::do_dynobj_entry): New function.
4170         (Incremental_input_entry::as_needed_): New data member.
4171         (Incremental_object_entry::Incremental_object_entry): Don't check
4172         for shared library.
4173         (Incremental_object_entry::do_type): Likewise.
4174         (class Incremental_dynobj_entry): New class.
4175         (Incremental_input_entry_reader::as_needed): New function.
4176         (Incremental_input_entry_reader::get_soname): New function.
4177         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4178         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4179         size of shared library info entry.
4180         * layout.cc (Layout::finish_dynamic_section): Don't test for
4181         incremental link when adding DT_NEEDED entries.
4182         * object.h (Object::Object): Initialize new data member.
4183         (Object::dynobj): New function.
4184         (Object::set_as_needed): New function.
4185         (Object::as_needed): New function.
4186         (Object::do_dynobj): New function.
4187         (Object::as_needed_): New data member.
4188
4189 2011-05-24 Cary Coutant  <ccoutant@google.com>
4190
4191         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4192         info; adjust display of GOT entries.
4193         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4194         vector of input objects; remove file_status_.
4195         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4196         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4197         got_plt reader; call target hooks to reserve GOT entries.
4198         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4199         of input file info header and GOT info entry.
4200         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4201         relocation info.
4202         (Got_plt_view_info::got_descriptor): Remove.
4203         (Got_plt_view_info::sym_index): New data member.
4204         (Got_plt_view_info::input_index): New data member.
4205         (Local_got_offset_visitor::visit): Write input file index.
4206         (Global_got_offset_visitor::visit): Write 0 for input file index.
4207         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4208         with sym_index and input_index.
4209         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4210         incremental info GOT entry; replace got_descriptor with input_index.
4211         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4212         map from input file index to object.
4213         (Sized_relobj_incr::do_layout): Replace direct data member reference
4214         with accessor function.
4215         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4216         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4217         Adjust size of input file info header.
4218         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4219         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4220         (Incremental_input_entry_reader::get_input_section): Adjust size of
4221         input file info header.
4222         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4223         of incremental info GOT entry.
4224         (Incremental_got_plt_reader::get_got_desc): Remove.
4225         (Incremental_got_plt_reader::get_got_symndx): New function.
4226         (Incremental_got_plt_reader::get_got_input_index): New function.
4227         (Sized_incremental_binary::Sized_incremental_binary): Remove
4228         file_status_; add input_objects_.
4229         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4230         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4231         (Sized_incremental_binary::file_is_unchanged): Remove.
4232         (Sized_incremental_binary::set_input_object): New function.
4233         (Sized_incremental_binary::input_object): New function.
4234         (Sized_incremental_binary::file_status_): Remove.
4235         (Sized_incremental_binary::input_objects_): New data member.
4236         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4237         references.
4238         (Sized_relobj_incr::invalid_address): Move to base class.
4239         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4240         class.
4241         (Sized_relobj_incr::do_output_section_offset): Likewise.
4242         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4243         (Sized_relobj_incr::section_offsets_): Likewise.
4244         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4245         function.
4246         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4247         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4248         with accessor function.
4249         (Sized_relobj_file::do_layout): Likewise.
4250         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4251         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4252         (Sized_relobj_file::compute_final_local_value): Replace refs to
4253         section_offsets_ with accessor function.
4254         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4255         * object.h (Relobj::Relobj): Initialize new data members.
4256         (Relobj::add_dyn_reloc): New function.
4257         (Relobj::first_dyn_reloc): New function.
4258         (Relobj::dyn_reloc_count): New function.
4259         (Relobj::first_dyn_reloc_): New data member.
4260         (Relobj::dyn_reloc_count_): New data member.
4261         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4262         references.
4263         (Sized_relobj::Address): New typedef.
4264         (Sized_relobj::invalid_address): Move here from child class.
4265         (Sized_relobj::Sized_relobj): Initialize new data members.
4266         (Sized_relobj::sized_relobj): New function.
4267         (Sized_relobj::is_output_section_offset_invalid): Move here from
4268         child class.
4269         (Sized_relobj::get_output_section_offset): Likewise.
4270         (Sized_relobj::local_has_got_offset): Likewise.
4271         (Sized_relobj::local_got_offset): Likewise.
4272         (Sized_relobj::set_local_got_offset): Likewise.
4273         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4274         (Sized_relobj::clear_got_offsets): New function.
4275         (Sized_relobj::section_offsets): Move here from child class.
4276         (Sized_relobj::do_output_section_offset): Likewise.
4277         (Sized_relobj::do_set_section_offset): Likewise.
4278         (Sized_relobj::Local_got_offsets): Likewise.
4279         (Sized_relobj::local_got_offsets_): Likewise.
4280         (Sized_relobj::section_offsets_): Likewise.
4281         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4282         references.
4283         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4284         class.
4285         (Sized_relobj_file::sized_relobj): New function
4286         (Sized_relobj_file::local_has_got_offset): Move to base class.
4287         (Sized_relobj_file::local_got_offset): Likewise.
4288         (Sized_relobj_file::set_local_got_offset): Likewise.
4289         (Sized_relobj_file::get_output_section_offset): Likewise.
4290         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4291         (Sized_relobj_file::do_output_section_offset): Likewise.
4292         (Sized_relobj_file::do_set_section_offset): Likewise.
4293         (Sized_relobj_file::Local_got_offsets): Likewise.
4294         (Sized_relobj_file::local_got_offsets_): Likewise.
4295         (Sized_relobj_file::section_offsets_): Likewise.
4296         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4297         (all constructors).
4298         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4299         (Output_reloc::get_symbol_index): Likewise.
4300         (Output_reloc::local_section_offset): Likewise.
4301         (Output_reloc::get_address): Likewise.
4302         (Output_reloc::symbol_value): Likewise.
4303         (Output_data_got::reserve_slot): Move to class definition.
4304         (Output_data_got::reserve_local): New function.
4305         (Output_data_got::reserve_slot_for_global): Remove.
4306         (Output_data_got::reserve_global): New function.
4307         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4308         (all constructors, two instantiations).
4309         (Output_reloc::get_relobj): New function (two instantiations).
4310         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4311         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4312         (Output_data_reloc::add_global): Adjust type of relobj.
4313         (Output_data_reloc::add_global_relative): Likewise.
4314         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4315         (Output_data_reloc::add_local): Likewise.
4316         (Output_data_reloc::add_local_relative): Likewise.
4317         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4318         (Output_data_reloc::add_local_section): Likewise.
4319         (Output_data_reloc::add_output_section): Likewise.
4320         (Output_data_reloc::add_absolute): Likewise.
4321         (Output_data_reloc::add_target_specific): Likewise.
4322         (Output_data_got::reserve_slot): Move definition here.
4323         (Output_data_got::reserve_local): New function.
4324         (Output_data_got::reserve_global): New function.
4325         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4326         section_offsets_ with accessor function.
4327         (Sized_relobj_file::write_sections): Likewise.
4328         (Sized_relobj_file::do_relocate_sections): Likewise.
4329         * target.h (Sized_target::reserve_local_got_entry): New function.
4330         (Sized_target::reserve_global_got_entry): New function.
4331         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4332         (Target_x86_64::reserve_global_got_entry): New function.
4333         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4334
4335 2011-05-23 Cary Coutant  <ccoutant@google.com>
4336
4337         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4338         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4339         bit when checking got_type.
4340         * incremental.cc (Sized_incremental_binary::setup_readers):
4341         Store symbol table and string table locations; initialize bit vector
4342         of file status flags.
4343         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4344         unchanged files.
4345         (Sized_incremental_binary::do_process_got_plt): New function.
4346         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4347         (Output_section_incremental_inputs::set_final_data_size): Record
4348         file index for each input file.
4349         (Output_section_incremental_inputs::write_got_plt): Store file index
4350         instead of input entry offset for each GOT entry.
4351         * incremental.h
4352         (Incremental_input_entry::Incremental_input_entry): Initialize new
4353         data member.
4354         (Incremental_input_entry::set_offset): Store file index.
4355         (Incremental_input_entry::get_file_index): New function.
4356         (Incremental_input_entry::file_index_): New data member.
4357         (Incremental_binary::process_got_plt): New function.
4358         (Incremental_binary::do_process_got_plt): New function.
4359         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4360         data members.
4361         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4362         (Sized_incremental_binary::set_file_is_unchanged): New function.
4363         (Sized_incremental_binary::file_is_unchanged): New function.
4364         (Sized_incremental_binary::do_process_got_plt): New function.
4365         (Sized_incremental_binary::file_status_): New data member.
4366         (Sized_incremental_binary::main_symtab_loc_): New data member.
4367         (Sized_incremental_binary::main_strtab_loc_): New data member.
4368         * output.cc (Output_data_got::Got_entry::write): Add case
4369         RESERVED_CODE.
4370         (Output_data_got::add_global): Call add_got_entry.
4371         (Output_data_got::add_global_plt): Likewise.
4372         (Output_data_got::add_global_with_rel): Likewise.
4373         (Output_data_got::add_global_with_rela): Likewise.
4374         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4375         (Output_data_got::add_global_pair_with_rela): Likewise.
4376         (Output_data_got::add_local): Call add_got_entry.
4377         (Output_data_got::add_local_plt): Likewise.
4378         (Output_data_got::add_local_with_rel): Likewise.
4379         (Output_data_got::add_local_with_rela): Likewise.
4380         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4381         (Output_data_got::add_local_pair_with_rela): Likewise.
4382         (Output_data_got::reserve_slot): New function.
4383         (Output_data_got::reserve_slot_for_global): New function.
4384         (Output_data_got::add_got_entry): New function.
4385         (Output_data_got::add_got_entry_pair): New function.
4386         (Output_section::add_output_section_data): Edit FIXME.
4387         * output.h
4388         (Output_section_data_build::Output_section_data_build): New
4389         constructor with size parameter.
4390         (Output_data_space::Output_data_space): Likewise.
4391         (Output_data_got::Output_data_got): Initialize new data member; new
4392         constructor with size parameter.
4393         (Output_data_got::add_constant): Call add_got_entry.
4394         (Output_data_got::reserve_slot): New function.
4395         (Output_data_got::reserve_slot_for_global): New function.
4396         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4397         (Output_data_got::add_got_entry): New function.
4398         (Output_data_got::add_got_entry_pair): New function.
4399         (Output_data_got::free_list_): New data member.
4400         * target.h (Sized_target::init_got_plt_for_update): New function.
4401         (Sized_target::register_global_plt_entry): New function.
4402         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4403         Initialize new data member; call init; add constructor with PLT count.
4404         (Output_data_plt_x86_64::init): New function.
4405         (Output_data_plt_x86_64::add_relocation): New function.
4406         (Output_data_plt_x86_64::reserve_slot): New function.
4407         (Output_data_plt_x86_64::free_list_): New data member.
4408         (Target_x86_64::init_got_plt_for_update): New function.
4409         (Target_x86_64::register_global_plt_entry): New function.
4410         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4411         incremental updates.
4412         (Output_data_plt_x86_64::add_relocation): New function.
4413         * testsuite/object_unittest.cc (Object_test): Set default options.
4414
4415 2011-05-16  Ian Lance Taylor  <iant@google.com>
4416
4417         * options.h (class General_options): Make -i a synonym for -r.
4418
4419 2011-05-16  Ian Lance Taylor  <iant@google.com>
4420
4421         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4422
4423 2011-05-10 Cary Coutant  <ccoutant@google.com>
4424
4425         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4426         strip_all (-s).
4427
4428 2011-05-06  Ian Lance Taylor  <iant@google.com>
4429
4430         * layout.cc (Layout::layout): If the output section flags change,
4431         update the ordering.
4432
4433 2011-04-25 Cary Coutant  <ccoutant@google.com>
4434
4435         * incremental-dump.cc (dump_incremental_inputs): Print local
4436         symbol info for each input file.
4437         * incremental.cc
4438         (Output_section_incremental_inputs::set_final_data_size): Add local
4439         symbol info to input file entries in incremental info.
4440         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4441         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4442         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4443         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4444         implementation.
4445         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4446         (Sized_incr_relobj::do_relocate): Write the local symbols.
4447         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4448         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4449         Adjust size of input file header.
4450         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4451         (Incremental_inputs_reader::get_local_symbol_count): New function.
4452         (Incremental_inputs_reader::get_input_section): Adjust size of input
4453         file header.
4454         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4455         (Sized_incr_relobj::This): New typedef.
4456         (Sized_incr_relobj::sym_size): New const data member.
4457         (Sized_incr_relobj::Local_symbol): New struct.
4458         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4459         (Sized_incr_relobj::do_local_symbol_offset): New function.
4460         (Sized_incr_relobj::local_symbol_count_): New data member.
4461         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4462         (Sized_incr_relobj::local_symbol_index_): New data member.
4463         (Sized_incr_relobj::local_symbol_offset_): New data member.
4464         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4465         (Sized_incr_relobj::local_symbols_): New data member.
4466         * object.h (Relobj::output_local_symbol_count): New function.
4467         (Relobj::local_symbol_offset): New function.
4468         (Relobj::do_output_local_symbol_count): New function.
4469         (Relobj::do_local_symbol_offset): New function.
4470         (Sized_relobj::do_output_local_symbol_count): New function.
4471         (Sized_relobj::do_local_symbol_offset): New function.
4472
4473 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4474
4475         * descriptors.cc (set_close_on_exec): New function.
4476         (Descriptors::open): Use set_close_on_exec.
4477         * output.cc (S_ISLNK): Define if not defined.
4478
4479 2011-04-22 Cary Coutant  <ccoutant@google.com>
4480
4481         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4482         global symbol map.
4483         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4484         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4485         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4486         relocations.
4487         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4488         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4489         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4490         * incremental.h
4491         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4492         function.
4493         (Incremental_binary::apply_incremental_relocs): New function.
4494         (Incremental_binary::do_apply_incremental_relocs): New function.
4495         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4496         data member.
4497         (Sized_incremental_binary::add_global_symbol): New function.
4498         (Sized_incremental_binary::global_symbol): New function.
4499         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4500         (Sized_incremental_binary::symbol_map_): New data member.
4501         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4502         * target.h (Sized_target::apply_relocation): New function.
4503         * target-reloc.h (apply_relocation): New function.
4504         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4505
4506 2011-04-22  Doug Kwan  <dougkwan@google.com>
4507
4508         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4509         flag of a SHT_ARM_EXIDX section.
4510         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4511         * testsuite/Makefile.in: Regenerate.
4512         * testsuite/arm_exidx_test.s: New file.
4513         * testsuite/arm_exidx_test.sh: Same.
4514
4515 2011-04-20 Cary Coutant  <ccoutant@google.com>
4516
4517         PR gold/12689
4518         * archive.h (Incremental_archive_entry::Archive_member):
4519         Initialize arg_serial_ (second constructor).
4520
4521 2011-04-17  Ian Lance Taylor  <iant@google.com>
4522
4523         * object.cc (Relocate_info::location): Simplify location string.
4524         * errors.cc (Errors::error_at_location): Don't print program
4525         name.
4526         (Errors::warning_at_location): Likewise.
4527         (Errors::undefined_symbol): Likewise.
4528         * testsuite/debug_msg.sh: Update accordingly.
4529
4530 2011-04-14 Cary Coutant  <ccoutant@google.com>
4531
4532         * gold/layout.cc (Layout::symtab_section_offset): New function.
4533         * gold/layout.h (Layout::symtab_section_offset): New function.
4534         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4535
4536 2011-04-12  Ian Lance Taylor  <iant@google.com>
4537
4538         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4539         with MREMAP_MAYMOVE.
4540         * output.h (class Output_file): Add map_is_allocated_ field.
4541         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4542         not available, provide stubs.  If mremap is not available, #define
4543         it to gold_mremap.
4544         (MREMAP_MAYMOVE): Define if not defined.
4545         (Output_file::Output_file): Initialize map_is_allocated_.
4546         (Output_file::resize): Check map_is_allocated_.
4547         (Output_file::map_anonymous): If mmap fails, use malloc.
4548         (Output_file::unmap): Don't do anything for an anonymous map.
4549         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4550         is not available, provide stubs.
4551         (File_read::View::~View): Use free rather than delete[].
4552         (File_read::make_view): Use malloc rather than new[].  If mmap
4553         fails, use malloc.
4554         (File_read::find_or_make_view): Use malloc rather than new[].
4555         * gold.h: Remove HAVE_REMAP code.
4556         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4557         exists.  Rename mremap to gold_mremap.  If mmap is not available
4558         don't do anything.
4559         * configure, config.in: Rebuild.
4560
4561 2011-04-11  Ian Lance Taylor  <iant@google.com>
4562
4563         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4564         initialize local variable v.
4565
4566 2011-04-11  Cary Coutant  <ccoutant@google.com>
4567
4568         * archive.cc (Archive::include_member): Adjust call to
4569         report_object.
4570         (Add_archive_symbols::run): Track argument serial numbers.
4571         (Lib_group::include_member): Likewise.
4572         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4573         * archive.h (Incremental_archive_entry::Archive_member):
4574         Initialize arg_serial_.
4575         (Archive_member::arg_serial_): New data member.
4576         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4577         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4578         incremental link.
4579         (Sized_dynobj::do_for_all_local_got_entries): New function.
4580         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4581         function.
4582         * fileread.cc (get_mtime): New function.
4583         * fileread.h (get_mtime): New function.
4584         * gold.cc (queue_initial_tasks): Check for incremental update.
4585         (process_incremental_input): New function.
4586         (queue_middle_tasks): Don't force valid target for incremental
4587         update.
4588         * incremental-dump.cc (find_input_containing_global): Adjust
4589         size of symbol info entry.
4590         (dump_incremental_inputs): Dump argument serial number and
4591         in_system_directory flag; bias shndx by 1; print symbol names
4592         when dumping per-file symbol lists; use new symbol info readers.
4593         * incremental.cc
4594         (Output_section_incremental_inputs:update_data_size): New function.
4595         (Sized_incremental_binary::setup_readers): Setup input readers
4596         for each input file; build maps for files added from libraries
4597         and scripts.
4598         (Sized_incremental_binary::check_input_args): New function.
4599         (Sized_incremental_binary::do_check_inputs): Build map of argument
4600         serial numbers to input arguments.
4601         (Sized_incremental_binary::do_file_has_changed): Rename
4602         do_file_is_unchanged to this; compare file modification times.
4603         (Sized_incremental_binary::do_init_layout): New function.
4604         (Sized_incremental_binary::do_reserve_layout): New function.
4605         (Sized_incremental_binary::do_get_input_reader): Remove.
4606         (Sized_incremental_binary::get_symtab_view): New function.
4607         (Incremental_checker::can_incrementally_link_output_file): Remove.
4608         (Incremental_inputs::report_command_line): Exclude --debug options.
4609         (Incremental_inputs::report_archive_begin): Add parameter; track
4610         argument serial numbers; don't put input file entry for archive
4611         before archive members.
4612         (Incremental_inputs::report_archive_end): Put input file entry
4613         for archive after archive members.
4614         (Incremental_inputs::report_object): Add parameter; track argument
4615         serial numbers and in_system_directory flag.
4616         (Incremental_inputs::report_script): Add parameter; track argument
4617         serial numbers.
4618         (Output_section_incremental_inputs::set_final_data_size): Adjust
4619         size of symbol info entry; check for forwarding symbols.
4620         (Output_section_incremental_inputs::write_input_files): Write
4621         in_system_directory flag and argument serial number.
4622         (Output_section_incremental_inputs::write_info_blocks): Map section
4623         indices between incremental info and original input file; store
4624         input section index for each symbol.
4625         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4626         change operator() to visit().
4627         (class Global_got_offset_visitor): Likewise.
4628         (class Global_symbol_visitor_got_plt):
4629         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4630         classes.
4631         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4632         (Sized_incr_relobj::do_read_symbols): New function.
4633         (Sized_incr_relobj::do_layout): New function.
4634         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4635         (Sized_incr_relobj::do_add_symbols): New function.
4636         (Sized_incr_relobj::do_should_include_member): New function.
4637         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4638         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4639         (Sized_incr_relobj::do_section_size): New function.
4640         (Sized_incr_relobj::do_section_name): New function.
4641         (Sized_incr_relobj::do_section_contents): New function.
4642         (Sized_incr_relobj::do_section_flags): New function.
4643         (Sized_incr_relobj::do_section_entsize): New function.
4644         (Sized_incr_relobj::do_section_address): New function.
4645         (Sized_incr_relobj::do_section_type): New function.
4646         (Sized_incr_relobj::do_section_link): New function.
4647         (Sized_incr_relobj::do_section_info): New function.
4648         (Sized_incr_relobj::do_section_addralign): New function.
4649         (Sized_incr_relobj::do_initialize_xindex): New function.
4650         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4651         (Sized_incr_relobj::do_read_relocs): New function.
4652         (Sized_incr_relobj::do_gc_process_relocs): New function.
4653         (Sized_incr_relobj::do_scan_relocs): New function.
4654         (Sized_incr_relobj::do_count_local_symbols): New function.
4655         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4656         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4657         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4658         (Sized_incr_relobj::do_relocate): New function.
4659         (Sized_incr_relobj::do_set_section_offset): New function.
4660         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4661         (Sized_incr_dynobj::do_read_symbols): New function.
4662         (Sized_incr_dynobj::do_layout): New function.
4663         (Sized_incr_dynobj::do_add_symbols): New function.
4664         (Sized_incr_dynobj::do_should_include_member): New function.
4665         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4666         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4667         (Sized_incr_dynobj::do_section_size): New function.
4668         (Sized_incr_dynobj::do_section_name): New function.
4669         (Sized_incr_dynobj::do_section_contents): New function.
4670         (Sized_incr_dynobj::do_section_flags): New function.
4671         (Sized_incr_dynobj::do_section_entsize): New function.
4672         (Sized_incr_dynobj::do_section_address): New function.
4673         (Sized_incr_dynobj::do_section_type): New function.
4674         (Sized_incr_dynobj::do_section_link): New function.
4675         (Sized_incr_dynobj::do_section_info): New function.
4676         (Sized_incr_dynobj::do_section_addralign): New function.
4677         (Sized_incr_dynobj::do_initialize_xindex): New function.
4678         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4679         (make_sized_incremental_object): New function.
4680         (Incremental_library::copy_unused_symbols): New function.
4681         (Incremental_library::do_for_all_unused_symbols): New function.
4682         * incremental.h (enum Incremental_input_flags): New type.
4683         (class Incremental_checker): Remove.
4684         (Incremental_input_entry::Incremental_input_entry): Add argument
4685         serial number.
4686         (Incremental_input_entry::arg_serial): New function.
4687         (Incremental_input_entry::set_is_in_system_directory): New function.
4688         (Incremental_input_entry::is_in_system_directory): New function.
4689         (Incremental_input_entry::arg_serial_): New data member.
4690         (Incremental_input_entry::is_in_system_directory_): New data member.
4691         (class Script_info): Move here from script.h.
4692         (Script_info::Script_info): Add filename parameter.
4693         (Script_info::filename): New function.
4694         (Script_info::filename_): New data member.
4695         (Incremental_script_entry::Incremental_script_entry): Add argument
4696         serial number.
4697         (Incremental_object_entry::Incremental_object_entry): Likewise.
4698         (Incremental_object_entry::add_input_section): Build list of input
4699         sections with map to original shndx.
4700         (Incremental_object_entry::get_input_section_index): New function.
4701         (Incremental_object_entry::shndx_): New data member.
4702         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4703         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4704         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4705         serial number.
4706         (Incremental_inputs::report_archive_begin): Likewise.
4707         (Incremental_inputs::report_object): Likewise.
4708         (Incremental_inputs::report_script): Likewise.
4709         (class Incremental_global_symbol_reader): New class.
4710         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4711         and store flags and input file type.
4712         (Incremental_input_entry_reader::arg_serial): New function.
4713         (Incremental_input_entry_reader::type): Extract type from flags.
4714         (Incremental_input_entry_reader::is_in_system_directory): New function.
4715         (Incremental_input_entry_reader::get_input_section_count): Call
4716         accessor function for type.
4717         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4718         function for type; adjust size of global symbol entry.
4719         (Incremental_input_entry_reader::get_global_symbol_count): Call
4720         accessor function for type.
4721         (Incremental_input_entry_reader::get_object_count): Likewise.
4722         (Incremental_input_entry_reader::get_object_offset): Likewise.
4723         (Incremental_input_entry_reader::get_member_count): Likewise.
4724         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4725         (Incremental_input_entry_reader::get_member_offset): Likewise.
4726         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4727         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4728         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4729         (Incremental_input_entry_reader::get_global_symbol_reader): New
4730         function.
4731         (Incremental_input_entry_reader::get_output_symbol_index): New
4732         function.
4733         (Incremental_input_entry_reader::type_): Remove.
4734         (Incremental_input_entry_reader::flags_): New data member.
4735         (Incremental_inputs_reader::input_file_offset): New function.
4736         (Incremental_inputs_reader::input_file_index): New function.
4737         (Incremental_inputs_reader::input_file): Call input_file_offset.
4738         (Incremental_inputs_reader::input_file_at_offset): New function.
4739         (Incremental_relocs_reader::get_r_type): Reformat.
4740         (Incremental_relocs_reader::get_r_shndx): Reformat.
4741         (Incremental_relocs_reader::get_r_offset): Reformat.
4742         (Incremental_relocs_reader::data): New function.
4743         (Incremental_binary::Incremental_binary): Initialize new data members.
4744         (Incremental_binary::check_inputs): Add cmdline parameter.
4745         (Incremental_binary::file_is_unchanged): Remove.
4746         (Input_reader::arg_serial): New function.
4747         (Input_reader::get_unused_symbol_count): New function.
4748         (Input_reader::get_unused_symbol): New function.
4749         (Input_reader::do_arg_serial): New function.
4750         (Input_reader::do_get_unused_symbol_count): New function.
4751         (Input_reader::do_get_unused_symbol): New function.
4752         (Incremental_binary::input_file_count): New function.
4753         (Incremental_binary::get_input_reader): Change signature to use
4754         index instead of filename.
4755         (Incremental_binary::file_has_changed): New function.
4756         (Incremental_binary::get_input_argument): New function.
4757         (Incremental_binary::get_library): New function.
4758         (Incremental_binary::get_script_info): New function.
4759         (Incremental_binary::init_layout): New function.
4760         (Incremental_binary::reserve_layout): New function.
4761         (Incremental_binary::output_file): New function.
4762         (Incremental_binary::do_check_inputs): New function.
4763         (Incremental_binary::do_file_is_unchanged): Remove.
4764         (Incremental_binary::do_file_has_changed): New function.
4765         (Incremental_binary::do_init_layout): New function.
4766         (Incremental_binary::do_reserve_layout): New function.
4767         (Incremental_binary::do_input_file_count): New function.
4768         (Incremental_binary::do_get_input_reader): Change signature.
4769         (Incremental_binary::input_args_map_): New data member.
4770         (Incremental_binary::library_map_): New data member.
4771         (Incremental_binary::script_map_): New data member.
4772         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4773         new data members.
4774         (Sized_incremental_binary::output_section): New function.
4775         (Sized_incremental_binary::inputs_reader): Add const.
4776         (Sized_incremental_binary::symtab_reader): Add const.
4777         (Sized_incremental_binary::relocs_reader): Add const.
4778         (Sized_incremental_binary::got_plt_reader): Add const.
4779         (Sized_incremental_binary::get_symtab_view): New function.
4780         (Sized_incremental_binary::Inputs_reader): New typedef.
4781         (Sized_incremental_binary::Input_entry_reader): New typedef.
4782         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4783         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4784         (Sized_incremental_binary::do_file_has_changed): New function.
4785         (Sized_incremental_binary::do_init_layout): New function.
4786         (Sized_incremental_binary::do_reserve_layout): New function.
4787         (Sized_input_reader::Inputs_reader): Remove.
4788         (Sized_input_reader::Input_entry_reader): Remove.
4789         (Sized_input_reader::do_arg_serial): New function.
4790         (Sized_input_reader::do_get_unused_symbol_count): New function.
4791         (Sized_input_reader::do_get_unused_symbol): New function.
4792         (Sized_incremental_binary::do_input_file_count): New function.
4793         (Sized_incremental_binary::do_get_input_reader): Change signature;
4794         use index instead of filename.
4795         (Sized_incremental_binary::section_map_): New data member.
4796         (Sized_incremental_binary::input_entry_readers_): New data member.
4797         (class Sized_incr_relobj): New class.
4798         (class Sized_incr_dynobj): New class.
4799         (make_sized_incremental_object): New function.
4800         (class Incremental_library): New class.
4801         * layout.cc (Free_list::num_lists): New static data member.
4802         (Free_list::num_nodes): New static data member.
4803         (Free_list::num_removes): New static data member.
4804         (Free_list::num_remove_visits): New static data member.
4805         (Free_list::num_allocates): New static data member.
4806         (Free_list::num_allocate_visits): New static data member.
4807         (Free_list::init): New function.
4808         (Free_list::remove): New function.
4809         (Free_list::allocate): New function.
4810         (Free_list::dump): New function.
4811         (Free_list::print_stats): New function.
4812         (Layout_task_runner::run): Resize output file for incremental updates.
4813         (Layout::Layout): Initialize new data members.
4814         (Layout::set_incremental_base): New function.
4815         (Layout::init_fixed_output_section): New function.
4816         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4817         incremental updates.
4818         (Layout::create_gold_note): Do not create gold note section for
4819         incremental updates.
4820         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4821         for incremental updates.
4822         (Layout::set_section_offsets): For incremental updates, allocate space
4823         from free list.
4824         (Layout::create_symtab_sections): Layout with offsets relative to
4825         start of section; for incremental updates, allocate space from free
4826         list.
4827         (Layout::create_shdrs): For incremental updates, allocate space from
4828         free list.
4829         (Layout::finish_dynamic_section): For incremental updates, do not
4830         check --as-needed (fixed in subsequent patch).
4831         * layout.h (class Free_list): New class.
4832         (Layout::set_incremental_base): New function.
4833         (Layout::incremental_base): New function.
4834         (Layout::init_fixed_output_section): New function.
4835         (Layout::allocate): New function.
4836         (Layout::incremental_base_): New data member.
4837         (Layout::free_list_): New data member.
4838         * main.cc (main): Print Free_list statistics.
4839         * object.cc (Relobj::finalize_incremental_relocs): Add
4840         clear_counts parameter; clear counts only when clear_counts is set.
4841         (Sized_relobj::Sized_relobj): Initialize new base class.
4842         (Sized_relobj::do_layout): Don't report special sections.
4843         (Sized_relobj::do_for_all_local_got_entries): New function.
4844         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4845         symtab_off to all symbol table offsets.
4846         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4847         * object.h (class Got_offset_list): Move to top of file.
4848         (Object::Object): Allow case where input_file == NULL.
4849         (Object::~Object): Likewise.
4850         (Object::input_file): Assert that input_file != NULL.
4851         (Object::lock): Allow case where input_file == NULL.
4852         (Object::unlock): Likewise.
4853         (Object::is_locked): Likewise.
4854         (Object::token): Likewise.
4855         (Object::release): Likewise.
4856         (Object::is_incremental): New function.
4857         (Object::get_mtime): New function.
4858         (Object::for_all_local_got_entries): New function.
4859         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4860         (Object::set_is_in_system_directory): New function.
4861         (Object::is_in_system_directory): New function.
4862         (Object::do_is_incremental): New function.
4863         (Object::do_get_mtime): New function.
4864         (Object::do_for_all_local_got_entries): New function.
4865         (Object::is_in_system_directory_): New data member.
4866         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4867         (class Sized_relobj_base): New class.
4868         (class Sized_relobj): Derive from Sized_relobj_base.
4869         (class Sized_relobj::Symbols): Redeclare from base class.
4870         (class Sized_relobj::local_got_offset_list): Remove.
4871         (class Sized_relobj::Output_sections): Redeclare from base class.
4872         (class Sized_relobj::do_for_all_local_got_entries): New function.
4873         (class Sized_relobj::write_local_symbols): Add offset parameter.
4874         (class Sized_relobj::local_symbol_offset_): Update comment.
4875         (class Sized_relobj::local_dynsym_offset_): Update comment.
4876         * options.cc (Input_arguments::add_file): Remove const.
4877         * options.h (Input_file_argument::Input_file_argument):
4878         Initialize arg_serial_ (all constructors).
4879         (Input_file_argument::set_arg_serial): New function.
4880         (Input_file_argument::arg_serial): New function.
4881         (Input_file_argument::arg_serial_): New data member.
4882         (Input_arguments::Input_arguments): Initialize file_count_.
4883         (Input_arguments::add_file): Remove const.
4884         (Input_arguments::number_of_input_files): New function.
4885         (Input_arguments::file_count_): New data member.
4886         (Command_line::number_of_input_files): Call
4887         Input_arguments::number_of_input_files.
4888         * output.cc (Output_segment_headers::Output_segment_headers):
4889         Set current size.
4890         (Output_section::Input_section::current_data_size): New function.
4891         (Output_section::Output_section): Initialize new data members.
4892         (Output_section::add_input_section): Don't do merge sections for
4893         an incremental link; allocate space from free list for an
4894         incremental update.
4895         (Output_section::add_output_section_data): Allocate space from
4896         free list for an incremental update.
4897         (Output_section::update_data_size): New function.
4898         (Output_section::set_fixed_layout): New function.
4899         (Output_section::reserve): New function.
4900         (Output_segment::set_section_addresses): Remove const.
4901         (Output_segment::set_section_list_addresses): Remove const; allocate
4902         space from free list for an incremental update.
4903         (Output_segment::set_offset): Adjust size of RELRO segment for an
4904         incremental update.
4905         * output.h (Output_data::current_data_size): Move here from
4906         child classes.
4907         (Output_data::pre_finalize_data_size): New function.
4908         (Output_data::update_data_size): New function.
4909         (Output_section_headers::update_data_size): new function.
4910         (Output_section_data_build::current_data_size): Move to Output_data.
4911         (Output_data_strtab::update_data_size): New function.
4912         (Output_section::current_data_size): Move to Output_data.
4913         (Output_section::set_fixed_layout): New function.
4914         (Output_section::has_fixed_layout): New function.
4915         (Output_section::reserve): New function.
4916         (Output_section::update_data_size): New function.
4917         (Output_section::has_fixed_layout_): New data member.
4918         (Output_section::free_list_): New data member.
4919         (Output_segment::set_section_addresses): Remove const.
4920         (Output_segment::set_section_list_addresses): Remove const.
4921         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4922         New function.
4923         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4924         New function.
4925         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4926         parameter when calling Add_symbols constructor; store argument
4927         serial number for members of a lib group.
4928         (Add_symbols::locks): Allow case where token == NULL.
4929         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4930         (Read_member::~Read_member): New function.
4931         (Read_member::is_runnable): New function.
4932         (Read_member::locks): New function.
4933         (Read_member::run): New function.
4934         (Check_script::~Check_script): New function.
4935         (Check_script::is_runnable): New function.
4936         (Check_script::locks): New function.
4937         (Check_script::run): New function.
4938         (Check_library::~Check_library): New function.
4939         (Check_library::is_runnable): New function.
4940         (Check_library::locks): New function.
4941         (Check_library::run): New function.
4942         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4943         (Add_symbols::library_): New data member.
4944         (class Read_member): New class.
4945         (class Check_script): New class.
4946         (class Check_library): New class.
4947         * reloc.cc (Read_relocs::is_runnable): Allow case where
4948         token == NULL.
4949         (Read_relocs::locks): Likewise.
4950         (Scan_relocs::locks): Likewise.
4951         (Relocate_task::locks): Likewise.
4952         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4953         to clear counters.
4954         (Sized_relobj::incremental_relocs_scan): Fix comment.
4955         (Sized_relobj::do_relocate): Pass output file offset to
4956         write_local_symbols.
4957         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4958         from class declaration.
4959         * script.cc (read_input_script): Allocate Script_info; pass
4960         argument serial number to report_script.
4961         * script.h (class Script_info): Move to incremental.h.
4962         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4963         * symtab.h (Symbol_table::add_from_incrobj): New function.
4964         (Symbol_table::set_file_offset): New function.
4965
4966 2011-04-05  Cary Coutant  <ccoutant@google.com>
4967
4968         * incremental-dump.cc (dump_incremental_inputs): Change signature
4969         to take a Sized_incremental_binary; change caller.  Use readers
4970         in Sized_incremental_binary.
4971         * incremental.cc
4972         (Sized_incremental_binary::find_incremental_inputs_sections):
4973         Rename do_find_incremental_inputs_sections to this.
4974         (Sized_incremental_binary::setup_readers): New function.
4975         (Sized_incremental_binary::do_check_inputs): Check
4976         has_incremental_info_ flag; move setup code to setup_readers;
4977         use input readers.
4978         (Sized_incremental_binary::do_file_is_unchanged): New function.
4979         (Sized_incremental_binary::do_get_input_reader): New function.
4980         * incremental.h (class Incremental_binary): Move to end of file.
4981         (Incremental_binary::file_is_unchanged): New function.
4982         (Incremental_binary::do_file_is_unchanged): New function.
4983         (Incremental_binary::Input_reader): New class.
4984         (Incremental_binary::get_input_reader): New function.
4985         (class Sized_incremental_binary): Move to end of file.
4986         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4987         input section reader classes.
4988         (Sized_incremental_binary::has_incremental_info): New function.
4989         (Sized_incremental_binary::inputs_reader): New function.
4990         (Sized_incremental_binary::symtab_reader): New function.
4991         (Sized_incremental_binary::relocs_reader): New function.
4992         (Sized_incremental_binary::got_plt_reader): New function.
4993         (Sized_incremental_binary::do_file_is_unchanged): New function.
4994         (Sized_incremental_binary::Sized_input_reader): New class.
4995         (Sized_incremental_binary::get_input_reader): New function.
4996         (Sized_incremental_binary::find_incremental_inputs_sections):
4997         Rename do_find_incremental_inputs_sections to this.
4998         (Sized_incremental_binary::setup_readers): New function.
4999         (Sized_incremental_binary::has_incremental_info_): New data member.
5000         (Sized_incremental_binary::inputs_reader_): New data member.
5001         (Sized_incremental_binary::symtab_reader_): New data member.
5002         (Sized_incremental_binary::relocs_reader_): New data member.
5003         (Sized_incremental_binary::got_plt_reader_): New data member.
5004         (Sized_incremental_binary::current_input_file_): New data member.
5005
5006 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5007
5008         PR gold/12640
5009         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5010         violation.
5011
5012 2011-03-30  Cary Coutant  <ccoutant@google.com>
5013
5014         * archive.cc (Archive::include_member): Adjust call to report_object.
5015         (Add_archive_symbols::run): Add script_info to call to
5016         report_archive_begin.
5017         (Lib_group::include_member): Adjust call to report_object.
5018         (Add_lib_group_symbols::run): Adjust call to report_object.
5019         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5020         blocks.  Add object count for script input files.
5021         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5022         script_info parameter; change all callers.
5023         (Incremental_inputs::report_object): Add script_info parameter;
5024         change all callers.
5025         (Incremental_inputs::report_script): Store backpointer to
5026         incremental info entry.
5027         (Output_section_incremental_inputs::set_final_data_size): Record
5028         additional information for scripts.
5029         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5030         * incremental.h (Incremental_script_entry::add_object): New function.
5031         (Incremental_script_entry::get_object_count): New function.
5032         (Incremental_script_entry::get_object): New function.
5033         (Incremental_script_entry::objects_): New data member; adjust
5034         constructor.
5035         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5036         (Incremental_inputs::report_object): Add script_info parameter.
5037         (Incremental_inputs_reader::get_object_count): New function.
5038         (Incremental_inputs_reader::get_object_offset): New function.
5039         * options.cc (Input_arguments::add_file): Return reference to
5040         new input argument.
5041         * options.h (Input_argument::set_script_info): New function.
5042         (Input_argument::script_info): New function.
5043         (Input_argument::script_info_): New data member; adjust all
5044         constructors.
5045         (Input_file_group::add_file): Return reference to new input argument.
5046         (Input_file_lib::add_file): Likewise.
5047         (Input_arguments::add_file): Likewise.
5048         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5049         * script.cc (Parser_closure::Parser_closure): Add script_info
5050         parameter; adjust all callers.
5051         (Parser_closure::script_info): New function.
5052         (Parser_closure::script_info_): New data member.
5053         (read_input_script): Report scripts earlier to incremental info.
5054         (script_add_file): Set script_info in Input_argument.
5055         (script_add_library): Likewise.
5056         * script.h (Script_options::Script_info): Rewrite class.
5057
5058 2011-03-29  Cary Coutant  <ccoutant@google.com>
5059
5060         * archive.cc (Library_base::should_include_member): Move
5061         method here from class Archive.
5062         (Archive::Archive): Initialize base class.
5063         (Archive::should_include_member): Move to base class.
5064         (Archive::do_for_all_unused_symbols): New function.
5065         (Add_archive_symbols::run): Remove redundant access to
5066         incremental_inputs.
5067         (Lib_group::Lib_group): Initialize base class.
5068         (Lib_group::do_filename): New function.
5069         (Lib_group::include_member): Pass pointer to Lib_group to
5070         report_object.
5071         (Lib_group::do_for_all_unused_symbols): New function.
5072         (Add_lib_group_symbols::run): Report archive information for
5073         incremental links.
5074         * archive.h (class Library_base): New base class.
5075         (class Archive): Derive from Library_base.
5076         (Archive::filename): Move to base class.
5077         (Archive::set_incremental_info): Likewise.
5078         (Archive::incremental_info): Likewise.
5079         (Archive::Should_include): Likewise.
5080         (Archive::should_include_member): Likewise.
5081         (Archive::Armap_entry): Remove.
5082         (Archive::Unused_symbol_iterator): Remove.
5083         (Archive::unused_symbols_begin): Remove.
5084         (Archive::unused_symbols_end): Remove.
5085         (Archive::do_filename): New function.
5086         (Archive::do_get_mtime): New function.
5087         (Archive::do_for_all_unused_symbols): New function.
5088         (Archive::task_): Move to base class.
5089         (Archive::incremental_info_): Likewise.
5090         (class Lib_group): Derive from Library_base.
5091         (Lib_group::do_filename): New function.
5092         (Lib_group::do_get_mtime): New function.
5093         (Lib_group::do_for_all_unused_symbols): New function.
5094         (Lib_group::task_): Move to base class.
5095         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5096         function.
5097         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5098         function.
5099         * incremental.cc (Incremental_inputs::report_archive_begin):
5100         Use Library_base; call library's get_mtime; add incremental inputs
5101         entry before members.
5102         (class Unused_symbol_visitor): New class.
5103         (Incremental_inputs::report_archive_end): Use Library_base; use
5104         visitor class to record unused symbols; don't add incremental inputs
5105         entry after members.
5106         (Incremental_inputs::report_object): Use Library_base.
5107         * incremental.h
5108         (Incremental_archive_entry::Incremental_archive_entry): Remove
5109         unused Archive parameter.
5110         (Incremental_inputs::report_archive_begin): Use Library_base.
5111         (Incremental_inputs::report_archive_end): Likewise.
5112         (Incremental_inputs::report_object): Likewise.
5113         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5114         function.
5115         * object.h (Object::for_all_global_symbols): New function.
5116         (Object::do_for_all_global_symbols): New function.
5117         (Sized_relobj::do_for_all_global_symbols): New function.
5118         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5119         function.
5120         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5121         function.
5122
5123 2011-03-27  Ian Lance Taylor  <iant@google.com>
5124
5125         * archive.cc (Archive::interpret_header): Return -1 if something
5126         goes wrong.  Change callers accordingly.
5127
5128 2011-03-25  Cary Coutant  <ccoutant@google.com>
5129
5130         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5131         * testsuite/Makefile.in: Regenerate.
5132
5133 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5134
5135         * plugin.cc (get_view): New.
5136         (Plugin::load): Pass get_view to the plugin.
5137         (Plugin_manager::get_view): New.
5138
5139 2011-03-21  Ian Lance Taylor  <iant@google.com>
5140
5141         * testsuite/final_layout.sh: Rewrite to not use dc.
5142         * testsuite/relro_test.sh: Fail if dc is not present.
5143
5144 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5145
5146         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5147         Change == to -eq.
5148         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5149         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5150         Change == to -eq.
5151         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5152         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5153
5154 2011-03-14  Ian Lance Taylor  <iant@google.com>
5155
5156         * script-sections.cc (Sort_output_sections::script_compare):
5157         Rename from is_before, change return type.
5158         (Sort_output_sections::operator()): Adjust accordingly.
5159
5160 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5161
5162         PR gold/12572
5163         * testsuite/odr_violation2.cc: Add comment to make all error line
5164         numbers double digits.
5165         * testsuite/debug_msg.sh: Adjust expected errors.
5166
5167 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5168
5169         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5170         but mark earlier ones as non-canonical
5171         (offset_to_iterator): Update search target and example
5172         (do_addr2line): Return extra lines in a vector*
5173         (format_file_lineno): Extract from do_addr2line
5174         (one_addr2line): Add vector* out-param
5175         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5176         when a lineno entry appeared last for its instruction
5177         (Dwarf_line_info): Add vector* out-param
5178         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5179         * symtab.cc (Odr_violation_compare): Include the lineno in the
5180         comparison again.
5181         (linenos_from_loc): New. Combine the canonical line for an
5182         address with its other lines.
5183         (True_if_intersect): New. Helper functor to make
5184         std::set_intersection a query.
5185         (detect_odr_violations): Compare sets of lines instead of just
5186         one line for each function. This became less deterministic, but
5187         has fewer false positives.
5188         * symtab.h: Declarations.
5189         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5190         mix an optimized and non-optimized object in the same binary
5191         (odr_violation2.so): Same.
5192         * testsuite/Makefile.in: Regenerate from Makefile.am.
5193         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5194         * testsuite/debug_msg.sh: Update line numbers and add
5195         assertions.
5196         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5197         non-optimized context.
5198         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5199         isn't inlined, and use OdrDerived in an optimized context.
5200         * testsuite/odr_header1.h: Defines OdrDerived, where
5201         optimization will change the
5202         first-instruction-in-the-destructor's file and line number.
5203         * testsuite/odr_header2.h: Defines OdrBase.
5204
5205 2011-03-09  Ian Lance Taylor  <iant@google.com>
5206
5207         * fileread.cc (File_read::clear_views): Don't delete the whole
5208         file view.
5209
5210 2011-03-08  Ian Lance Taylor  <iant@google.com>
5211
5212         PR gold/12525
5213         * fileread.cc: #include <climits>.
5214         (GOLD_IOV_MAX): Define.
5215         (File_read::read_multiple): Limit number of entries by iov_max.
5216         * fileread.h (class File_read): Always set max_readv_entries to
5217         128.
5218
5219 2011-03-07  Ian Lance Taylor  <iant@google.com>
5220
5221         PR gold/12525
5222         * options.h (class General_options): Add -dy and -dn.
5223
5224 2011-03-02  Cary Coutant  <ccoutant@google.com>
5225
5226         * testsuite/script_test_9.t: Add TLS segment.
5227
5228 2011-03-02  Simon Baldwin  <simonb@google.com>
5229
5230         * configure.ac: Add check for gnu_indirect_function support in
5231         the toolchain building binutils.
5232         * configure: Rebuild.
5233
5234 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5235
5236         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5237         plugin only symbols.
5238         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5239         in plugin files as not needed in the symbol table.
5240
5241 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5242
5243         * output.cc (Output_section::add_input_section): Delay fill
5244         generation for section ordering.
5245
5246 2011-02-09  Ian Lance Taylor  <iant@google.com>
5247
5248         PR gold/12316
5249         * object.h (class Sized_relobj): Remove clear_local_symbols.
5250         * reloc.cc (Sized_relobj::do_relocate): Don't call
5251         clear_local_symbols.
5252
5253 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5254
5255         * plugin.cc (is_visible_from_outside): Return true for symbols
5256         in the -u option.
5257
5258 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5259
5260         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5261         filename.
5262
5263 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5264
5265         * icf.h (is_section_foldable_candidate): Change type of parameter
5266         to std::string.
5267         * icf.cc (Icf::find_identical_sections): Change type of local variable
5268         section_name to be std::string.
5269         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5270
5271 2011-01-25  Ian Lance Taylor  <iant@google.com>
5272
5273         * script.cc (script_add_extern): Rewrite to use
5274         add_symbol_reference.
5275
5276 2011-01-25  Doug Kwan  <dougkwan@google.com>
5277
5278         * icf.cc (get_section_contents): Always lock section's object.
5279
5280 2011-01-24  Ian Lance Taylor  <iant@google.com>
5281
5282         * options.h (class General_options): Accept
5283         --no-detect-odr-violations.
5284
5285 2011-01-24  Ian Lance Taylor  <iant@google.com>
5286
5287         * version.cc (version_string): Bump to 1.11.
5288
5289 2011-01-24  Ian Lance Taylor  <iant@google.com>
5290
5291         * plugin.cc (class Plugin_rescan): Define new class.
5292         (Plugin_manager::claim_file): Set any_claimed_.
5293         (Plugin_manager::save_archive): New function.
5294         (Plugin_manager::save_input_group): New function.
5295         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5296         necessary.
5297         (Plugin_manager::new_undefined_symbol): New function.
5298         (Plugin_manager::rescan): New function.
5299         (Plugin_manager::rescannable_defines): New function.
5300         (Plugin_manager::add_input_file): Set any_added_.
5301         * plugin.h (class Plugin_manager): define new fields rescannable_,
5302         undefined_symbols_, any_claimed_, and any_added_.  Declare
5303         Plugin_rescan as friend.  Declare new functions.
5304         (Plugin_manager::Rescannable): Define type.
5305         (Plugin_manager::Rescannable_list): Define type.
5306         (Plugin_manager::Undefined_symbol_list): Define type.
5307         (Plugin_manager::Plugin_manager): Initialize new fields.
5308         * archive.cc (Archive::defines_symbol): New function.
5309         (Add_archive_symbols::run): Pass archive to plugins if any.
5310         * archive.h (class Archive): Declare defines_symbol.
5311         * readsyms.cc (Input_group::~Input_group): New function.
5312         (Finish_group::run): Pass input_group to plugins if any.
5313         * readsyms.h (class Input_group): Declare destructor.
5314         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5315         any.
5316
5317 2011-01-10  Ian Lance Taylor  <iant@google.com>
5318
5319         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5320         section as relro.
5321         (Layout::set_segment_offsets): Reset increase_relro before calling
5322         set_section_addresses a second time.
5323
5324 2011-01-04  Cary Coutant  <ccoutant@google.com>
5325
5326         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5327         sections before NOBITS sections.
5328
5329 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5330
5331         * version.cc (print_version): Update copyright to 2011.
5332
5333 2010-12-23  Cary Coutant  <ccoutant@google.com>
5334
5335         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5336         of OS to this->add.  Add OD parameter to second form of the function.
5337
5338 2010-12-20  Ian Lance Taylor  <iant@google.com>
5339
5340         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5341         second of two consecutive entries with same offset.
5342
5343 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5344
5345         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5346         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5347         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5348         to avoid unneeded links against $(LDADD).
5349         * testsuite/Makefile.in: Regenerate.
5350
5351 2010-12-15  Ian Lance Taylor  <iant@google.com>
5352
5353         PR gold/12324
5354         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5355         for R_X86_64_32 and R_X86_64_PC32.
5356         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5357         ver_matching_def_pic.o.
5358         (ver_matching_def_pic.o): New target.
5359
5360 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5361
5362         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5363         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5364         Move definition before File_read::View member definitions.
5365         (File_read::View::~View): Initialize and hold lock before
5366         updating current_mapped_bytes.
5367
5368 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5369
5370         * dwarf_reader.cc: Remove outdated comment.
5371         * gold-threads.cc: Fix typo in error message.
5372         * archive.cc: Fix typos in comments.
5373         * archive.h: Likewise.
5374         * arm-reloc-property.cc: Likewise.
5375         * arm-reloc-property.h: Likewise.
5376         * arm-reloc.def: Likewise.
5377         * arm.cc: Likewise.
5378         * attributes.h: Likewise.
5379         * cref.cc: Likewise.
5380         * ehframe.cc: Likewise.
5381         * fileread.h: Likewise.
5382         * gold.h: Likewise.
5383         * i386.cc: Likewise.
5384         * icf.cc: Likewise.
5385         * incremental.h: Likewise.
5386         * int_encoding.cc: Likewise.
5387         * layout.h: Likewise.
5388         * main.cc: Likewise.
5389         * merge.h: Likewise.
5390         * object.cc: Likewise.
5391         * object.h: Likewise.
5392         * options.cc: Likewise.
5393         * readsyms.cc: Likewise.
5394         * reduced_debug_output.cc: Likewise.
5395         * reloc.cc: Likewise.
5396         * script-sections.cc: Likewise.
5397         * sparc.cc: Likewise.
5398         * symtab.h: Likewise.
5399         * target-reloc.h: Likewise.
5400         * target.cc: Likewise.
5401         * target.h: Likewise.
5402         * timer.cc: Likewise.
5403         * timer.h: Likewise.
5404         * x86_64.cc: Likewise.
5405
5406 2010-12-09  Cary Coutant  <ccoutant@google.com>
5407
5408         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5409         stack.
5410         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5411         parameter; change all callers.
5412         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5413         * options.h (warn_execstack): New option.
5414
5415 2010-12-07  Doug Kwan  <dougkwan@google.com>
5416
5417         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5418         like function call relocations.
5419
5420 2010-12-07  Ian Lance Taylor  <iant@google.com>
5421
5422         * archive.cc (Archive::get_elf_object_for_member): Permit
5423         punconfigured to be NULL.
5424         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5425         (Archive::include_member): Pass NULL to get_elf_object_for_member
5426         if we searched for the archive and this is the first included
5427         object.
5428
5429 2010-12-01  Ian Lance Taylor  <iant@google.com>
5430
5431         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5432         track_relocs_type_ field.
5433         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5434         Set track_relocs_type_.
5435         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5436         contents when using RELA relocs.
5437         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5438         reloc_map_.
5439         * reloc.cc (Track_relocs::next_addend): New function.
5440         * reloc.h (class Track_relocs): Declare next_addend.
5441
5442 2010-12-01  Ian Lance Taylor  <iant@google.com>
5443
5444         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5445         virtual destructor.
5446
5447 2010-12-01  Ian Lance Taylor  <iant@google.com>
5448
5449         * README: Update compilers known to work and fail.
5450
5451 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5452
5453         * configure.in: For --enable-gold, handle value `default' instead of
5454         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5455         not the default.
5456         * configure: Regenerate.
5457
5458 2010-11-18  Doug Kwan  <dougkwan@google.com>
5459
5460         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5461         and right_alignment to be zero.  Store result alignment only if it is
5462         greater than existing alignment.
5463
5464 2010-11-16  Cary Coutant  <ccoutant@google.com>
5465
5466         PR gold/12220
5467         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5468         Check for ".zdebug_line".
5469
5470 2010-11-16  Doug Kwan  <dougkwan@google.com>
5471             Cary Coutant  <ccoutant@google.com>
5472
5473         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5474         by reference; adjust all callers.
5475         * output.cc (Output_segment::set_section_addresses): Adjust references
5476         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5477         list is empty.
5478         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5479         end at page boundary.
5480
5481 2010-11-16  Cary Coutant  <ccoutant@google.com>
5482
5483         PR gold/12220
5484         * layout.cc (Layout::choose_output_section): Transform names of
5485         compressed sections even when using a script with a SECTIONS clause.
5486         (Layout::output_section_name): Remove code to transform
5487         compressed debug section names.
5488         * output.cc (Output_section::add_input_section): Use uncompressed
5489         section size when tracking input sections.
5490
5491 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5492
5493         * symtab.h (Symbol::NON_PIC_REF): Remove.
5494         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5495         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5496         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5497         (Symbol::use_plt_offset): Take a flags argument and pass it
5498         directly to needs_dynamic_reloc.  Restrict check for undefined
5499         weak symbols to function calls.
5500         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5501         (Target_arm::Scan::global): Use it.
5502         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5503         (Target_arm::Relocate::relocate): Likewise.
5504         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5505         parameter with an r_type parameter.  Use get_reference_flags
5506         to get the flags.
5507         (Target_arm::Relocate::relocate): Update accordingly.
5508         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5509         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5510         (Target_i386::Scan::global): Likewise.
5511         (Target_i386::Relocate::relocate): Likewise.
5512         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5513         parameter with an r_type parameter.  Use get_reference_flags
5514         to get the flags.
5515         (Target_i386::Relocate::relocate): Update accordingly.
5516         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5517         (Target_powerpc::Scan::global): Use it.
5518         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5519         (Target_powerpc::Relocate::relocate): Likewise.
5520         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5521         (Target_sparc::Scan::global): Use it.
5522         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5523         (Target_sparc::Relocate::relocate): Likewise.
5524         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5525         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5526         (Target_x86_64::Scan::global): Likewise.
5527         (Target_x86_64::Relocate::relocate): Likewise.
5528
5529 2010-11-08  Doug Kwan  <dougkwan@google.com>
5530             Cary Coutant  <ccoutant@google.com>
5531
5532         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5533         (Arm_exidx_merge_section::section_contents_): New data member.
5534         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5535         (Arm_input_section::~Arm_input_section): De-allocate memory.
5536         (Arm_input_section::original_contents_): New data member.
5537         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5538         in parameters instead of calling Object::section_contents without
5539         locking.
5540         (Arm_output_section::group_section): New parameter TASK.  Pass it
5541         to callees that need locking objects.
5542         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5543         to lock EXIDX input sections.  Fix a formatting issue.  Call
5544         Arm_exidx_merged_section::build_contents to create merged section
5545         contents.
5546         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5547         to lock object of stub table owner.
5548         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5549         TEXT_SIZE to initialize data member TEXT_SIZE_.
5550         (Arm_exidx_input_section::addralign): Fix typo in comment.
5551         (Arm_exidx_input_section::text_size): New method.
5552         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5553         that require locking objects.  Lock objects before scanning for stubs
5554         and updating local symbols.
5555         (Arm_input_section<big_endian>::init): Copy contents of original
5556         input section.
5557         (Arm_input_section<big_endian>::do_write): Use saved contents of
5558         original input section instead of calling Object::section_contents
5559         without locking.
5560         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5561         size without calling Object::section_size().
5562         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5563         for size.  Allocate a buffer for merged EXIDX entries.
5564         (Arm_exidx_merged_section::build_contents): New method.
5565         (Arm_exidx_merged_section::do_write): Move merge section contents
5566         building code to Arm_exidx_merged_section::build_contetns.  Write
5567         out contetns in buffer instead of building it on the fly.
5568         (Arm_relobj::make_exidx_input_section): Also pass text section size
5569         to Arm_exidx_input_section constructor.
5570         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5571         (Arm_dynobj::do_read_symbols): Fix memory leak.
5572         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5573         * target.h: (class Task): Add forward declaration.
5574         (Target::relax): Add new parameter TASK and pass it to
5575         Target::do_relax().
5576         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5577
5578 2010-11-05  Cary Coutant  <ccoutant@google.com>
5579
5580         PR gold/10708
5581         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5582         object when reading from the file.
5583         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5584         second layout pass.
5585         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5586         when reading section contents.
5587         (get_section_contents): Likewise.
5588         (icf::find_identical_sections): Likewise.
5589         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5590         object when reading from the file.
5591         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5592         the object when doing deferred section layout.
5593
5594 2010-11-03  Nick Clifton  <nickc@redhat.com>
5595
5596         PR gold/12001
5597         * script.h (class Symbol_assignment: name): New member.  Returns
5598         the name of the symbol.
5599         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5600         Returns true if the given symbol name is on the list of
5601         assignments wating to be processed.
5602         * archive.cc (should_incldue_member): If the symbol is undefined,
5603         check to see if it is on the list of symbols pending assignment.
5604
5605 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5606
5607         * script-sections.cc (Script_sections::find_memory_region): Check
5608         for a NULL output section pointer.
5609
5610 2010-10-29  Doug Kwan  <dougkwan@google.com>
5611
5612         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5613         Output_section::add_relaxed_input_section.
5614         * output.cc (Output_section::add_relaxed_input_section): Add new
5615         arguments LAYOUT and NAME.  Set section order index.
5616         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5617         Copy section order index.
5618         * output.h (Output_section::add_relaxed_input_section): Add new
5619         arguments LAYOUT and NAME.
5620
5621 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5622
5623         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5624         NATIVE_OR_CROSS_LINKER.
5625         * testsuite/Makefile.in: Regenerate.
5626
5627 2010-10-20  Doug Kwan  <dougkwan@google.com>
5628
5629         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5630         without SHF_LINK_ORDER flags.
5631         * layout.cc (Layout::choose_output_section): Do not filter
5632         SHF_LINK_ORDER flag in a relocatable link.
5633
5634 2010-10-17  Cary Coutant  <ccoutant@google.com>
5635
5636         * output.h (Output_segment::set_section_addresses): Change function
5637         signature.  Update all callers.
5638         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5639         sections.
5640         (Output_segment::set_section_addresses): Align after last TLS
5641         section.  Add padding before last relro section instead of after.
5642
5643 2010-10-17  Doug Kwan  <dougkwan@google.com>
5644
5645         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5646         GOT output section to be writable.
5647
5648 2010-10-14  Cary Coutant  <ccoutant@google.com>
5649
5650         * debug.h (DEBUG_INCREMENTAL): New flag.
5651         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5652         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5653         mode.
5654         * incremental.cc (report_command_line): Ignore all forms of
5655         --incremental.
5656         * layout.cc (Layout::Layout): Check parameters for incremental link
5657         mode.
5658         * options.cc (General_options::parse_incremental): New function.
5659         (General_options::parse_no_incremental): New function.
5660         (General_options::parse_incremental_full): New function.
5661         (General_options::parse_incremental_update): New function.
5662         (General_options::incremental_mode_): New data member.
5663         (General_options::finalize): Check incremental_mode_.
5664         * options.h (General_options): Update help text for --incremental.
5665         Add --no-incremental, --incremental-full, --incremental-update.
5666         (General_options::Incremental_mode): New enum type.
5667         (General_options::incremental_mode): New function.
5668         (General_options::incremental_mode_): New data member.
5669         * parameters.cc (Parameters::incremental_mode_): New data member.
5670         (Parameters::set_options): Set incremental_mode_.
5671         (Parameters::set_incremental_full): New function.
5672         (Parameters::incremental): New function.
5673         (Parameters::incremental_update): New function.
5674         (set_parameters_incremental_full): New function.
5675         * parameters.h (Parameters::set_incremental_full): New function.
5676         (Parameters::incremental): New function.
5677         (Parameters::incremental_update): New function.
5678         (Parameters::incremental_mode_): New data member.
5679         (set_parameters_incremental_full): New function.
5680         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5681         incremental link mode.
5682         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5683         (Sized_relobj::do_relocate_sections): Likewise.
5684         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5685         option.
5686         * testsuite/Makefile.in: Regenerate.
5687         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5688
5689 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5690
5691         * script-sections.h (class Script_sections): Make
5692         Sections_elements typedef public.
5693         * script-sections.cc (class Sort_output_sections): Add elements_
5694         field.  Add constructor which sets it; change all callers.
5695         (Sort_output_sections::is_before): New function.
5696         (Sort_output_sections::operator()): Call is_before.
5697         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5698         conditional.
5699         * testsuite/script_test_10.sh: New test. Test script section
5700         order.
5701         * testsuite/script_test_10.t: Likewise.
5702         * testsuite/script_test_10.s: Likewise.
5703         * testsuite/Makefile.am: Wrap the cross linker tests and the
5704         common tests into NATIVE_OR_CROSS_LINKER.
5705         (check_SCRIPTS): Add script_test_10.sh.
5706         (check_DATA): Add script_test_10.stdout.
5707         (script_test_10.o, script_test_10): New targets.
5708         (script_test_10.stdout): New target.
5709         * configure, testsuite/Makefile.in: Regenerate.
5710
5711 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5712
5713         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5714         error for the deprecated relocations.
5715         (Target_arm::Scan::global): Likewise.
5716         (Target_arm::Relocate::relocate): Likewise.
5717
5718 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5719
5720         * fileread.cc (Input_file::find_file): Initialize *found_name
5721         and *namep when using the fallback search for case 4.
5722
5723 2010-10-11  Cary Coutant  <ccoutant@google.com>
5724
5725         * options.h (class General_options): Redefine -z lazy as an alias for
5726         the negation of -z now.
5727
5728 2010-10-11  Ian Lance Taylor  <iant@google.com>
5729
5730         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5731         binding.
5732
5733 2010-10-06  Nick Clifton  <nickc@redhat.com>
5734
5735         * script-sections.cc(class Memory_region): Remove
5736         current_lma_offset_ field.  Rename current_vma_offset_ to
5737         current_offset_.  Add last_section_ field.
5738         (Memory_region::get_current_vma_address): Rename to
5739         get_current_address.
5740         (Memory_region::get_current_lma_address): Delete.
5741         (Memory_region::increment_vma_offset): Rename to
5742         increment_offset.
5743         (Memory_region::increment_lma_offset): Delete.
5744         (Memory_region::attributes_compatible): New method.  Returns
5745         true if the provided section is compatible with the region.
5746         (Memory_region::get_last_section): New method.  Returns the last
5747         section to use the region.
5748         (Memory_region::set_last_section): New method.  Stores the last
5749         section to use the region.
5750         (Script_sections::block_in_region): New method.  Returns true if
5751         a block of memory is contained within a region.
5752         (Script_sections::find_memory_region): New method.  Locates a
5753         memory region to be used to set a VMA or LMA address.
5754         (Output_section_definition::set_section_addresses): Add code to
5755         check for addresses set by memory regions.
5756         (Output_segment::set_section_addresses): Remove memory region
5757         walking code.
5758         (Script_sections::create_segment): Add a warning if a header
5759         segment is created outside of any region.
5760         * script-sections.h (class Script_sections): Add prototypes for
5761         find_memory_region and block_in_region methods.
5762         * testsuite/memory_test.s: Use .long instead of .word.
5763         * testsuite/memory_test.t: Add some more output sections.
5764         * testsuite/memory_test.sh: Update expected output.
5765
5766 2010-10-02  Doug Kwan  <dougkwan@google.com>
5767
5768         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5769         defintion to symtab.h
5770         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5771         declaration to defintion.
5772
5773 2010-10-01  Nick Clifton  <nickc@redhat.com>
5774
5775         * expression.cc (eval): Replace dummy argument with NULL.
5776         (eval_maybe_dot): Check for a NULL result section pointer.
5777         (Symbol_expression::value): Likewise.
5778         (Dot_expression::value): Likewise.
5779         (BINARY_EXPRESSION): Likewise.
5780         (Max_expression::value): Likewise.
5781         (Min_expression::value): Likewise.
5782         (Absolute_expression::value): Likewise.
5783         (Addr_expression::value_from_output_section): Likewise.
5784         (Loaddddr_expression::value_from_output_section): Likewise.
5785         (Segment_start_expression::value): Likewise.
5786         * script-sections.cc
5787         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5788         argument with NULL.
5789         (Sections_elememt_dot_assignment::set_section_addresses):
5790         Likewise.
5791         (Output_data_expression::do_write_to_buffer): Likewise.
5792         (Output_section_definition::finalize_symbols): Likewise.
5793         (Output_section_definition::set_section_addresses): Likewise.
5794
5795 2010-09-30  Doug Kwan  <dougkwan@google.com>
5796
5797         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5798
5799 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5800
5801         * target.h (Target::can_icf_inline_merge_sections): New virtual
5802         function.
5803         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5804         virtual function.
5805         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5806         virtual function.
5807         * icf.cc (get_section_contents): Inline merge sections only when
5808         target allows it.
5809
5810 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5811
5812         * configure: Regenerate.
5813
5814 2010-09-17  Ian Lance Taylor  <iant@google.com>
5815
5816         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5817         * testsuite/Makefile.am (memory_test.o): New target.
5818         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5819         memory_test.t.
5820         * testsuite/Makefile.in: Rebuild.
5821
5822 2010-09-17  Doug Kwan  <dougkwan@google.com>
5823
5824         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5825         defintion if relocation uses GOT entries of the symbol.
5826         * testsuite/icf_safe_test.sh: Fix test.
5827         * testsuite/icf_safe_so_test.sh: Fix test.
5828
5829 2010-09-16  Cary Coutant  <ccoutant@google.com>
5830
5831         * script_sections.cc (class Memory_region): Remove "NULL" from
5832         vector initializations.
5833
5834 2010-09-15  Cary Coutant  <ccoutant@google.com>
5835
5836         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5837         Resolve forwarding symbols.
5838
5839 2010-09-15  Doug Kwan  <dougkwan@google.com>
5840
5841         * gold/testsuite/script_test_3.t: Add ARM special sections.
5842         * gold/testsuite/script_test_4.t: Same.
5843         * gold/testsuite/script_test_5.t: Same.
5844         * gold/testsuite/script_test_6.t: Same.
5845         * gold/testsuite/script_test_7.t: Same.
5846         * gold/testsuite/script_test_7.t: Same.
5847         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5848
5849 2010-09-14  Cary Coutant  <ccoutant@google.com>
5850
5851         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5852         (Target_x86_64::Relocate::relocate_tls): Replace check for
5853         saw_tls_block_reloc_ with test for executable section.
5854
5855 2010-09-12  Cary Coutant  <ccoutant@google.com>
5856
5857         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5858         position-independent executables to shared libraries need dynamic
5859         relocations.
5860         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5861         position-independent executables.
5862         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5863         * testsuite/Makefile.in: Regenerate.
5864
5865 2010-09-10  Nick Clifton  <nickc@redhat.com>
5866
5867         PR gold/11997
5868         * testsuite/memory_test.t: Discard any sections that are not
5869         needed.
5870
5871 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5872
5873         PR gold/11996
5874         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5875         "This::" to work around a bug in gcc 4.2.
5876
5877         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5878
5879 2010-09-09  Rafael Espindola  <espindola@google.com>
5880
5881         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5882         sections with different PF_X flags in the same segment.
5883         (Layout::find_first_load_seg): Search all segments to find the first
5884         one.
5885         * options.h (rosegment): New.
5886
5887 2010-09-08  Rafael Espindola  <espindola@google.com>
5888
5889         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5890
5891 2010-09-08  Doug Kwan  <dougkwan@google.com>
5892
5893         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5894         (Arm_relobj::do_relocate_sections): Add new parameter for output
5895         file to match the parent.
5896         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5897         of local symbols instead of input values.  Update code to track
5898         changes in gold::relocate_section.
5899         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5900         (Sized_relobj::compute_final_local_value_internal): New methods.
5901         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5902         body into private version of Sized_relobj::compute_final_local_value.
5903         Call the inline method.
5904         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5905         merged symbol value if there is one.
5906         (Symbol_value::has_output_value): New method defintiion.
5907         (Sized_relobj::Compute_final_local_value_status): New enum type.
5908         (Sized_relobj::compute_final_local_value): New methods.
5909         (Sized_relobj::compute_final_local_value_internal): New methods.
5910         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5911         and arm_cortex_a8.sh.
5912         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5913         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5914         New tests.
5915         * Makefile.in: Regenerate.
5916         * testsuite/arm_bl_out_of_range.s: Update test.
5917         * testsuite/thumb_bl_out_of_range.s: Ditto.
5918         * testsuite/thumb_blx_out_of_range.s: Ditto.
5919         * testsuite/arm_branch_out_of_range.sh: New file.
5920         * testsuite/arm_cortex_a8.sh: Ditto.
5921         * testsuite/arm_cortex_a8_b.s: Ditto.
5922         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5923         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5924         * testsuite/arm_cortex_a8_bl.s: Ditto.
5925         * testsuite/arm_cortex_a8_blx.s: Ditto.
5926         * testsuite/arm_cortex_a8_local.s: Ditto.
5927         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5928         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5929
5930 2010-09-08  Rafael Espindola  <espindola@google.com>
5931
5932         * Makefile.am (memory_test.stdout): Run readelf with -W.
5933         * Makefile.in: Regenerate.
5934         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5935         64 bit output.
5936
5937 2010-09-08  Rafael Espindola  <espindola@google.com>
5938
5939         * script-sections.cc (Script_sections::add_memory_region): Convert
5940         field precision to int.
5941         * script.cc (script_set_section_region, script_set_section_region):
5942         Convert field precision to int.
5943
5944 2010-09-08  Rafael Espindola  <espindola@google.com>
5945
5946         * arm.cc (do_finalize_sections): Create the __exidx_start and
5947         __exdix_end symbols even when the section is missing.
5948
5949 2010-09-08  Nick Clifton  <nickc@redhat.com>
5950
5951         * README: Remove claim that MEMORY is not supported.
5952         * expression.cc (script_exp_function_origin)
5953         (script_exp_function_length): Move from here to ...
5954         * script.cc: ... here.
5955         (script_set_section_region, script_add_memory)
5956         (script_parse_memory_attr, script_include_directive): New
5957         functions.
5958         * script-sections.cc
5959         (class Memory_region): New class.
5960         (class Output_section_definition): Add set_memory_region,
5961         set_section_vma, set_section_lma and get_section_name methods.
5962         (class Script_Sections): Add add_memory_region,
5963         find_memory_region, find_memory_region_origin,
5964         find_memory_region_length and set_memory_region methods.
5965         Have set_section_addresses method walk the list of set memory
5966         regions.
5967         Extend the print methos to display memory regions.
5968         * script-sections.h: Add prototypes for new methods.
5969         Add enum for MEMORY region attributes.
5970         * yyscript.y: Add support for parsing MEMORY regions.
5971         * script-c.h: Add prototypes for new functions.
5972         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5973         * testsuite/Makefile.in: Regenerate.
5974         * testsuite/memory_test.sh: New script.
5975         * testsuite/memory_test.s: New assembler source file.
5976         * testsuite/memory_test.t: New linker script.
5977
5978 2010-08-27  Doug Kwan  <dougkwan@google.com>
5979
5980         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5981         reference override an existing dynamic weak reference.
5982         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5983         * testsuite/Makefile.in: Regenerate.
5984         * testsuite/dyn_weak_ref.sh: New file.
5985         * testsuite/dyn_weak_ref_1.c: Ditto.
5986         * testsuite/dyn_weak_ref_2.c: Ditto.
5987
5988 2010-08-27  Ian Lance Taylor  <iant@google.com>
5989
5990         * incremental.h (class Incremental_input_entry): Add virtual
5991         destructor.
5992
5993 2010-08-27  Ian Lance Taylor  <iant@google.com>
5994
5995         * testsuite/start_lib_test_3.c: Mark t3 as used.
5996
5997 2010-08-27  Nick Clifton  <nickc@redhat.com>
5998
5999         * options.cc (version_script): Fix small typo in previous
6000         whitespace tidyup.
6001
6002 2010-08-25  Nick Clifton  <nickc@redhat.com>
6003
6004         * archive.cc: Formatting fixes: Remove whitespace between
6005         typename and following asterisk.  Remove whitespace between
6006         function name and opening parenthesis.
6007         * archive.h: Likewise.
6008         * arm.cc: Likewise.
6009         * attributes.cc: Likewise.
6010         * attributes.h: Likewise.
6011         * common.cc: Likewise.
6012         * copy-relocs.cc: Likewise.
6013         * dirsearch.h: Likewise.
6014         * dynobj.cc: Likewise.
6015         * ehframe.cc: Likewise.
6016         * ehframe.h: Likewise.
6017         * expression.cc: Likewise.
6018         * fileread.cc: Likewise.
6019         * fileread.h: Likewise.
6020         * gc.h: Likewise.
6021         * gold-threads.cc: Likewise.
6022         * gold.cc: Likewise.
6023         * i386.cc: Likewise.
6024         * icf.h: Likewise.
6025         * incremental-dump.cc: Likewise.
6026         * incremental.cc: Likewise.
6027         * layout.cc: Likewise.
6028         * layout.h: Likewise.
6029         * main.cc: Likewise.
6030         * merge.cc: Likewise.
6031         * merge.h: Likewise.
6032         * object.cc: Likewise.
6033         * object.h: Likewise.
6034         * options.cc: Likewise.
6035         * options.h: Likewise.
6036         * output.cc: Likewise.
6037         * output.h: Likewise.
6038         * plugin.cc: Likewise.
6039         * plugin.h: Likewise.
6040         * powerpc.cc: Likewise.
6041         * reloc.cc: Likewise.
6042         * script-c.h: Likewise.
6043         * script-sections.cc: Likewise.
6044         * script.cc: Likewise.
6045         * stringpool.cc: Likewise.
6046         * symtab.cc: Likewise.
6047         * symtab.h: Likewise.
6048         * target.cc: Likewise.
6049         * timer.cc: Likewise.
6050         * timer.h: Likewise.
6051         * version.cc: Likewise.
6052         * x86_64.cc: Likewise.
6053
6054 2010-08-24  Nick Clifton  <nickc@redhat.com>
6055
6056         PR 11899
6057         * layout.cc (segment_precedes): Sort segments by their physical
6058         addresses, if they have been set.
6059
6060 2010-08-23  Cary Coutant  <ccoutant@google.com>
6061
6062         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6063         symbols data.
6064         (Lib_group::include_member): Unlock object after deleting its
6065         symbols data.
6066         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6067         the bug fixed here.
6068
6069 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6070             Cary Coutant  <ccoutant@google.com>
6071
6072         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6073         constructor, and set_blocker.
6074         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6075         readsyms_blocker_.
6076         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6077         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6078         * testsuite/Makefile.am (start_lib_test): New test case.
6079         * testsuite/Makefile.in: Regenerate.
6080         * testsuite/start_lib_test_main.c: New file.
6081         * testsuite/start_lib_test_1.c: New file.
6082         * testsuite/start_lib_test_2.c: New file.
6083         * testsuite/start_lib_test_3.c: New file.
6084
6085 2010-08-19  Ian Lance Taylor  <iant@google.com>
6086
6087         * Makefile.in: Rebuild with automake 1.11.1.
6088         * aclocal.m4: Likewise.
6089         * testsuite/Makefile.in: Likewise.
6090
6091 2010-08-19  Ian Lance Taylor  <iant@google.com>
6092
6093         PR 10893
6094         * i386.cc (class Output_data_plt_i386): Update declarations.
6095         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6096         local_ifuncs_ fields.
6097         (Target_i386::do_plt_section_for_global): New function.
6098         (Target_i386::do_plt_section_for_local): New function.
6099         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6100         parameter; change all callers.  Initialize global_ifuncs_ and
6101         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6102         __rel_iplt_end.
6103         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6104         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6105         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6106         symbols.
6107         (Target_i386::make_plt_section): New function, broken out of
6108         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6109         (Target_i386::make_plt_entry): Call make_plt_section.
6110         (Target_i386::make_local_ifunc_plt_entry): New function.
6111         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6112         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6113         R_386_IRELATIVE to switch.
6114         (Target_i386::Scan::global): Likewise.
6115         (Target_i386::Relocate::relocate): Likewise.
6116         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6117         switch.
6118         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6119         (Target_x86_64::do_plt_section_for_global): New function.
6120         (Target_x86_64::do_plt_section_for_local): New function.
6121         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6122         parameter; change all callers.  If doing a static link define
6123         __rela_iplt_start and __rela_iplt_end.
6124         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6125         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6126         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6127         to point to .plt.
6128         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6129         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6130         switch.
6131         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6132         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6133         R_X86_64_IRELATIVE to switch.
6134         (Target_x86_64::Scan::global): Likewise.
6135         (Target_x86_64::Relocate::relocate): Likewise.
6136         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6137         switch.
6138         * target.h (class Target): Add plt_section_for_global and
6139         plt_section_for_local functions.  Add do_plt_section_for_global
6140         and do_plt_section_for_local virtual functions.
6141         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6142         clarifying comments.
6143         (Symbol::use_plt_offset): Handle IFUNC symbol.
6144         * object.cc (Sized_relobj::Sized_relobj): Initialize
6145         local_plt_offsets_.
6146         (Sized_relobj::local_has_plt_offset): New function.
6147         (Sized_relobj::local_plt_offset): New function.
6148         (Sized_relobj::set_local_plt_offset): New function.
6149         (Sized_relobj::do_count): Handle IFUNC symbol.
6150         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6151         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6152         is_ifunc_symbol functions.
6153         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6154         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6155         local_plt_offsets_ field.
6156         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6157         * output.h (class Output_section_data): Add non-const
6158         output_section function.
6159         (class Output_data_got): Update declarations.
6160         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6161         Add use_plt_offset parameter to global and local constructors.
6162         Change all callers.  Change local_sym_index_ field to 31 bits.
6163         Change GSYM_CODE and CONSTANT_CODE accordingly.
6164         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6165         doing a static link don't set sh_link field.
6166         (Output_data_got::Got_entry::write): Use PLT offset if
6167         appropriate.
6168         (Output_data_got::add_global_plt): New function.
6169         (Output_data_got::add_local_plt): New function.
6170         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6171         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6172         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6173         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6174         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6175         IFUNC conditional.
6176         * testsuite/ifunc-sel.h: New file.
6177         * testsuite/ifuncmain1.c: New file.
6178         * testsuite/ifuncmain1vis.c: New file.
6179         * testsuite/ifuncmod1.c: New file.
6180         * testsuite/ifuncdep2.c: New file.
6181         * testsuite/ifuncmain2.c: New file.
6182         * testsuite/ifuncmain3.c: New file.
6183         * testsuite/ifuncmod3.c: New file.
6184         * testsuite/ifuncmain4.c: New file.
6185         * testsuite/ifuncmain5.c: New file.
6186         * testsuite/ifuncmod5.c: New file.
6187         * testsuite/ifuncmain6pie.c: New file.
6188         * testsuite/ifuncmod6.c: New file.
6189         * testsuite/ifuncmain7.c: New file.
6190         * configure, testsuite/Makefile.in: Rebuild.
6191
6192 2010-08-18  Ian Lance Taylor  <iant@google.com>
6193
6194         * incremental.cc
6195         (Output_section_incremental_inputs::write_input_files): Add cast
6196         to avoid signed/unsigned comparison warning.
6197         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6198
6199 2010-08-12  Cary Coutant  <ccoutant@google.com>
6200
6201         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6202
6203 2010-08-13  Ian Lance Taylor  <iant@google.com>
6204
6205         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6206
6207 2010-08-12  Cary Coutant  <ccoutant@google.com>
6208             Doug Kwan  <dougkwan@google.com>
6209
6210         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6211         defintion overrides non-weak undef, remember that the original undef
6212         is not weak.
6213         * symtab.cc (Symbol_table::sized_write_global): For undef without
6214         an original weak binding, set binding to global in output.
6215         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6216         * testsuite/Makefile.in: Regenerate.
6217         * testsuite/strong_ref_weak_def.sh: New file.
6218         * testsuite/strong_ref_weak_def_1.c: Ditto.
6219         * testsuite/strong_ref_weak_def_2.c: Ditto.
6220
6221 2010-08-12  Cary Coutant  <ccoutant@google.com>
6222
6223         * testsuite/incremental_test.sh: Rewrite.
6224         * testsuite/incremental_test_1.c: Rewrite.
6225         * testsuite/incremental_test_2.c: Rewrite.
6226
6227 2010-08-12  Cary Coutant  <ccoutant@google.com>
6228
6229         * arm.cc (Target_arm::got_size): Add const.
6230         (Target_arm::got_entry_count): New function.
6231         (Target_arm::plt_entry_count): New function.
6232         (Target_arm::first_plt_entry_offset): New function.
6233         (Target_arm::plt_entry_size): New function.
6234         (Output_data_plt_arm::entry_count): New function.
6235         (Output_data_plt_arm::first_plt_entry_offset): New function.
6236         (Output_data_plt_arm::get_plt_entry_size): New function.
6237         * i386.cc (Target_i386::got_size): Add const.
6238         (Target_i386::got_entry_count): New function.
6239         (Target_i386::plt_entry_count): New function.
6240         (Target_i386::first_plt_entry_offset): New function.
6241         (Target_i386::plt_entry_size): New function.
6242         (Output_data_plt_i386::entry_count): New function.
6243         (Output_data_plt_i386::first_plt_entry_offset): New function.
6244         (Output_data_plt_i386::get_plt_entry_size): New function.
6245         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6246         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6247         * incremental.cc: Include target.h.
6248         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6249         parameter.  Adjust all callers.  Find incremental_got_plt section.
6250         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6251         section.
6252         (Output_section_incremental_inputs::set_final_data_size): Calculate
6253         size of incremental_got_plt section.
6254         (Output_section_incremental_inputs::do_write): Write the
6255         incremental_got_plt section.
6256         (Got_plt_view_info): New struct.
6257         (Local_got_offset_visitor): New class.
6258         (Global_got_offset_visitor): New class.
6259         (Global_symbol_visitor_got_plt): New class.
6260         (Output_section_incremental_inputs::write_got_plt): New function.
6261         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6262         Add parameter.  Adjust all callers.
6263         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6264         (Incremental_inputs::got_plt_section): New function.
6265         (Incremental_inputs::got_plt_section_): New data member.
6266         (Incremental_got_plt_reader): New class.
6267         * layout.cc (Layout::create_incremental_info_sections): Add the
6268         incremental_got_plt section.
6269         * object.h (Got_offset_list::get_list): New function.
6270         (Got offset_list::for_all_got_offsets): New function.
6271         (Sized_relobj::local_got_offset_list): New function.
6272         * powerpc.cc (Target_powerpc::got_size): Add const.
6273         (Target_powerpc::got_entry_count): New function.
6274         (Target_powerpc::plt_entry_count): New function.
6275         (Target_powerpc::first_plt_entry_offset): New function.
6276         (Target_powerpc::plt_entry_size): New function.
6277         (Output_data_plt_powerpc::entry_count): New function.
6278         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6279         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6280         * sparc.cc (Target_sparc::got_size): Add const.
6281         (Target_sparc::got_entry_count): New function.
6282         (Target_sparc::plt_entry_count): New function.
6283         (Target_sparc::first_plt_entry_offset): New function.
6284         (Target_sparc::plt_entry_size): New function.
6285         (Output_data_plt_sparc::entry_count): New function.
6286         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6287         (Output_data_plt_sparc::get_plt_entry_size): New function.
6288         * symtab.h (Symbol::got_offset_list): New function.
6289         (Symbol_table::for_all_symbols): New function.
6290         * target.h (Sized_target::got_entry_count): New function.
6291         (Sized_target::plt_entry_count): New function.
6292         (Sized_target::plt_entry_size): New function.
6293         * x86_64.cc (Target_x86_64::got_size): Add const.
6294         (Target_x86_64::got_entry_count): New function.
6295         (Target_x86_64::plt_entry_count): New function.
6296         (Target_x86_64::first_plt_entry_offset): New function.
6297         (Target_x86_64::plt_entry_size): New function.
6298         (Output_data_plt_x86_64::entry_count): New function.
6299         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6300         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6301
6302 2010-08-12  Cary Coutant  <ccoutant@google.com>
6303
6304         * archive.cc: Include incremental.h.
6305         (Archive::Archive): Initialize incremental_info_.
6306         (Archive::include_member): Record archive members in incremental info.
6307         (Add_archive_symbols::run): Record begin and end of an archive in
6308         incremental info.
6309         (Lib_group::include_member): Record objects in incremental info.
6310         * archive.h (Incremental_archive_entry): Forward declaration.
6311         (Archive::set_incremental_info): New member function.
6312         (Archive::incremental_info): New member function.
6313         (Archive::Unused_symbol_iterator): New class.
6314         (Archive::unused_symbols_begin): New member function.
6315         (Archive::unused_symbols_end): New member function.
6316         (Archive::incremental_info_): New data member.
6317         * incremental-dump.cc (find_input_containing_global): New function.
6318         (dump_incremental_inputs): Dump new incremental info sections.
6319         * incremental.cc: Include symtab.h.
6320         (Output_section_incremental_inputs): New class.
6321         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6322         new incremental info sections.
6323         (Sized_incremental_binary::do_check_inputs): Likewise.
6324         (Incremental_inputs::report_archive): Remove.
6325         (Incremental_inputs::report_archive_begin): New function.
6326         (Incremental_inputs::report_archive_end): New function.
6327         (Incremental_inputs::report_object): New function.
6328         (Incremental_inputs::finalize_inputs): Remove.
6329         (Incremental_inputs::report_input_section): New function.
6330         (Incremental_inputs::report_script): Rewrite.
6331         (Incremental_inputs::finalize): Do nothing but finalize string table.
6332         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6333         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6334         (Incremental_inputs::create_data_sections): New function.
6335         (Incremental_inputs::relocs_entsize): New function.
6336         (Output_section_incremental_inputs::set_final_data_size): New function.
6337         (Output_section_incremental_inputs::do_write): New function.
6338         (Output_section_incremental_inputs::write_header): New function.
6339         (Output_section_incremental_inputs::write_input_files): New function.
6340         (Output_section_incremental_inputs::write_info_blocks): New function.
6341         (Output_section_incremental_inputs::write_symtab): New function.
6342         * incremental.h (Incremental_script_entry): Forward declaration.
6343         (Incremental_object_entry): Forward declaration.
6344         (Incremental_archive_entry): Forward declaration.
6345         (Incremental_inputs): Forward declaration.
6346         (Incremental_inputs_header_data): Remove.
6347         (Incremental_inputs_header): Remove.
6348         (Incremental_inputs_header_write): Remove.
6349         (Incremental_inputs_entry_data): Remove.
6350         (Incremental_inputs_entry): Remove.
6351         (Incremental_inputs_entry_write): Remove.
6352         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6353         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6354         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6355         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6356         Likewise.
6357         (Incremental_input_entry): New class.
6358         (Incremental_script_entry): New class.
6359         (Incremental_object_entry): New class.
6360         (Incremental_archive_entry): New class.
6361         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6362         (Incremental_inputs::report_inputs): Remove.
6363         (Incremental_inputs::report_archive): Remove.
6364         (Incremental_inputs::report_archive_begin): New function.
6365         (Incremental_inputs::report_archive_end): New function.
6366         (Incremental_inputs::report_object): Change prototype.
6367         (Incremental_inputs::report_input_section): New function.
6368         (Incremental_inputs::report_script): Change prototype.
6369         (Incremental_inputs::get_reloc_count): New function.
6370         (Incremental_inputs::set_reloc_count): New function.
6371         (Incremental_inputs::create_data_sections): New function.
6372         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6373         (Incremental_inputs::inputs_section): New function.
6374         (Incremental_inputs::symtab_section): New function.
6375         (Incremental_inputs::relocs_section): New function.
6376         (Incremental_inputs::get_stringpool): Add const.
6377         (Incremental_inputs::command_line): Add const.
6378         (Incremental_inputs::inputs): Remove.
6379         (Incremental_inputs::command_line_key): New function.
6380         (Incremental_inputs::input_file_count): New function.
6381         (Incremental_inputs::input_files): New function.
6382         (Incremental_inputs::relocs_entsize): New function.
6383         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6384         (Incremental_inputs::finalize_inputs): Remove.
6385         (Incremental_inputs::Input_info): Remove.
6386         (Incremental_inputs::lock_): Remove.
6387         (Incremental_inputs::inputs_): Change type.
6388         (Incremental_inputs::inputs_map_): Remove.
6389         (Incremental_inputs::current_object_entry_): New data member.
6390         (Incremental_inputs::inputs_section_): New data member.
6391         (Incremental_inputs::symtab_section_): New data member.
6392         (Incremental_inputs::relocs_section_): New data member.
6393         (Incremental_inputs::reloc_count_): New data member.
6394         (Incremental_inputs_reader): New class.
6395         (Incremental_symtab_reader): New class.
6396         (Incremental_relocs_reader): New class.
6397         * layout.cc (Layout::finalize): Move finalization of incremental info
6398         and creation of incremental info sections to follow finalization of
6399         symbol table.  Set offsets for postprocessing sections.
6400         (Layout::create_incremental_info_sections): Call
6401         Incremental_inputs::create_data_sections.  Add incremental symtab
6402         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6403         sections to layout after input sections.
6404         * layout.h (struct Timespec): Forward declaration.
6405         (Layout::incremental_inputs): Add const.
6406         (Layout::create_incremental_info_sections): Add parameter.
6407         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6408         * object.cc: Include incremental.h.
6409         (Relobj::finalize_incremental_relocs): New function.
6410         (Sized_relobj::do_layout): Record input sections in incremental info.
6411         * object.h (Object::output_section): New function.
6412         (Object::output_section_offset): Moved from Relobj.
6413         (Object::get_incremental_reloc_base): New function.
6414         (Object::get_incremental_reloc_count): New function.
6415         (Object::do_output_section): New function.
6416         (Object::do_output_section_offset): Moved from Relobj.
6417         (Object::do_get_incremental_reloc_base): New function.
6418         (Object::do_get_incremental_reloc_count): New function.
6419         (Object::Object): Initialize new data members.
6420         (Relobj::output_section): Renamed do_output_section and moved to
6421         protected.
6422         (Relobj::output_section_offset): Moved to Object.
6423         (Relobj::do_get_incremental_reloc_base): New function.
6424         (Relobj::do_get_incremental_reloc_count): New function.
6425         (Relobj::allocate_incremental_reloc_counts): New function.
6426         (Relobj::count_incremental_reloc): New function.
6427         (Relobj::finalize_incremental_relocs): New function.
6428         (Relobj::next_incremental_reloc_index): New function.
6429         (Relobj::reloc_counts_): New data member.
6430         (Relobj::reloc_bases_): New data member.
6431         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6432         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6433         (Sized_relobj::incremental_relocs_scan): New function.
6434         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6435         (Sized_relobj::incremental_relocs_write): New function.
6436         (Sized_relobj::incremental_relocs_write_reltype): New function.
6437         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6438         incremental link.
6439         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6440         archives and object files elsewhere.
6441         (Add_symbols::run): Report object files here.
6442         (Finish_group::run): Report end of archive at end of group.
6443         * reloc.cc: Include layout.h, incremental.h.
6444         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6445         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6446         (Sized_relobj::incremental_relocs_scan): New function.
6447         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6448         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6449         (Sized_relobj::incremental_relocs_write): New function.
6450         (Sized_relobj::incremental_relocs_write_reltype): New function.
6451         * script.cc (read_input_script): Rewrite test for incremental link.
6452         Change call to Incremental_inputs::report_script.
6453         * symtab.h (Symbol_table::first_global_index): New function.
6454         (Symbol_table::output_count): New function.
6455
6456 2010-08-12  Doug Kwan  <dougkwan@google.com>
6457
6458         * arm.cc (Target_arm::merge_object_attributes): Check command line
6459         options --no-wchar-size-warning and --no-enum-size-warning.
6460         * options.h (General_options): Add ld-compatible options
6461         --no-enum-size-warning and --no-wchar-size-warning.
6462
6463 2010-08-04  Ian Lance Taylor  <iant@google.com>
6464
6465         * x86_64.cc (Target_x86_64::Scan::local): Use
6466         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6467         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6468         (Target_x86_64::Scan::global): Likewise.
6469         (Target_x86_64::Relocate::relocate): Likewise.
6470         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6471         Likewise.
6472
6473 2010-08-03  Cary Coutant  <ccoutant@google.com>
6474
6475         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6476         to reserve space in merged_strings vector. Keep total input size
6477         for stats.
6478         (Output_merge_string::do_print_merge_stats): Print total input size.
6479         * merge.h (Output_merge_string): Add input_size_ field.
6480         * stringpool.cc (Stringpool_template::string_length): Move
6481         implementations out of Stringpool_template class and place in
6482         stringpool.h.
6483         * stringpool.h (string_length): Move out of Stringpool_template.
6484
6485 2010-08-03  Ian Lance Taylor  <iant@google.com>
6486
6487         PR 11712
6488         * layout.cc (relaxation_loop_body): If address of load segment is
6489         set, adjust address to include headers if possible.
6490
6491 2010-08-03  Ian Lance Taylor  <iant@google.com>
6492
6493         * version.cc (version_string): Bump to 1.10.
6494
6495 2010-08-03  Ian Lance Taylor  <iant@google.com>
6496
6497         PR 11805
6498         * layout.h (enum Output_section_order): Define.
6499         (class Layout): Update declarations.
6500         * layout.cc (Layout::get_output_section): Add order parameter.
6501         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6502         is_first_non_relro parameters.  Change all callers.
6503         (Layout::choose_output_section): Likewise.
6504         (Layout::add_output_section_data): Likewise.
6505         (Layout::make_output_section): Likewise.  Set order.
6506         (Layout::default_section_order): New function.
6507         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6508         * output.cc (Output_section::Output_section): Initialize order_.
6509         Don't initialize deleted fields.
6510         (Output_segment::Output_segment): Don't initialize deleted
6511         fields.
6512         (Output_segment::add_output_section_to_load): New function
6513         replacing add_output_section.  Change all callers to call this or
6514         add_output_section_to_nonload.
6515         (Output_segment::add_output_section_to_nonload): New function.
6516         (Output_segment::remove_output_section): Rewrite.
6517         (Output_segment::add_initial_output_data): Likewise.
6518         (Output_segment::has_any_data_sections): Likewise.
6519         (Output_segment::is_first_section_relro): Likewise.
6520         (Output_segment::maximum_alignment): Likewise.
6521         (Output_segment::has_dynamic_reloc): New function replacing
6522         dynamic_reloc_count.  Change all callers.
6523         (Output_segment::has_dynamic_reloc_list): New function replacing
6524         dynamic_reloc_count_list.  Change all callers.
6525         (Output_segment::set_section_addresses): Rewrite.
6526         (Output_segment::set_offset): Rewrite.
6527         (Output_segment::find_first_and_last_list): Remove.
6528         (Output_segment::set_tls_offsets): Rewrite.
6529         (Output_segment::first_section_load_address): Likewise.
6530         (Output_segment::output_section_count): Likewise.
6531         (Output_segment::section_with_lowest_load_address): Likewise.
6532         (Output_segment::write_section_headers): Likewise.
6533         (Output_segment::print_sections_to_map): Likewise.
6534         * output.h (class Output_data): Remove dynamic_reloc_count_
6535         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6536         (Output_data::add_dynamic_reloc): Rewrite.
6537         (Output_data::has_dynamic_reloc): New function.
6538         (Output_data::dynamic_reloc_count): Remove.
6539         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6540         is_last_relro_, is_first_non_relro_, is_interp_,
6541         is_dynamic_linker_section_ fields.  Add order and set_order
6542         functions.  Remove is_relro_local, set_is_relro_local,
6543         is_last_relro, set_is_last_relro, is_first_non_relro,
6544         set_is_first_non_relro functions, is_interp, set_is_interp,
6545         is_dynamic_linker_section, and set_is_dynamic_linker_section
6546         functions.
6547         (class Output_segment): Change Output_data_list from std::list to
6548         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6549         output_bss_ fields.  Update declarations.
6550
6551 2010-08-02  Ian Lance Taylor  <iant@google.com>
6552
6553         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6554         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6555         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6556
6557 2010-08-02  Ian Lance Taylor  <iant@google.com>
6558
6559         PR 11855
6560         * script.cc (Script_options::Script_options): Initialize
6561         symbol_definitions_ and symbol_references_.
6562         (Script_options::add_symbol_assignment): Update
6563         symbol_definitions_ and symbol_references_.
6564         (Script_options::add_symbol_reference): New function.
6565         (script_symbol): New function.
6566         * script.h (class Script_options): Add symbol_definitions_ and
6567         symbol_references_ fields.
6568         (Script_options::referenced_const_iterator): New type.
6569         (Script_options::referenced_begin): New function.
6570         (Script_options::referenced_end): New function.
6571         (Script_options::is_referenced): New function.
6572         (Script_options::any_unreferenced): New function.
6573         * script-c.h (script_symbol): Declare.
6574         * yyscript.y (exp): Call script_symbol.
6575         * symtab.cc: Include "script.h".
6576         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6577         Change all callers.  Check symbols referenced by scripts.
6578         (Symbol_table::add_undefined_symbols_from_command_line): Add
6579         layout parameter.  Change all callers.
6580         (Symbol_table::do_add_undefined_symbols_from_command_line):
6581         Likewise.  Break out loop body.  Check symbols referenced by
6582         scripts.
6583         (Symbol_table::add_undefined_symbol_from_command_line): New
6584         function broken out of
6585         do_add_undefined_symbols_from_command_line.
6586         * symtab.h (class Symbol_table): Update declarations.
6587         * archive.cc: Include "layout.h".
6588         (Archive::should_include_member): Add layout parameter.  Change
6589         all callers.  Check for symbol mentioned in expression.
6590         * archive.h (class Archive): Update declaration.
6591         * object.cc (Sized_relobj::do_should_include_member): Add layout
6592         parameter.
6593         * object.h (Object::should_include_member): Add layout parameter.
6594         Change all callers.
6595         (Object::do_should_include_member): Add layout parameter.
6596         (class Sized_relobj): Update declaration.
6597         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6598         parameter.
6599         * dynobj.h (class Sized_dynobj): Update declaration.
6600         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6601         layout parameter.
6602         * plugin.h (class Sized_pluginobj): Update declaration.
6603
6604 2010-08-02  Ian Lance Taylor  <iant@google.com>
6605
6606         PR 11866
6607         * output.cc (Output_segment::set_offset): Search for the first and
6608         last sections rather than assuming that the list is in order.
6609         (Output_segment::find_first_and_last_list): New function.
6610         * output.h (class Output_segment): Update declarations.
6611         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6612         (relro_strip_test_SOURCES): New variable.
6613         (relro_strip_test_DEPENDENCIES): New variable.
6614         (relro_strip_test_LDFLAGS): New variable.
6615         (relro_strip_test_LDADD): New variable.
6616         (relro_strip_test.so): New target.
6617
6618 2010-08-02  Ian Lance Taylor  <iant@google.com>
6619
6620         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6621         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6622         (Target_i386::got_tlsdesc_section): New function.
6623         (Target_i386::got_section): Create space for GOT entries for
6624         TLSDESC relocations.
6625         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6626         R_386_TLS_GOTDESC.
6627         (Target_i386::Scan::global): Likewise.
6628         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6629         using TLSDESC GOT.
6630         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6631         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6632         (Target_x86_64::got_tlsdesc_section): New function.
6633         (Target_x86_64::got_section): Create space for GOT entries for
6634         TLSDESC relocations.
6635         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6636         R_386_TLS_GOTDESC.
6637         (Target_x86_64::Scan::global): Likewise.
6638         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6639         using TLSDESC GOT.
6640
6641 2010-08-02  Ian Lance Taylor  <iant@google.com>
6642
6643         * testsuite/final_layout.sh: Use dc to convert from hex to
6644         decimal.
6645
6646 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6647
6648         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6649         paramter to the call to gold::gc_process_relocs.
6650         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6651         paramter to the call to gold::gc_process_relocs.
6652         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6653         parameter to the call to gold::gc_process_relocs.
6654         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6655         template parameter to the call to gold::gc_process_relocs.
6656         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6657         paramter to the call to gold::gc_process_relocs.
6658         * gc.h (get_embedded_addend_size): New function.
6659         (gc_process_relocs): Save the size of the reloc for use by ICF.
6660         * icf.cc (get_section_contents): Get the addend from the text section
6661         for SHT_REL relocation sections.
6662         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6663         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6664         * int_encoding.h (read_from_pointer): New overloaded function.
6665         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6666         * testsuite/icf_sht_rel_addend_test.sh: New file.
6667         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6668         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6669
6670 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6671
6672         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6673         * Makefile.in: Regenerate.
6674         * testsuite/Makefile.in: Regenerate.
6675
6676 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6677
6678         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6679         * gold/testsuite/debug_msg.cc: Likewise.
6680         * gold/testsuite/odr_violation1.cc
6681         * gold/testsuite/odr_violation2.cc
6682
6683 2010-07-21  Cary Coutant  <ccoutant@google.com>
6684
6685         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6686         string, and length fields.
6687         (Output_merge_string::Merged_strings_list): New type.
6688         (Output_merge_string::Merged_strings_lists): New typedef.
6689         (Output_merge_string): Replace merged_strings_ with
6690         merged_strings_lists_.
6691         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6692         Merged_strings_list per input object and section.  Don't store pointer
6693         to the string.  Don't store length with each merged string entry.
6694         (Output_merge_string::finalize_merged_data): Loop over list of merged
6695         strings lists.  Recompute length of each merged string.
6696
6697 2010-07-15  Cary Coutant  <ccoutant@google.com>
6698
6699         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6700         here.
6701
6702 2010-07-14  Ian Lance Taylor  <iant@google.com>
6703
6704         * descriptors.cc (Descriptors::open): Report correct name in error
6705         message.
6706
6707 2010-07-13  Doug Kwan  <dougkwan@google.com>
6708
6709         * arm.cc (Arm_input_section::Arm_input_section): For a
6710         SHT_ARM_EXIDX section, always keeps the input sections.
6711         (Arm_input_section::set_exidx_section_link): New method.
6712         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6713         has_errors_ to false.
6714         (Arm_exidx_input_section::has_errors,
6715         Arm_exidx_input_section::set_has_errors): New methods.
6716         (Arm_exidx_input_section::has_errors_): New data member.
6717         (Arm_relobj::get_exidx_shndx_list): New method.
6718         (Arm_output_section::append_text_sections_to_list): Do not skip
6719         section without SHF_EXECINSTR.
6720         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6721         errors.
6722         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6723         section header.  Make error messages more verbose.  Check for
6724         a non-executable section linked to an EXIDX section.
6725         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6726         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6727         check that there is no deferred EXIDX section if we exit early.
6728         Instead of not making an EXIDX section in case of an error, make one
6729         and set the has_errors flag of it.
6730         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6731         in a relocatable link.
6732         (Target_arm::do_relax): Look for the EXIDX output section instead of
6733         assuming that it is called .ARM.exidx.
6734         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6735         section list.  Do not check for SHF_EXECINSTR section flags but
6736         skip any input section with errors.
6737         * output.cc (Output_section::Output_section): Initialize
6738         always_keeps_input_sections_ to false.
6739         (Output_section::add_input_section): Check for
6740         always_keeps_input_sections_.
6741         *  output.h (Output_section::always_keeps_input_sections,
6742         Output_section::set_always_keeps_input_sections): New methods.
6743         (Output_section::always_keeps_input_sections): New data member.
6744
6745 2010-07-13  Rafael Espindola  <espindola@google.com>
6746
6747         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6748         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6749
6750 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6751             Ian Lance Taylor  <iant@google.com>
6752
6753         * output.h (Output_section_lookup_maps::add_merge_section):
6754         Correct check of whether value was inserted.
6755         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6756         (Output_section_lookup_maps::add_relaxed_input_section):
6757         Likewise.
6758         * arm.cc (Target_arm::got_section): Remove used local os.
6759         * i386.cc (Target_i386::got_section): Likewise.
6760         * x86_64.cc (Target_x86_64::got_section): Likewise.
6761         * sparc.cc (Target_sparc::got_section): Likewise.
6762         (Target_sparc::relocate): Remove unused local have_got_offset.
6763         * powerpc.cc (Target_powerpc::relocate): Likewise.
6764
6765 2010-07-13  Ian Lance Taylor  <iant@google.com>
6766
6767         * compressed_output.cc (zlib_decompress): Fix signature in
6768         !HAVE_ZLIB_H case.
6769
6770         * archive.cc (Archive::include_member): Unlock an external member
6771         of a thin archive.  Don't bother to delete an object we know is
6772         NULL.
6773
6774 2010-07-12  Cary Coutant  <ccoutant@google.com>
6775
6776         * compressed_output.cc (zlib_decompress): New function.
6777         (get_uncompressed_size): New function.
6778         (decompress_input_section): New function.
6779         * compressed_output.h (get_uncompressed_size): New function.
6780         (decompress_input_section): New function.
6781         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6782         Handle compressed debug sections.
6783         * layout.cc (is_compressed_debug_section): New function.
6784         (Layout::output_section_name): Map compressed section names to
6785         canonical names.
6786         * layout.h (is_compressed_debug_section): New function.
6787         (is_debug_info_section): Recognize compressed debug sections.
6788         * merge.cc: Include compressed_output.h.
6789         (Output_merge_data::do_add_input_section): Handle compressed
6790         debug sections.
6791         (Output_merge_string::do_add_input_section): Handle compressed
6792         debug sections.
6793         * object.cc: Include compressed_output.h.
6794         (Sized_relobj::Sized_relobj): Initialize new data members.
6795         (build_compressed_section_map): New function.
6796         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6797         * object.h (Object::section_is_compressed): New method.
6798         (Object::do_section_is_compressed): New method.
6799         (Sized_relobj::Compressed_section_map): New type.
6800         (Sized_relobj::do_section_is_compressed): New method.
6801         (Sized_relobj::compressed_sections_): New data member.
6802         * output.cc (Output_section::add_input_section): Handle compressed
6803         debug sections.
6804         * reloc.cc: Include compressed_output.h.
6805         (Sized_relobj::write_sections): Handle compressed debug sections.
6806
6807 2010-07-08  Cary Coutant  <ccoutant@google.com>
6808
6809         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6810         weak when resolving to a dynamic def.
6811         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6812         for weak undef/dynamic def cases. Adjust callers.
6813         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6814         undef_binding_weak_.
6815         (Symbol_table::sized_write_globals): Adjust symbol binding.
6816         (Symbol_table::sized_write_symbol): Add binding parameter.
6817         * symtab.h (Symbol::set_undef_binding): New method.
6818         (Symbol::is_undef_binding_weak): New method.
6819         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6820         (Symbol_table::should_override): Add new parameter.
6821         (Symbol_table::sized_write_symbol): Add new parameter.
6822
6823         * testsuite/weak_undef_file1.cc: Add new test case.
6824         * testsuite/weak_undef_file2.cc: Fix header comment.
6825         * testsuite/weak_undef_test.cc: Add new test case.
6826
6827 2010-06-29  Doug Kwan  <dougkwan@google.com>
6828
6829         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6830         Initialize USE_SYMBOL_.
6831         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6832         definition.
6833         (Arm_reloc_property::uses_symbol_): New data member declaration.
6834         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6835         uses symbol value and symbol is undefined but not weakly undefined.
6836
6837 2010-06-28  Rafael Espindola  <espindola@google.com>
6838
6839         * plugin.cc (Plugin::load): Use dlerror.
6840
6841 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6842
6843         * symtab.cc (detect_odr_violations): When reporting an ODR
6844         violation, report an object where the symbol is defined.
6845
6846 2010-06-25  Doug Kwan  <dougkwan@google.com>
6847
6848         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6849         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6850         definition.
6851         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6852         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6853         target hook to detect function points.
6854         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6855         * icf.h (Icf::check_section_for_function_pointers): Change type of
6856         parameter SECTION_NAME to const reference to std::string.  Use
6857         target hook to determine if section may have unsafe pointers.
6858         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6859         method definition.
6860
6861 2010-06-21  Rafael Espindola  <espindola@google.com>
6862
6863         * fileread.cc (Input_file::find_fie): New
6864         (Input_file::open): Use Input_file::find_fie.
6865         * fileread.h (Input_file::find_fie): New
6866         * plugin.cc (set_extra_library_path): New.
6867         (Plugin::load): Add set_extra_library_path to the transfer vector.
6868         (Plugin_manager::set_extra_library_path): New.
6869         (Plugin_manager::add_input_file): Use the extra search path if set.
6870         (set_extra_library_path(): New.
6871         * plugin.h (Plugin_manager): Add set_extra_library_path and
6872         extra_search_path_.
6873
6874 2010-06-19  Cary Coutant  <ccoutant@google.com>
6875
6876         * layout.cc (gdb_sections): Add .debug_types.
6877         (lines_only_debug_sections): Likewise.
6878
6879 2010-06-18  Rafael Espindola  <espindola@google.com>
6880
6881         * plugin.cc (add_input_file,add_input_library)
6882         (Plugin_manager::add_input_file): Make filename arguments const.
6883         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6884         const.
6885
6886 2010-06-16  Doug Kwan  <dougkwan@google.com>
6887
6888         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6889         .ARM.attributes section if we have not merged any input
6890         attributes sections.
6891
6892 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6893
6894         * arm.cc: Allow combining objects with no EABI version
6895         information.
6896
6897 2010-06-15  Rafael Espindola  <espindola@google.com>
6898
6899         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6900
6901 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6902
6903         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6904         (struct iovec): Correct !HAVE_READV definition.
6905
6906 2010-06-10  Cary Coutant  <ccoutant@google.com>
6907
6908         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6909         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6910         reloc sections.
6911         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6912
6913         PR 11683
6914         * symtab.h (Symbol::is_placeholder): New member function.
6915         * target-reloc.h (relocate_section): Check for placeholder symbols.
6916
6917         * testsuite/Makefile.am (plugin_test_8): New test.
6918         (plugin_test_9): New test.
6919         * testsuite/Makefile.in: Regenerate.
6920
6921 2010-06-09  Nick Clifton  <nickc@redhat.com>
6922
6923         * yyscript.y (input_list_element): Allow strings prefixed with
6924         the '-' character.  Treat these as libraries.
6925         * script.cc (script_add_library): New function.  Adds a library
6926         specified by "-l<name>" found in an input script.
6927         * script-c.h: Add prototype for script_add_library.
6928
6929 2010-06-07  Doug Kwan  <dougkwan@google.com>
6930
6931         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6932         Restrict stub-group size to be within long conditional branch
6933         range when working around cortex-A8 erratum.
6934
6935 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6936
6937         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6938         #ifdef typo.
6939
6940 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6941
6942         PR gold/11658
6943         * output.cc
6944         (Output_section::Input_section_sort_entry::compare_section_ordering):
6945         Change to return non-zero correctly.
6946         (Output_section::Input_section_sort_section_order_index_compare
6947         ::operator()): Change to fix ambiguity in comparisons.
6948
6949 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6950
6951         * gold.h (is_wildcard_string): New function.
6952         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6953         (Layout::layout_eh_frame): Ditto.
6954         (Layout::find_section_order_index): New method.
6955         (Layout::read_layout_from_file): New method.
6956         * layout.h (Layout::find_section_order_index): New method.
6957         (Layout::read_layout_from_file): New method.
6958         (Layout::input_section_position_): New private member.
6959         (Layout::input_section_glob_): New private member.
6960         * main.cc (main): Call read_layout_from_file here.
6961         * options.h (--section-ordering-file): New option.
6962         * output.cc (Output_section::input_section_order_specified_): New
6963         member.
6964         (Output_section::Output_section): Initialize new member.
6965         (Output_section::add_input_section): Add new parameter.
6966         Keep input sections when --section-ordering-file is used.
6967         (Output_section::set_final_data_size): Sort input sections when
6968         section ordering file is specified.
6969         (Output_section::Input_section_sort_entry): Add new parameter.
6970         Check sorting type.
6971         (Output_section::Input_section_sort_entry::compare_section_ordering):
6972         New method.
6973         (Output_section::Input_section_sort_compare::operator()): Change to
6974         consider section_order_index.
6975         (Output_section::Input_section_sort_init_fini_compare::operator()):
6976         Change to consider section_order_index.
6977         (Output_section::Input_section_sort_section_order_index_compare
6978         ::operator()): New method.
6979         (Output_section::sort_attached_input_sections): Change to sort
6980         according to section order when specified.
6981         (Output_section::add_input_section<32, true>): Add new parameter.
6982         (Output_section::add_input_section<64, true>): Add new parameter.
6983         (Output_section::add_input_section<32, false>): Add new parameter.
6984         (Output_section::add_input_section<64, false>): Add new parameter.
6985         * output.h (Output_section::add_input_section): Add new parameter.
6986         (Output_section::input_section_order_specified): New
6987         method.
6988         (Output_section::set_input_section_order_specified): New method.
6989         (Input_section::Input_section): Initialize section_order_index_.
6990         (Input_section::section_order_index): New method.
6991         (Input_section::set_section_order_index): New method.
6992         (Input_section::section_order_index_): New member.
6993         (Input_section::Input_section_sort_section_order_index_compare): New
6994         struct.
6995         (Output_section::input_section_order_specified_): New member.
6996         * script-sections.cc (is_wildcard_string): Delete and move modified
6997         method to gold.h.
6998         (Output_section_element_input::Output_section_element_input): Modify
6999         call to is_wildcard_string.
7000         (Output_section_element_input::Input_section_pattern
7001         ::Input_section_pattern): Ditto.
7002         (Output_section_element_input::Output_section_element_input): Ditto.
7003         * testsuite/Makefile.am (final_layout): New test case.
7004         * testsuite/Makefile.in: Regenerate.
7005         * testsuite/final_layout.cc: New file.
7006         * testsuite/final_layout.sh: New file.
7007
7008 2010-06-01  Rafael Espindola  <espindola@google.com>
7009
7010         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7011
7012 2010-06-01  Rafael Espindola  <espindola@google.com>
7013
7014         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7015         visibility of symbols.
7016
7017 2010-05-27  Doug Kwan  <dougkwan@google.com>
7018
7019         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7020         from start of output section instead of address for a local symbol
7021         in a merged or relaxed section when doing a relocatable link.
7022
7023 2010-05-26  Rafael Espindola  <espindola@google.com>
7024
7025         PR 11604
7026         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7027         adding sections the garbage collector removed.
7028         * gold/testsuite/Makefile.am: Add test.
7029         * gold/testsuite/Makefile.in: Regenerate.
7030         * gold/testsuite/plugin_test_7.sh: New.
7031         * gold/testsuite/plugin_test_7_1.c: New.
7032         * gold/testsuite/plugin_test_7_2.c: New.
7033
7034 2010-05-26  Rafael Espindola  <espindola@google.com>
7035
7036         * script-sections.cc (Output_section_definition::set_section_addresses):
7037         Check for --section-start.
7038
7039 2010-05-26  Doug Kwan  <dougkwan@google.com>
7040
7041         * arm.cc (Arm_scan_relocatable_relocs): New class.
7042         (Target_arm::relocate_special_relocatable): New method.
7043         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7044         (Arm_relocate_functions::thumb_branch_common): Same.
7045         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7046         instead of Default_scan_relocatable_relocs.
7047         * target-reloc.h (relocate_for_relocatable): Let target handle
7048         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7049         * target.h (Sized_target::relocate_special_relocatable): New method.
7050
7051 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7052
7053         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7054
7055 2010-05-23  Doug Kwan  <dougkwan@google.com>
7056
7057         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7058         instead of a cast.
7059         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7060         with a direct branch, not a conditional branch, to a stub.
7061         * merge.cc (Output_merge_base::record_input_section): New method
7062         defintion.
7063         (Output_merge_data::do_add_input_section): Record input section if
7064         keeps-input-sections flag is set.
7065         (Output_merge_string::do_add_input_section): Ditto.
7066         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7067         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7068         INPUT_SECTIONS_.
7069         (Output_merge_base::keeps_input_sections,
7070         Output_merge_base::set_keeps_input_sections,
7071         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7072         method definitions.
7073         (Output_merge_base::Input_sections): New type declaration.
7074         (Output_merge_base::input_sections_begin,
7075         Output_merge_base::input_sections_end,
7076         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7077         (Output_merge_base::bool keeps_input_sections_,
7078         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7079         Output_merge_base::input_sections_): New data members.
7080         (Output_merge_data::do_set_keeps_input_sections): New method
7081         defintion.
7082         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7083         * output.cc (Output_section::Input_section::relobj): Move method
7084         defintion from class declaration to here and handle merge sections.
7085         (Output_section::Input_section::shndx): Ditto.
7086         (Output_section::Output_section): Remove initializations of removed
7087         data members and initialize new data member LOOKUP_MAPS_.
7088         (Output_section::add_input_section): Set keeps-input-sections flag
7089         for a newly created merge output section as appropriate.  Adjust code
7090         to use Output_section_lookup_maps class.
7091         (Output_section::add_relaxed_input_section): Adjst code for lookup
7092         maps code refactoring.
7093         (Output_section::add_merge_input_section): Add a new parameter
7094         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7095         class.  If adding input section to a newly created merge output
7096         section fails, remove the new merge section.
7097         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7098         Adjust code for use of the Output_section_lookup_maps class.
7099         (Output_section::find_merge_section): Ditto.
7100         (Output_section::build_lookup_maps): New method defintion.
7101         (Output_section::find_relaxed_input_section): Adjust code to use
7102         Output_section_lookup_maps class.
7103         (Output_section::get_input_sections): Export merge sections.  Adjust
7104         code to use Output_section_lookup_maps class.
7105         (Output_section:::add_script_input_section): Adjust code to use
7106         Output_section_lookup_maps class.  Update lookup maps for merge
7107         sections also.
7108         (Output_section::discard_states): Use Output_section_lookup_maps.
7109         (Output_section::restore_states): Same.
7110         * output.h (Merge_section_properties): Move class defintion out of
7111         Output_section.
7112         (Output_section_lookup_maps): New class.
7113         (Output_section::Input_section::is_merge_section): New method
7114         defintion.
7115         (Output_section::Input_section::relobj): Move defintion out of class
7116         defintion.  Declare method only.
7117         (Output_section::Input_section::shndx): Ditto.
7118         (Output_section::Input_section::output_merge_base): New method defintion.
7119         (Output_section::Input_section::u2_.pomb): New union field.
7120         (Output_section::Merge_section_by_properties_map,
7121         Output_section::Output_section_data_by_input_section_map,
7122         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7123         Remove types.
7124         (Output_section::add_merge_input_section): Add new parameter
7125         KEEPS_INPUT_SECTIONS.
7126         (Output_section::build_lookup_maps): New method declaration.
7127         (Output_section::merge_section_map_,
7128         Output_section::merge_section_by_properties_map_,
7129         Output_section::relaxed_input_section_map_,
7130         Output_section::is_relaxed_input_section_map_valid_): Remove data
7131         members.
7132         (Output_section::lookup_maps_): New data member.
7133
7134 2010-05-21  Doug Kwan  <dougkwan@google.com>
7135
7136         PR gold/11619
7137         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7138         avoid a compilation error.
7139
7140 2010-05-19  Rafael Espindola  <espindola@google.com>
7141
7142         * script-sections.cc (Output_section_definition::allocate_to_segment):
7143         Update the phdrs_list even when the output section is NULL.
7144         * testsuite/Makefile.am: Add test.
7145         * testsuite/Makefile.in: Regenerate.
7146         * testsuite/script_test_9.cc: New.
7147         * testsuite/script_test_9.sh: New.
7148         * testsuite/script_test_9.t: New.
7149
7150 2010-05-19  Doug Kwan  <dougkwan@google.com>
7151
7152         * arm.cc (Arm_input_section::original_size): New method.
7153         (Arm_input_section::do_addralign): Add a cast.
7154         (Arm_input_section::do_output_offset): Remove static cast.
7155         (Arm_input_section::original_addralign,
7156          Arm_input_section::original_size_): Change type to uint32_t.
7157         (Arm_input_section::init): Add safe casts for section alignment
7158         and size.
7159         (Arm_input_section::set_final_data_size): Do not set address and
7160         offset of stub table.
7161         (Arm_output_section::fix_exidx_coverage): Change use of of
7162         Output_section::Simple_input_section to that of
7163         Output_section::Input_section.
7164         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7165         except for the first pass.
7166         * output.cc (Output_section::get_input_sections): Change type of
7167         input_sections to std::list<Input_section>.
7168         (Output_section::add_script_input_section): Rename from
7169         Output_section::add_simple_input_section.  Change type of SIS
7170         parameter from Simple_input_section to Input_section.
7171         * output.h (Output_section::Simple_input_section): Remove class.
7172         (Output_section::Input_section): Change class visibility to public.
7173         (Output_section::Input_section::addralign): Use stored alignments
7174         for special input sections if set.
7175         (Output_section::Input_section::set_addralign): New method.
7176         (Output_section::get_input_sections): Change parameter type from
7177         list of Simple_input_section to list of Input_section.
7178         (Output_section::add_script_input_section): Rename from
7179         Output_section::add_simple_input_section. Change first parameter's
7180         type from Simple_input_section to Input_section and remove the
7181         second and third parameters.
7182         * script-sections.cc (Input_section::Input_section_list): Change
7183         type to list of Output_section::Input_section/
7184         (Input_section_info::Input_section_info): Change parameter type of
7185         INPUT_SECTION to Output_section::Input_section.
7186         (Input_section_info::input_section): Change return type.
7187         (Input_section_info::input_section_): Change type to
7188         Output_section::Input_section.
7189         (Output_section_element_input::set_section_addresses): Adjust code
7190         to use Output_section::Input_section instead of
7191         Output_section::Simple_input_section.  Adjust code for renaming
7192         of Output_section::add_simple_input_section.
7193         (Orphan_output_section::set_section_addresses): Ditto.
7194
7195 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7196
7197         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7198         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7199
7200 2010-05-18  Rafael Espindola  <espindola@google.com>
7201
7202         * options.cc (General_options::finalize): Handle -nostdlib.
7203         * options.h (nostdlib): New option.
7204         * script.cc (script_add_search_dir): Handle -nostdlib.
7205
7206 2010-05-12  Doug Kwan  <dougkwan@google.com>
7207
7208         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7209         attributes section only if there no attributes section after merging.
7210         (Target_arm::merge_object_attributes): Move value of
7211         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7212         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7213         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7214         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7215         and arm_attr_merge_7.stdout.
7216         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7217         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7218         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7219         arm_attr_merge_7b.o): New rules.
7220         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7221         arm_attr_merge_7
7222         * testsuite/Makefile.in: Regenerate.
7223         * testsuite/arm_attr_merge.sh: New file.
7224         * testsuite/arm_attr_merge_[67][ab].s: Same.
7225
7226 2010-05-05  Nick Clifton  <nickc@redhat.com>
7227
7228         * po/es.po: Updated Spanish translation.
7229
7230 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7231
7232         * Makefile.am (install-exec-local): Properly install gold as
7233         default cross linker.
7234         * Makefile.in: Regenerated.
7235
7236 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7237             Nick Clifton  <nickc@redhat.com>
7238
7239         * configure.ac (install_as_default): Define and set to false
7240         unless --enable-gold or --enable-gold=both/gold has been
7241         specified.
7242         * configure: Regenerate.
7243
7244         * Makefile.am (install-exec-local): Install the executable as
7245         'ld.gold'.  If install_as_default is true then also install it as
7246         'ld'.
7247         * Makefile.in: Regenerated.
7248
7249 2010-04-24  Ian Lance Taylor  <iant@google.com>
7250
7251         * layout.cc (Layout::layout_reloc): In relocatable link don't
7252         combine reloc sections for grouped sections.
7253
7254 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7255
7256         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7257         sections that are not ordinary to icf.
7258         * icf.cc (get_section_contents): Handle relocation pointing to section
7259         with no object or shndx information.
7260         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7261         * testsuite/Makefile.in: Regenerate.
7262         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7263         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7264
7265 2010-04-22  Ian Lance Taylor  <iant@google.com>
7266
7267         * expression.cc (Expression::Expression_eval_info): Add
7268         result_alignment_pointer field.
7269         (Expression::eval_with_dot): Add result_alignment_pointer
7270         parameter.  Change all callers.
7271         (Expression::eval_maybe_dot): Likewise.
7272         (class Binary_expression): Add alignment_pointer parameter to
7273         left_value and right_value.  Change all callers.
7274         (BINARY_EXPRESSION): Set result alignment.
7275         (class Trinary_expression): Add alignment_pointer parameter to
7276         arg2_value and arg3_value.  Change all callers.
7277         (Trinary_cond::value): Set result alignment.
7278         (Max_expression::value, Min_expression::value): Likewise.
7279         (Align_expression::value): Likewise.
7280         * script-sections.cc (class Sections_element): Add dot_alignment
7281         parameter to set_section_addresses virtual function.  Update
7282         instantiations.
7283         (class Output_section_element): Likewise.
7284         (Script_sections::create_segments): Add dot_alignment parameter.
7285         Change all callers.
7286         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7287         (Script_sections::set_phdrs_clause_addresses): Likewise.
7288         * script-sections.h: Update declarations.
7289         * script.h: Update declarations.
7290         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7291         min_p_align.
7292         * testsuite/script_test_3.t: Set large alignment.
7293         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7294         segment has expected alignment.
7295
7296 2010-04-22  Nick Clifton  <nickc@redhat.com>
7297
7298         * po/gold.pot: Updated by the Translation project.
7299         * po/vi.po: Updated Vietnamese translation.
7300
7301 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7302
7303         * testsuite/Makefile.am (check_PROGRAMS): Add
7304         icf_virtual_function_folding_test.
7305         * testsuite/Makefile.in: Regenerated.
7306
7307 2010-04-15  Andrew Haley  <aph@redhat.com>
7308
7309         * options.h (merge_exidx_entries): New option.
7310         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7311         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7312         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7313         (Target_arm::merge_exidx_entries): New function.
7314         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7315         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7316         to Arm_exidx_fixup constructor.
7317         Add new arg, merge_exidx_entries.
7318         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7319         Arm_output_section::fix_exidx_coverage.
7320
7321 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7322
7323         * icf.cc (get_section_contents): Check for preemptible functions.
7324         Ignore addend when appropriate.
7325         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7326         section folded.
7327         (add_from_relobj): Check for section folded.
7328         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7329         * symtab.h (should_add_dynsym_entry): Add new parameter.
7330         * target-reloc.h (scan_relocs): Check for section folded.
7331         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7332         Check reloc types for function pointers in shared objects.
7333         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7334         case.
7335         (icf_preemptible_functions_test): New test case.
7336         (icf_string_merge_test): New test case.
7337         * testsuite.Makefile.in: Regenerate.
7338         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7339         bar_glob.  Refactor code.
7340         * testsuite/icf_preemptible_functions_test.cc: New file.
7341         * testsuite/icf_preemptible_functions_test.sh: New file.
7342         * testsuite/icf_string_merge_test.cc: New file.
7343         * testsuite/icf_string_merge_test.sh: New file.
7344         * testsuite/icf_virtual_function_folding_test.cc: New file.
7345         * testsuite/icf_virtual_function_folding_test.sh: New file.
7346
7347 2010-04-14  Doug Kwan  <dougkwan@google.com>
7348
7349         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7350         for local symbol recounting if we remove a section due to ICF.
7351         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7352         there are no regular objects in input.
7353
7354 2010-04-13  Doug Kwan  <dougkwan@google.com>
7355
7356         * arm.cc (Arm_input_section::set_final_data_size): Compute
7357         accurate final data size instead of using current data size.
7358
7359 2010-04-09  Doug Kwan  <dougkwan@google.com>
7360
7361         * layout.cc (Layout::choose_output_section): Handle script section
7362         types.
7363         (Layout::make_output_section_for_script): Add section type parameter.
7364         Handle script section types.
7365         * layout.h (Layout::make_output_section_for_script): Add section
7366         type parameter.
7367         * output.cc (Output_section::Output_section): Initialize data member
7368         is_noload_.
7369         (Output_section::do_reset_address_and_file_offset): Do not set address
7370         to 0 if section is a NOLOAD section.
7371         * output.h (Output_section::is_noload): New method.
7372         (Output_section::set_is_noload): Ditto.
7373         (Output_section::is_noload_): New data member.
7374         * script-c.h (Script_section_type): New enum type.
7375         (struct Parser_output_section_header): Add new file section_type.
7376         * script-sections.cc (Sections_element::output_section_name): Add
7377         parameter for returning script section type.
7378         (Output_section_definition::output_section_name): Ditto.
7379         (Output_section_definition::section_type)P; New method.
7380         (Output_section_definiton::script_section_type_name): Ditto.
7381         (Output_section_definition::script_section_type_): New data member.
7382         (Output_section_definition::Output_section_definition): Initialize
7383         data member Output_section_definition::script_section_type_.
7384         (Output_section_definition::create_sections): Pass script section type
7385         to Layout::make_output_section_for_script.
7386         (Output_section_definition::output_section_name): Return script
7387         section type to caller.
7388         (Output_section_definition::set_section_address): Do not advance
7389         dot value and load address if section type is NOLOAD.  Set address
7390         of NOLOAD sections regardless of section flags.
7391         (Output_section_definition::print): Print section type if it is
7392         not SCRIPT_SECTION_TYPE_NONE.
7393         (Output_section_definition::section_type): New method.
7394         (Output_section_definition::script_section_type_name): Ditto.
7395         (Script_sections::output_section_name): Add new parameter
7396         PSECTION_TYPE for returning script section type.  Pass it to
7397         section elements.  Handle discard sections.
7398         (Sort_output_sections::operator()): Handle NOLOAD sections.
7399         * script-sections.h (Script_sections::Section_type): New enum type.
7400         (Script_sections::output_section_name): Add a new parameter for
7401         returning script section type.
7402         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7403         INFO and NOLOAD.
7404         * yyscript.y (union): Add new field SECTION_TYPE.
7405         (COPY, DSECT, INFO, NOLOAD): New tokens.
7406         (opt_address_and_section_type): Change type to output_section_header.
7407         (section_type): New non-terminal
7408         (section_header): Handle section type.
7409         (opt_address_and_section_type): Return section type value.
7410
7411 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7412
7413         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7414         * testsuite/plugin_common_test_2.c (foo): Likewise.
7415
7416 2010-04-08  Doug Kwan  <dougkwan@google.com>
7417
7418         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7419         Output_merge_data.
7420         * output.cc (Output_section::add_merge_input_section): Simplify
7421         code and return status of Output_merge_base::add_input_section.
7422         Update merge section map only if Output_merge_base::add_input_section
7423         returns true.
7424
7425 2010-04-07  Doug Kwan  <dougkwan@google.com>
7426
7427         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7428         if section is marked as containing instructions but has no mapping
7429         symbols.
7430         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7431         correct section index.
7432         (Arm_relobj::find_linked_text_section): Ditto.
7433
7434 2010-04-07  Cary Coutant  <ccoutant@google.com>
7435
7436         * archive.cc (include_member): Destroy Read_symbols_data object before
7437         releasing file.
7438         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7439         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7440         (Read_symbols_data::~Read_symbols_data) New destructor.
7441         (Section_relocs::Section_relocs) New constructor.
7442         (Section_relocs::~Section_relocs) New destructor.
7443         (Read_relocs_data::Read_relocs_data) New constructor.
7444         (Read_relocs_data::~Read_relocs_data) New destructor.
7445         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7446         pointers to NULL after deleting.
7447
7448 2010-04-07  Doug Kwan  <dougkwan@google.com>
7449
7450         * arm.cc: Replace "endianity" with "endianness" in comments.
7451         (Arm_exidx_cantunwind): Ditto.
7452         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7453         (Arm_relobj::merge_flags_and_attributes): New method.
7454         (Arm_relobj::merge_flags_and_attributes_): New data member.
7455         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7456         (Arm_relobj::scan_sections_for_stubs): Ditto.
7457         (Arm_relobj::do_read_symbols): Check to see if we really want to
7458         merge processor-specific flags and attributes.  Exit early if
7459         an object is empty except for section names and the undefined symbol.
7460         (Target_arm::do_finalize_sections): Move check for ELF format to
7461         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7462         attributes from a regular object only when we have determined that
7463         it is aapropriate.  Do not create an .ARM.attributes section in
7464         output if there is no regular input object.
7465         (Target_arm::merge_processor_specific_flags): Check
7466         --warn-mismatch before printing any error.
7467         (Target_arm::merge_object_attributes): Ditto.
7468         * gold.cc (queue_middle_tasks): Handle the case in which there is
7469         no regular object in input.
7470         * options.cc (General_options::parse_EB): New method.
7471         (General_options::parse_EL): Same.
7472         (General_options::General_options): Initialize endianness_.
7473         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7474         New options.
7475         (General_options::Endianness): New enum.
7476         (General_options::endianness): New method.
7477         (General_options::endianness_): New data member.
7478         * parameters.cc (Parameters::set_options): Check target endianness.
7479         (Parameters::set_target_once): Ditto.
7480         (Parameters::check_target_endianness): New method.
7481         (parameters_force_valid_target): If either -EL or -EB is specified,
7482         use it to define endianness of default target.
7483         * parameters.h (Parameters::check_target_endianness): New method
7484         declaration.
7485         * target.h (class Target): Change "endianity" to "endianness"
7486         in comments.
7487
7488 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7489
7490         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7491         * configure: Regenerate.
7492         * Makefile.in: Regenerate.
7493         * testsuite/Makefile.in: Regenerate.
7494
7495 2010-04-06  Cary Coutant  <ccoutant@google.com>
7496
7497         gcc PR lto/42757
7498         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7499         prevailing definitions of common symbols.
7500         * testsuite/plugin_test_6.sh: New test case.
7501         * testsuite/plugin_common_test_1.c: New test case.
7502         * testsuite/plugin_common_test_2.c: New test case.
7503         * testsuite/Makefile.am (plugin_test_6): New test case.
7504         * testsuite/Makefile.in: Regenerate.
7505
7506 2010-04-06  Nick Clifton  <nickc@redhat.com>
7507
7508         * po/vi.po: New Vietnamese translation.
7509
7510 2010-03-30  Doug Kwan  <dougkwan@google.com>
7511
7512         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7513
7514 2010-03-25  Doug Kwan  <dougkwan@google.com>
7515
7516         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7517         to avoid a conversion warning on a 32-bit host.
7518
7519 2010-03-24  Ian Lance Taylor  <iant@google.com>
7520
7521         * testsuite/script_test_3.t: Add a TLS segment.
7522         * testsuite/Makefile.am (check_PROGRAMS): Add
7523         tls_phdrs_script_test.
7524         (tls_phdrs_script_test_SOURCES): Define.
7525         (tls_phdrs_script_test_DEPENDENCIES): Define.
7526         (tls_phdrs_script_test_LDFLAGS): Define.
7527         (tls_phdrs_script_test_LDADD): Define.
7528         * testsuite/Makefile.in: Rebuild.
7529
7530 2010-03-23  Cary Coutant  <ccoutant@google.com>
7531
7532         * fileread.cc (find_or_make_view): Fix comment.
7533
7534 2010-03-23  Ian Lance Taylor  <iant@google.com>
7535
7536         * script-sections.cc (class Orphan_section_placement): Define
7537         PLACE_TLS and PLACE_TLS_BSS.
7538         (Orphan_section_placement::Orphan_section_placement): Initialize
7539         new places.
7540         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7541         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7542         (tls_script_test_SOURCES): Define.
7543         (tls_script_test_DEPENDENCIES): Define.
7544         (tls_script_test_LDFLAGS): Define.
7545         (tls_script_test_LDADD): Define.
7546         * testsuite/Makefile.in: Rebuild.
7547
7548 2010-03-22  Doug Kwan  <dougkwan@google.com>
7549
7550         * arm.cc (Arm_relocate_functions::abs8,
7551         Arm_relocate_functions::abs16): Use correct check for overflow
7552         specified in the ARM ELF specs.
7553         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7554         target of a BLX instruction specially.
7555         (Reloc_stub::stub_type_for_reloc): Ditto.
7556         (Relocate::relocate): Use symbolic names instead of numeric relocation
7557         codes to report error.
7558         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7559         workaround.
7560         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7561         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7562         thumb2_blx_out_of_range.stdout
7563         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7564         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7565         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7566         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7567         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7568         thumb2_blx_in_range, thumb2_blx_in_range.o,
7569         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7570         thumb2_blx_out_of_range.o): New rules.
7571         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7572         thumb2_blx_in_range and thumb2_blx_out_of_range.
7573         * testsuite/Makefile.in: Regenerate.
7574         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7575         * testsuite/thumb_blx_in_range.s: New file.
7576         * testsuite/thumb_blx_out_of_range.s: New file.
7577
7578 2010-03-22  Rafael Espindola  <espindola@google.com>
7579
7580         * archive.cc (Should_include): Move to archive.h.
7581         (should_include_member): Make it a member of Archive.
7582         (Lib_group): New.
7583         (Add_lib_group_symbols): New.
7584         * archive.h: Include options.h.
7585         (Archive_member): Moved from Archive.
7586         (Should_include): Moved from archive.cc.
7587         (Lib_group): New.
7588         (Add_lib_group_symbols): New.
7589         * dynobj.cc (do_should_include_member): New.
7590         * dynobj.h (do_should_include_member): New.
7591         * gold.cc (queue_initial_tasks): Update call to queue.
7592         * main.cc (main): Print lib group stats.
7593         * object.cc (do_should_include_member): New.
7594         * object.h: Include archive.h.
7595         (Object::should_include_member): New.
7596         (Object::do_should_include_member): New.
7597         (Sized_relobj::do_should_include_member): New.
7598         * options.cc (General_options::parse_start_lib): New.
7599         (General_options::parse_end_lib): New.
7600         (Input_arguments::add_file): Handle lib groups.
7601         (Input_arguments::start_group): Check we are not in a lib.
7602         (Input_arguments::start_lib): New.
7603         (Input_arguments::end_lib): New.
7604         * options.h (General_options): Add start_lib and end_lib.
7605         (Input_argument::lib_): New.
7606         (Input_argument::lib): New.
7607         (Input_argument::is_lib): New.
7608         (Input_file_lib): New.
7609         (Input_arguments::in_lib_): New.
7610         (Input_arguments::in_lib): New.
7611         (Input_arguments::start_lib): New.
7612         (Input_arguments::end_lib_): New.
7613         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7614         in unused members as preempted.
7615         (Sized_pluginobj::do_should_include_member): New.
7616         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7617         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7618         return the blocker.
7619         (Read_symbols::do_whole_lib_group): New.
7620         (Read_symbols::do_lib_group): New.
7621         (Read_symbols::do_read_symbols): Handle lib groups.
7622         (Read_symbols::get_name): Handle lib groups.
7623         * readsyms.h (Read_symbols): Add an archive member pointer.
7624         (Read_symbols::do_whole_lib_group): New.
7625         (Read_symbols::do_lib_group): New.
7626         (Read_symbols::member_): New.
7627         * script.cc (read_input_script): Update call to queue_soon.
7628
7629 2010-03-19  Doug Kwan  <dougkwan@google.com>
7630
7631         * arm.cc (Stub_table::Stub_table): Initialize new data members
7632         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7633         (Stub_table::add_reloc_stub): Assign stub offset and update
7634         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7635         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7636         New data members.
7637         (Stub_table::update_data_size_and_addralign): Use
7638         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7639         instead of going over all reloc stubs.
7640         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7641         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7642         Stringpool_template::offset_ to size of Stringpool_char.
7643         (Stringpool_template::new_key_offset): Remove code to initialize
7644         Stringpool_template::offset_.
7645         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7646         Stringpool_template::offset_ to zero.
7647
7648 2010-03-15  Doug Kwan  <dougkwan@google.com>
7649
7650         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7651         offset_.
7652         (Stringpool_template::new_key_offset): New method.
7653         (Stringpool_template::add_string): Assign offsets when adding new
7654         strings.
7655         (Stringpool_template::set_string_offsets): Do not set string offsets
7656         when not optimizing.
7657         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7658         member size_.
7659         (Chunked_vector::clear): Clear size_.
7660         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7661         (Chunked_vector::size): Return size_.
7662         (Chunked_vector::push_back): Use size_ to find insert position.
7663         (Chunked_vector::size_): New data member.
7664         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7665         (Stringpool_template::new_key_offset): New method declaration.
7666         (Stringpool_template::offset_): New data member.
7667
7668 2010-03-15   Rafael Espindola  <espindola@google.com>
7669
7670         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7671         Add_symbols' constructor.
7672         * readsyms.h (Add_symbols): Remove the input_group member.
7673
7674 2010-03-10  Ian Lance Taylor  <iant@google.com>
7675
7676         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7677         target to ask whether a reference to a symbol requires a stack
7678         split.
7679         * target.h (Target::is_call_to_non_split): New function.
7680         (Target::do_is_call_to_non_split): Declare virtual function.
7681         * target.cc: Include "symtab.h".
7682         (Target::do_is_call_to_non_split): New function.
7683         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7684
7685 2010-03-10  Cary Coutant  <ccoutant@google.com>
7686
7687         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7688         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7689         (File_read::open[2]): Add whole_file_view_ to list of views.
7690         (File_read::make_view): Remove test of whole_file_view_.
7691         (File_read::find_or_make_view): Create whole_file_view_ if
7692         necessary.
7693         (File_read::clear_views): Replace bool parameter with enum;
7694         adjust all callers.  Don't delete views with permanent data;
7695         do delete cached views and views from archives if
7696         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7697         if clearing the corresponding view.
7698         * fileread.h (File_read::Clear_views_mode): New enum.
7699         (File_read::View::is_permanent_view): New method.
7700         (File_read::clear_views): Replace bool parameter
7701         with enum; adjust all callers.
7702         * options.h (General_options): Change keep_files_mapped option;
7703         add map_whole_files.
7704         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7705         releasing the file.
7706         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7707         the file.
7708
7709 2010-03-10  David S. Miller  <davem@davemloft.net>
7710
7711         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7712
7713 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7714
7715         * icf.cc (get_section_contents): Add '@' marker after processing the
7716         merge reloc.
7717
7718 2010-03-08  Doug Kwan  <dougkwan@google.com>
7719
7720         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7721         due to a conversion warning.
7722         (Arm_relobj::update_output_local_symbol_count): Check for local
7723         symbol with unset output index.
7724
7725 2010-03-05  Ian Lance Taylor  <iant@google.com>
7726
7727         * options.h (class General_options): Add --spare-dynamic-tags.
7728         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7729         --spare-dynamic-tags.
7730
7731 2010-03-05  Ian Lance Taylor  <iant@google.com>
7732
7733         * incremental.cc: Include "libiberty.h".
7734
7735 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7736
7737         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7738         function, is_info_ member.
7739         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7740         (Versions::Versions): Update caller.
7741         (Versions::define_base_version): Likewise.
7742         (Versions::add_def): Likewise.
7743
7744 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7745
7746         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7747         (Scan::possible_function_pointer_reloc): New function.
7748         (Scan::local_reloc_may_be_function_pointer): Change to call
7749         possible_function_pointer_reloc.
7750         (Scan::global_reloc_may_be_function_pointer): Ditto.
7751         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7752         relocations in ".data.rel.ro._ZTV" section.
7753         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7754         * testsuite/icf_safe_so_test.cc: Ditto.
7755         * testsuite/icf_safe_test.cc: Ditto.
7756         * testsuite/icf_safe_test.sh: Ditto.
7757
7758 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7759             Ian Lance Taylor  <iant@google.com>
7760
7761         * target-reloc.h (relocate_section): Check the symbol table index
7762         for -1U before setting the local symbol index.
7763         (scan_relocatable_relocs): If copying the relocation, record that
7764         the local symbol is required.
7765         * object.h (Symbol_value::is_output_symtab_index_set): New
7766         function.
7767         (Symbol_value::may_be_discarded_from_output_symtab): New
7768         function.
7769         (Symbol_value::has_output_symtab_entry): New function.
7770         (Symbol_value::needs_output_symtab_entry): Remove.
7771         (Symbol_value::output_symtab_index): Make sure the symbol index is
7772         set.
7773         (Symbol_value::set_output_symtab_index): Make sure the symbol
7774         index is not set.  Make sure the new index is valid.
7775         (Symbol_value::set_must_have_output_symtab_entry): New function.
7776         (Symbol_value::has_output_dynsym_entry): New function.
7777         (Symbol_value::set_output_dynsym_index): Make sure the new index
7778         is valid.
7779         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7780         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7781         local symbol if permitted.
7782         (Sized_relobj::do_finalize_local_symbols): Call
7783         is_output_symtab_index_set rather than needs_output_symtab_entry.
7784         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7785         rather than needs_output_symtab_entry.  Call
7786         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7787         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7788         is_output_symtab_index_set rather than needs_output_symtab_entry.
7789         * testsuite/discard_locals_relocatable_test.c: New file.
7790         * testsuite/discard_locals_test.sh: Test -r.
7791         * testsuite/Makefile.am (check_DATA): Add
7792         discard_locals_relocatable_test1.syms,
7793         discard_local_relocatable_test2.syms.
7794         (MOSTLYCLEANFILES): Likewise.  Also add
7795         discard_locals_relocatable_test1.lout and
7796         discard_locals_relocatable_test2.out.
7797         (discard_locals_relocatable_test1.syms): New target.
7798         (discard_locals_relocatable_test.o): New target.
7799         (discard_locals_relocatable_test1.out): New target.
7800         (discard_locals_relocatable_test2.syms): New target.
7801         (discard_locals_relocatable_test2.out): New target.
7802         (various): Add missing ../ld-new dependencies.
7803         * testsuite/Makefile.in: Rebuild.
7804
7805 2010-03-03  Nick Clifton  <nickc@redhat.com>
7806
7807         * po/fi.po: New Finnish translation.
7808
7809 2010-03-01  Doug Kwan  <dougkwan@google.com>
7810
7811         * layout.cc (Layout::Layout): Force section types of .init_array*,
7812         .preinit_array* and .fini_array* sections.
7813         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7814         Fix check of return value of std::string::find.().
7815         (Output_section::Input_section_sort_compare::operator()): Remove
7816         comment about .init_array.
7817         (Output_section::Input_section_sort_init_fini_compare::operator()):
7818         New method.
7819         (Output_section::sort_attached_input_sections): Handle .init_array
7820         and .fini_array specially.
7821         * output.h (Output_section::Inut_section_sort_compare): Update
7822         comment.
7823         (Output_section::Input_section_sort_init_fini_compare): New struct.
7824
7825 2010-02-26  Doug Kwan  <dougkwan@google.com>
7826
7827         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7828         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7829         * testsuite/debug_msg.sh: Avoid matching source line number for
7830         use of global variable undef_int.
7831
7832 2010-02-26  Doug Kwan  <dougkwan@google.com>
7833
7834         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7835         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7836         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7837         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7838         * options.cc (General_options::General_options): Initialize member
7839         fix_v4bx_.
7840         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7841         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7842         and rm_no_fix_v4bx.stdout
7843         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7844         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7845         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7846         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7847         and arm_no_fix_v4bx.
7848         * Makefile.in: Regenerate.
7849         * testsuite/arm_fix_v4bx.s: New file.
7850         * testsuite/arm_fix_v4bx.sh: Ditto.
7851
7852 2010-02-24  Doug Kwan  <dougkwan@google.com>
7853
7854         * arm.cc (Target_arm::got_section): Make the .got section the first
7855         non RELRO section in the data segment.
7856         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7857         suffixes of section names.
7858
7859 2010-02-24  Doug Kwan  <dougkwan@google.com>
7860
7861         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7862         flags and attributes merging if an input file is a binary file.
7863         * fileread.cc (Input_file::open): Record format of original file.
7864         * fileread.h (Input_file::Format): New enum type.
7865         (Input_file::Input_file): Initialize data member format_.
7866         (Input_file::format): New method definition.
7867         (Input_file::format_):: New data member.
7868
7869 2010-02-24  Doug Kwan  <dougkwan@google.com>
7870
7871         * arm.cc (Arm_output_data_got): New class.
7872         (ARM_TCB_SIZE): New constant
7873         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7874         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7875         If user uses a script with a SECTIONS clause, issue only a warning
7876         for a misplaced EXIDX input section.  Otherwise, issue an error.
7877         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7878         garbage collection.
7879         (Target_arm::got_mode_index_entry): Handle static linking.
7880         (Target_arm::Scan::local): Ditto.
7881         (Target_arm::Scan::global): Ditto.
7882         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7883         all incorrectly implemented relocations.
7884         (Target_arm::fix_exidx_coverage): Pass layout to
7885         Arm_output_section::fix_exidx_coverage.
7886         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7887         from ".ARM.exidx." and ".ARM.extab.".
7888
7889 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7890
7891         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7892         section if it does not already exist.
7893         * attributes.cc (Attributes_section_data::Attributes_section_data):
7894         Don't crash if size is zero.
7895
7896 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7897             Ian Lance Taylor  <iant@google.com>
7898
7899         * gold.cc (queue_middle_tasks): If no input files were opened,
7900         exit.
7901         * workqueue.h (Task_function::Task_function): Assert that there is
7902         a blocker.
7903
7904 2010-02-22  Doug Kwan  <dougkwan@google.com>
7905
7906         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7907         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7908         types to avoid warnings due to different uint64_t implementations
7909         on different hosts.
7910
7911 2010-02-21  Doug Kwan  <dougkwan@google.com>
7912
7913         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7914         handling of the maximum backward branch offset.
7915         (Arm_relocate_functions::thumb_branch_common): Ditto.
7916         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7917         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7918         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7919         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7920         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7921         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7922         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7923         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7924         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7925         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7926         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7927         thumb2_bl_out_of_range.o): New rules.
7928         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7929         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7930         thumb2_bl_out_of_range
7931         * testsuite/Makefile.in: Regenerate.
7932         * testsuite/arm_bl_in_range.s: New file.
7933         * testsuite/arm_bl_out_of_range.s: Ditto.
7934         * testsuite/arm_branch_in_range.sh: Ditto.
7935         * testsuite/arm_branch_range.t: Ditto.
7936         * testsuite/thumb2_branch_range.t: Ditto.
7937         * testsuite/thumb_bl_in_range.s: Ditto.
7938         * testsuite/thumb_bl_out_of_range.s: Ditto.
7939         * testsuite/thumb_branch_range.t: Ditto.
7940
7941 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7942
7943         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7944         Add reloc offset information.
7945         * icf.cc (get_section_contents): Change iterators to point to the new
7946         vectors. Add reloc offset information to the contents.
7947         * icf.h (Icf::Sections_reachable_info): New typedef.
7948         (Icf::Sections_reachable_list): New typedef.
7949         (Icf::Offset_info): New typedef.
7950         (Icf::Reloc_info): New struct typedef.
7951         (Icf::Reloc_info_list): New typedef.
7952         (Icf::symbol_reloc_list): Delete method.
7953         (Icf::addend_reloc_list): Delete method.
7954         (Icf::section_reloc_list): Delete method.
7955         (Icf::reloc_info_list): New method.
7956         (Icf::reloc_info_list_): New member.
7957
7958 2010-02-19  Doug Kwan  <dougkwan@google.com>
7959
7960         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7961         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7962         * arm.cc (Arm_relocation_functions): New forward declaration.
7963         (Target_arm::Target_arm): Initialize new data members
7964         got_mod_index_offset_ and tls_base_symbol_defined_.
7965         (Target_arm::Relocate::relocate_tls): New method.
7966         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7967          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7968         New methods.
7969         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7970         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7971         (Target_arm::got_mod_index_offset_,
7972         Target_arm::tls_base_symbol_defined_): New data members.
7973         (Target_arm::Scan::local, Target::Scan::global,
7974         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7975         relocations.
7976
7977 2010-02-18  Doug Kwan  <dougkwan@google.com>
7978
7979         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7980         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7981         text section as a parameter becuase some broken tools may not set
7982         the link in section header.
7983         (Target_arm::has_got_section): New method.
7984         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7985         without any mapping symbol as data only.  Remove warning.
7986         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7987         link in its section header, try to discover the link by inspecting the
7988         REL31 relocation at the beginning of the section.
7989         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7990         in error message.
7991         (Target_arm::Scan::global): Treat any reference to the symbol
7992         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7993
7994 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7995
7996         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7997         (Scan::global_reloc_may_be_function_pointer): New function.
7998         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7999         (Scan::global_reloc_may_be_function_pointer): New function.
8000         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8001         (Scan::global_reloc_may_be_function_pointer): New function.
8002         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8003         (Scan::global_reloc_may_be_function_pointer): New function.
8004         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8005         (Scan::global_reloc_may_be_function_pointer): New function.
8006         (Scan::possible_function_pointer_reloc): New function.
8007         (Target_x86_64::can_check_for_function_pointers): New function.
8008         * gc.h (gc_process_relocs): Scan relocation types to determine if
8009         function pointers were taken for targets that support it.
8010         * icf.cc (Icf::find_identical_sections): Include functions for
8011         folding in safe ICF whose pointer is not taken.
8012         * icf.h (Secn_fptr_taken_set): New typedef.
8013         (fptr_section_id_): New member.
8014         (section_has_function_pointers): New function.
8015         (set_section_has_function_pointers): New function.
8016         (check_section_for_function_pointers): New function.
8017         * options.h: Fix comment for safe ICF option.
8018         * target.h (can_check_for_function_pointers): New function.
8019         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8020         Modify icf_safe_test for X86-64.
8021         * testsuite/Makefile.in: Regenerate.
8022         * testsuite/icf_safe_so_test.cc: New file.
8023         * testsuite/icf_safe_so_test.sh: New file.
8024         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8025         (main): Change to take pointer to function kept_func_3.
8026         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8027         folding is done correctly for X86-64.
8028
8029 2010-02-12  David S. Miller  <davem@davemloft.net>
8030
8031         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8032         is_symbolless parameter.
8033         (Output_reloc<SHT_REL>::is_symbolless): New.
8034         (Output_reloc<SHT_REL>::is_symbolless_): New.
8035         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8036         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8037         (Output_reloc<SHT_RELA>::is_symbolless): New.
8038         (Output_data_reloc::add_global): Handle is_symbolless.
8039         (Output_data_reloc::add_global_relative): Likewise.
8040         (Output_data_reloc::add_local): Likewise.
8041         (Output_data_reloc::add_local_relative): Likewise.
8042         (Output_data_reloc::add_symbolless_global_addend): New.
8043         (Output_data_reloc::add_symbolless_local_addend): New.
8044         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8045         is_symbolless.
8046         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8047         instead of ->is_relative_
8048         (Output_reloc::write): Likewise.
8049         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8050         (Output_reloc::write_rel): Simplify.
8051
8052         * sparc.cc (Target_sparc::Scan::local): Use
8053         ->add_symbolless_local_addend as needed.
8054         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8055         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8056         based upon relocation offset.
8057
8058 2010-02-11  Doug Kwan  <dougkwan@google.com>
8059
8060         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8061         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8062         beginning of function.
8063         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8064         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8065         parameter is_32bit in calls to should_apply_static_reloc.
8066         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8067         (check_DATA): Add arm_abs_global.stdout.
8068         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8069         arm_abs_global.stdout): New rules.
8070         (MOSTLLYCLEANFILES): Add arm_abs_global
8071         * Makefile.in: Regenerate.
8072         * testsuite/arm_abs_global.s: New file.
8073         * testsuite/arm_abs_global.sh: Ditto.
8074         * testsuite/arm_abs_lib.s: Ditto.
8075
8076 2010-02-11  Ian Lance Taylor  <iant@google.com>
8077
8078         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8079         Read_relocs task.
8080         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8081         Allocate_commons_task first.
8082         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8083         task, rather than symtab_lock_.
8084         (Gc_process_relocs::~Gc_process_relocs): New function.
8085         (Gc_process_relocs::is_runnable): Check this_blocker_.
8086         (Gc_process_relocs::locks): Use next_blocker_ rather than
8087         blocker_.
8088         (Scan_relocs::~Scan_relocs): New function.
8089         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8090         symtab_lock_.
8091         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8092         next_blocker_.
8093         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8094         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8095         constructor accordingly.
8096         (class Gc_process_relocs): Likewise.
8097         (class Scan_relocs): Likewise.
8098         * common.h (class Allocate_commons_task): Remove symtab_lock_
8099         field, and corresponding constructor parameter.
8100         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8101         symtab_lock_.
8102         (Allocate_commons_task::locks): Likewise.
8103
8104 2010-02-11  Ian Lance Taylor  <iant@google.com>
8105
8106         * gold-threads.h (class Once): Define.
8107         (class Initialize_lock): Rewrite as child of Once.
8108         * gold-threads.cc (class Once_initialize): Define.
8109         (once_pointer_control): New static variable.
8110         (once_pointer, once_arg): New static variables.
8111         (c_run_once): New static function.
8112         (Once::Once, Once::run_once, Once::internal_run): New functions.
8113         (class Initialize_lock_once): Remove.
8114         (initialize_lock_control): Remove.
8115         (initialize_lock_pointer): Remove.
8116         (initialize_lock_once): Remove.
8117         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8118         (Initialize_lock::initialize): Rewrite.
8119         (Initialize_lock::do_run_once): New function.
8120         * archive.cc (Archive::interpret_header): Only clear name if it is
8121         not already empty.
8122         * fileread.cc: Include "gold-threads.h"
8123         (file_counts_lock): New static variable.
8124         (file_counts_initialize_lock): Likewise.
8125         (File_read::release): Only increment counts when using --stats.
8126         Use a lock around the increment.
8127         * parameters.cc (class Set_parameters_target_once): Define.
8128         (set_parameters_target_once): New static variable.
8129         (Parameters::Parameters): Move here from parameters.h.
8130         (Parameters::set_target): Rewrite.
8131         (Parameters::set_target_once): New function.
8132         (Parameters::clear_target): Move here and rewrite.
8133         * parameters.h (class Parameters): Update declarations.  Add
8134         set_parameters_target_once_ field.
8135         (Parameters::Parameters): Move to parameters.cc.
8136         (Parameters::clear_target): Likewise.
8137         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8138         task.
8139         (Start_group::~Start_group): New function.
8140         (Start_group::is_runnable): New function.
8141         (Start_group::locks, Start_group::run): New functions.
8142         (Finish_group::run): Change saw_undefined to size_t.
8143         * readsyms.h (class Start_group): Define.
8144         (class Finish_group): Change saw_undefined_ field to size_t.
8145         (Finish_group::Finish_group): Remove saw_undefined and
8146         this_blocker parameters.  Change all callers.
8147         (Finish_group::set_saw_undefined): New function.
8148         (Finish_group::set_blocker): New function.
8149         * symtab.h (class Symbol_table): Change saw_undefined to return
8150         size_t.  Change saw_undefined_ field to size_t.
8151         * target-select.cc (Set_target_once::do_run_once): New function.
8152         (Target_selector::Target_selector): Initialize set_target_once_
8153         field.  Don't initialize lock_ and initialize_lock_ fields.
8154         (Target_selector::instantiate_target): Rewrite.
8155         (Target_selector::set_target): New function.
8156         * target-select.h (class Set_target_once): Define.
8157         (class Target_selector): Update declarations.  Make
8158         Set_target_once a friend.  Remove lock_ and initialize_lock_
8159         fields.  Add set_target_once_ field.
8160
8161 2010-02-10  Ian Lance Taylor  <iant@google.com>
8162
8163         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8164         queueing any tasks.
8165         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8166         (queue_middle_tasks): Add all blockers before queueing any tasks.
8167         (queue_final_tasks): Likewise.
8168         * token.h (Task_token::add_blockers): New function.
8169         * object.h (Input_objects::number_of_relobjs): New function.
8170
8171 2010-02-10  Ian Lance Taylor  <iant@google.com>
8172
8173         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8174         shared, not if not position independent.
8175         * x86_64.cc (Relocate::relocate_tls): Likewise.
8176         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8177         (tls_pie_pic_test): New target.
8178         * testsuite/Makefile.in: Rebuild.
8179
8180         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8181         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8182         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8183         * testsuite/Makefile.in: Rebuild.
8184
8185 2010-02-09  David S. Miller  <davem@davemloft.net>
8186
8187         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8188         R_SPARC_RELATIVE using ->add_local_relative().
8189         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8190
8191         * output.h (Output_data_dynamic::add_section_size): New method
8192         that takes two Output_data objects.
8193         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8194         entry param.  Handle it in initializers.
8195         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8196         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8197         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8198         arg.
8199         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8200         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8201         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8202         for dynrel_includes_plt.
8203         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8204         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8205         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8206         before .rela.plt
8207         (Target_sparc::do_finalize_sections): Update to pass true for
8208         dynrel_includes_plt.
8209         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8210         output before .rela.plt
8211         (Target_powerpc::do_finalize_sections): Update to pass true for
8212         dynrel_includes_plt when 32-bit.
8213
8214 2010-02-08  Doug Kwan  <dougkwan@google.com>
8215
8216         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8217         method.
8218         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8219         Arm_relobj::scan_section_for_cortex_a8_stubs,
8220         Arm_relobj::do_relocation_section): Instead of calling
8221         Output_section::output_address, use faster
8222         Arm_relobj::simple_input_section_output_address.
8223
8224 2010-02-08  David S. Miller  <davem@davemloft.net>
8225
8226         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8227         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8228         relocation helper function.
8229
8230         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8231         just like R_SPARC_GOT{10,13,22}.
8232         (Target_sparc::Scan::local): Likewise.
8233         (Target_sparc::Relocate:relocate): Likewise.
8234
8235 2010-02-06  Ian Lance Taylor  <iant@google.com>
8236
8237         * configure.ac: Rewrite targetobjs duplicate removal code to use
8238         only shell constructs.
8239         * configure: Rebuild.
8240
8241 2010-02-05  Doug Kwan  <dougkwan@google.com>
8242
8243         PR 11247
8244         * arm.cc (Arm_relobj::section_is_scannable): New method.
8245         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8246         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8247
8248 2010-02-04  Doug Kwan  <dougkwan@google.com>
8249
8250         PR 11247
8251         * arm-reloc-property.cc (cstdio): Include.
8252         * configure.ac (targetobjs): Remove duplicates.
8253         * configure: Regenerate.
8254         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8255         big and little endian version for a given address size.
8256
8257 2010-02-03  Doug Kwan  <dougkwan@google.com>
8258
8259         * arm-reloc-property.cc
8260         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8261         definition.
8262         * arm-reloc-property.h
8263         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8264         New method definition.
8265         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8266         declaration.
8267         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8268         overflow to N.
8269         (GOT_PREL): Change implemented to Y.
8270         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8271         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8272         (Arm_relocate_functions::movw_abs_nc): Remove method.
8273         (Arm_relocate_functions::movt_abs): Ditto.
8274         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8275         (Arm_relocate_functions::thm_movt_abs): Ditto.
8276         (Arm_relocate_functions::movw_rel_nc): Ditto.
8277         (Arm_relocate_functions::movw_rel): Ditto.
8278         (Arm_relocate_functions::movt_rel): Ditto.
8279         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8280         (Arm_relocate_functions:thm_movw_rel): Ditto.
8281         (Arm_relocate_functions:thm_movt_rel): Ditto.
8282         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8283         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8284         New method definitions.
8285         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8286         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8287         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8288         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8289         (Target_arm::Relocate::relocate): Check for non-static or
8290         unimplemented relocation code and exit early.  Change calls to
8291         Target_arm::reloc_uses_thumb_bit and
8292         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8293         instead.  Refactor code to handle similar relocations to increase
8294         code sharing.  Remove check for unsupported relocation code in switch
8295         statement.
8296         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8297         relocation property table to find out size.  Change error message to
8298         print out the name of a relocation code instead of the numeric value.
8299         (Target_arm::scan_reloc_for_stub): Use relocation property table
8300         instead of calling Target_arm::reloc_uses_thumb_bit().
8301
8302 2010-02-02  Doug Kwan  <dougkwan@google.com>
8303
8304         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8305         types of relaxed input section.
8306
8307 2010-02-02  Doug Kwan  <dougkwan@google.com>
8308
8309         * Makefile.am (HFILES): Add arm-reloc-property.h.
8310         (DEFFILES): New.
8311         (TARGETSOURCES): Add arm-reloc-property.cc
8312         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8313         (libgold_a_SOURCES): $(DEFFILES)
8314         * Makefile.in: Regenerate.
8315         * arm-reloc-property.cc: New file.
8316         * arm-reloc-property.h: New file.
8317         * arm-reloc.def: New file.
8318         * arm.cc: Update comments.
8319         (arm-reloc-property.h): New included header.
8320         (arm_reloc_property_table): New global variable.
8321         (Target_arm::do_select_as_default_target): New method definition.
8322         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8323         arm-reloc-property to targ_extra_obj.
8324         * parameters.cc (set_parameters_target): Call
8325         Target::select_as_default_target().
8326         * target.h (Target::select_as_default_target): New method definition.
8327         (Target::do_select_as_default_target): Same.
8328
8329 2010-02-01  Doug Kwan  <dougkwan@google.com>
8330
8331         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8332         first_output_text_section_.
8333         (Arm_exidx_fixup::first_output_text_section): New method definition.
8334         (Arm_exidx_fixup::first_output_text_section_): New data member.
8335         (Arm_exidx_fixup::process_exidx_section): Record the first text
8336         output section seen.
8337         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8338         and entsize in output section header.
8339
8340 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8341
8342         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8343         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8344         (Arm_relocate_functions::thm_alu11): New Method.
8345         (Arm_relocate_functions::thm_pc8): New Method.
8346         (Arm_relocate_functions::thm_pc12): New Method.
8347         (Target_arm::Scan::local): Handle the relocations.
8348         (Target_arm::Scan::global): Likewise.
8349         (Target_arm::Relocate::relocate): Likewise.
8350         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8351
8352 2010-01-29  Doug Kwan  <dougkwan@google.com>
8353
8354         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8355         of relocation types as ld.
8356
8357 2010-01-29  Doug Kwan  <dougkwan@google.com>
8358
8359         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8360         to public.
8361         (Arm_relocate_functions::thumb_branch_common): Ditto.
8362         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8363         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8364         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8365         Arm_relocate_functions::jump24): Remove.
8366         (Target_arm::Relocate::relocate): Adjust code to call
8367         Arm_relocation_functions::arm_branch_common and
8368         Arm_relocation_functions::thumb_branch_common instead of their removed
8369         wrappers.  Merge switch-cases together to reduce source code size.
8370
8371 2010-01-29  Doug Kwan  <dougkwan@google.com>
8372
8373         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8374         output_local_symbol_count_needs_update_.
8375         (Arm_relobj::output_local_symbol_count_needs_update,
8376          Arm_relobj::set_output_local_symbol_count_needs_update,
8377          Arm_relobj::update_output_local_symbol_count): New methods.
8378         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8379         member.
8380         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8381         of pointed function as in a R_ARM_PREL31 relocation.
8382         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8383         for output local symbol count updating.
8384         (Target_arm::do_relax): Update output local symbol counts in objects
8385         if necessary.
8386         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8387
8388 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8389
8390         * arm.cc: Added support for the ARM relocations:
8391         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8392         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8393         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8394         movw_prel_nc).
8395         (Arm_relocate_functions::movw_rel): New method.
8396         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8397         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8398         thm_movw_prel_nc).
8399         (Arm_relocate_functions::thm_movw_rel): New method.
8400         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8401         thm_movt_prel).
8402         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8403         relocations.
8404         (Target_arm::Scan::global): Likewise.
8405         (Target_arm::Relocate::relocate): Likewise.
8406         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8407         Likewise.
8408
8409 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8410
8411         * arm.cc: Added support for ARM group relocations.
8412         (Target_arm::reloc_needs_sym_origin): New method.
8413         (Arm_relocate_functions::calc_grp_kn): New method.
8414         (Arm_relocate_functions::calc_grp_residual): New method.
8415         (Arm_relocate_functions::calc_grp_gn): New method.
8416         (Arm_relocate_functions::arm_grp_alu): New Method.
8417         (Arm_relocate_functions::arm_grp_ldr): New Method.
8418         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8419         (Arm_relocate_functions::arm_grp_ldc): New Method.
8420         (Target_arm::Scan::local): Handle the ARM group relocations.
8421         (Target_arm::Scan::global): Likewise.
8422         (Target_arm::Relocate::relocate): Likewise.
8423         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8424         Likewise.
8425
8426 2010-01-26  Doug Kwan  <dougkwan@google.com>
8427
8428         * arm.cc (set): Include.
8429         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8430         pointer type.
8431         (Arm_output_section::Text_section_list): New type.
8432         (Arm_output_section::append_text_sections_to_list): New method.
8433         (Arm_output_section::fix_exidx_coverage): Ditto.
8434         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8435         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8436         Relobj::set_section_offset() instead of
8437         Sized_relobj::invalidate_section_offset().
8438         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8439         parameter for section headers. Ignore relocation sections for
8440         unallocated sections and EXIDX sections.
8441         (Target_arm::fix_exidx_coverage): New method.
8442         (Target_arm::output_section_address_less_than): New type.
8443         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8444         linked text section instead of the EXIDX section.
8445         (Arm_output_section::create_stub_group): Add an assertion to check
8446         that this is not an EXIDX output section.
8447         (Arm_output_section::append_text_sections_to_list): New method.
8448         (Arm_output_section::fix_exidx_coverage): Ditto.
8449         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8450         Arm_relobj::section_needs_reloc_stub_scanning.
8451         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8452         first pass.
8453         (Target_arm::fix_exidx_coverage): New method.
8454         * object.h (Relobj::set_output_section): New method.
8455         (Sized_relobj::invalidate_section_offset): Remove method.
8456         (Sized_relobj::do_invalidate_section_offset): Remove method.
8457         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8458
8459 2010-01-25  Doug Kwan  <dougkwan@google.com>
8460
8461         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8462         Fix warning due to signed and unsigned comparison on a 32-bit host.
8463
8464 2010-01-22  Doug Kwan  <dougkwan@google.com>
8465
8466         * arm.cc (Target_arm::do_relax): Record an output section for section
8467         offset adjustment it contains any stub table that has changed.
8468         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8469         offsets in an output section if necessary.
8470         * output.cc (Output_section::Output_section): Initialize
8471         section_offsets_need_adjustments_.
8472         (Output_section::add_input_section_for_script): Renamed to
8473         Output_section::add_simple_input_section.
8474         (Output_section::save_states): Add a comment.
8475         (Output_section::discard_states): New method defintion.
8476         (Output_section::adjust_section_offsets): Same.
8477         * output.h (Output_section::add_input_section_for_script): Renamed to
8478         Output_section::add_simple_input_section.
8479         (Output_section::discard_states): New method declaration.
8480         (Output_section::adjust_section_offsets): Same.
8481         (Output_section::section_offsets_need_adjustment,
8482         Output_section::set_section_offsets_need_adjustment): New method
8483         definitions.
8484         (Output_section::section_offsets_need_adjustment_): New data member.
8485         * script-sections.cc
8486         (Output_section_element_input::set_section_address): Adjust code for
8487         renaming of Output_section::add_input_section_for_script.
8488         (Orphan_output_section::set_section_address): Same.
8489
8490 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8491
8492         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8493         Fix_v4bx enum values .
8494         * gold/options.h (General_options): New option definitions.
8495         (General_options::fix_v4bx): New method.
8496         (General_options::Fix_v4bx): New enum.
8497         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8498         (General_options::parse_fix_v4bx_interworking): New method.
8499
8500 2010-01-22  Doug Kwan  <dougkwan@google.com>
8501
8502         * arm.cc (Arm_exidx_fixup): New class.
8503
8504 2010-01-21  Doug Kwan  <dougkwan@google.com>
8505
8506         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8507         classes.
8508         (Arm_exidx_section_offset_map): New type.
8509
8510 2010-01-21  Doug Kwan  <dougkwan@google.com>
8511
8512         * arm.cc (Arm_exidx_input_section): New class.
8513         (Arm_relobj::exidx_input_section_by_link,
8514         Arm_relobj::exidx_input_section_by_shndx,
8515         Arm_relobj::make_exidx_input_section): New methods.
8516         (read_arm_attributes_section): Remove.
8517         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8518         information about them.
8519         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8520         to here.
8521
8522 2010-01-20  Doug Kwan  <dougkwan@google.com>
8523
8524         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8525         Input_section_specifier to Section_id.
8526         (Target_arm::new_arm_input_section: Adjust code for change of key
8527         type.
8528         (Target_arm::find_arm_input_section): Ditto.
8529         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8530         (Section_id): Remove.
8531         (Garbage_collection::Section_id_hash): Remove.
8532         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8533         (Section_id): Remove.
8534         (Icf::Section_id_hash): Remove.
8535         * object.h (Section_id, Const_section_id, Section_id_hash,
8536         Const_section_id_hash): New type definitions.
8537         * output.cc (Output_section::add_relaxed_input_section): Change to
8538         use Const_section_id instead of Input_section_specifier as key type.
8539         (Output_section::add_merge_input_section): Ditto.
8540         (Output_section::build_relaxation_map): Change to use Section_id
8541         instead of Input_section_specifier as key type.
8542         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8543         Ditto.
8544         (Output_section::convert_input_sections_to_relaxed_sections): Change
8545         to use Const_section_id instead of Input_section_specifier as key type.
8546         (Output_section::find_merge_section): Ditto.
8547         (Output_section::find_relaxed_input_section): Ditto.
8548         * output.h (Input_section_specifier): Remove class.
8549         (Output_section::Output_section_data_by_input_section_map): Change
8550         key type to Const_section_id.
8551         (Output_section::Output_relaxed_input_section_by_input_section_map):
8552         Ditto.
8553         (Output_section::Relaxation_map): Change key type to Section_id.
8554
8555 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8556
8557         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8558         (class Arm_v4bx_stub): New class.
8559         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8560         (Stub_factory::make_arm_v4bx_stub): New method.
8561         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8562         (Stub_table::empty): Handle v4bx stubs.
8563         (Stub_table::add_arm_v4bx_stub): New method.
8564         (Stub_table::find_arm_v4bx_stub): New method.
8565         (Arm_relocate_functions::v4bx): New method.
8566         (Target_arm::fix_v4bx): New method.
8567         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8568         (Stub_table::relocate_stubs): Likewise.
8569         (Stub_table::do_write): Likewise.
8570         (Stub_table::update_data_size_and_addralign): Likewise.
8571         (Stub_table::finalize_stubs):  Likewise.
8572         (Target_arm::Scan::local): Likewise.
8573         (Target_arm::Scan::global): Likewise.
8574         (Target_arm::do_finalize_sections): Likewise.
8575         (Target_arm::Relocate::relocate): Likewise.
8576         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8577         Likewise.
8578         (Target_arm::scan_reloc_for_stub): Likewise.
8579         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8580
8581 2010-01-19  Ian Lance Taylor  <iant@google.com>
8582
8583         * output.cc (Output_section_headers::do_sized_write): Write large
8584         segment count to sh_info field.
8585         (Output_file_header::do_sized_write): For large segment count,
8586         write PN_XNUM to e_phnum field.
8587
8588 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8589
8590         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8591         (Arm_relocate_functions::thm_jump8): New function.
8592         (Arm_relocate_functions::thm_jump11): New function.
8593         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8594         R_ARM_THM_JUMP11.
8595         (Target_arm::Scan::global): Likewise.
8596         (Target_arm::Relocate::relocate): Likewise.
8597         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8598         Likewise.
8599
8600 2010-01-14  Doug Kwan  <dougkwan@google.com>
8601
8602         * arm.cc (map, utility): Include headers.
8603         (Target_arm::apply_cortex_a8_workaround): New method.
8604         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8605         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8606         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8607         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8608         the --[no-]fix-cortex-a8 command line options.
8609         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8610         (Target_arm::relocate_stub): Use addend in instruction template.
8611         * options.h (DEFINE_bool): Set the user-set flag.
8612         (General_options): Add --[no-]-fix-cortex options.
8613         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8614         : Update fast look-up map after conversion.
8615
8616 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8617
8618         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8619         in the first pass of do_layout.
8620
8621 2010-01-13  Doug Kwan  <dougkwan@google.com>
8622
8623         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8624         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8625         apparent compiler problem of not folding static constant integral
8626         data members of elfcpp::Elf_sizes<32>.
8627
8628 2010-01-13  Doug Kwan  <dougkwan@google.com>
8629
8630         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8631         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8632         Arm_relobj::scan_section_for_cortex_a8_erratum,
8633         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8634         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8635         sections to scan for relocation stubs into a new method
8636         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8637         relocation and Cortex-A8 stub scanning.
8638         (Target_arm::do_relax): Force stubs to be after stubbed sections
8639         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8640         the beginning of a new relaxation pass.  Update a comment.
8641         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8642
8643 2010-01-12  Ian Lance Taylor  <iant@google.com>
8644
8645         * target-reloc.h (visibility_error): New inline function.
8646         (relocate_section): Call visibility_error.
8647         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8648         (MOSTLYCLEANFILES): Likewise.
8649         (protected_4_pic.o, protected_3.err): New targets.
8650         * testsuite/protected_4.cc: New file.
8651
8652 2010-01-12  Doug Kwan  <dougkwan@google.com>
8653
8654         * arm.cc (Cortex_a8_reloc): New class.
8655         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8656         and cortex_a8_relocs_info_.
8657         (Target_arm::fix_cortex_a8): New method definition.
8658         (Target_arm::Cortex_a8_relocs_info): New type.
8659         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8660         New data member declarations.
8661         (Target_arm::scan_reloc_for_stub): Record information about
8662         relocations for THUMB branches that might be exempted from the
8663         Cortex-A8 workaround.
8664         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8665         at the beginning of a relaxation pass.
8666
8667 2010-01-12  Doug Kwan  <dougkwan@google.com>
8668
8669         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8670         (Arm_relobj::Mapping_symbol_position,
8671          Arm_reloj::Mapping_symbol_position_less,
8672          Arm_relobj::Mapping_symbols_info): New types.
8673         (Target_arm::is_mapping_symbol_name): New method definition.
8674         (Arm_relobj::do_count_local_symbols): Save information about mapping
8675         symbols.
8676
8677 2010-01-11  Doug Kwan  <dougkwan@google.com>
8678
8679         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8680         Arm_relocate_functions::thumb32_branch_upper,
8681         Arm_relocate_functions::thumb32_branch_lower,
8682         Arm_relocate_functions::thumb32_cond_branch_offset,
8683         Arm_relocate_functions::thumb32_cond_branch_upper,
8684         Arm_relocate_functions::thumb32_cond_branch_lower,
8685         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8686         branch offset encoding.
8687         (Arm_relocate_functions::thumb_branch_common): Use new branch
8688         offset encoding methods to avoid code duplication.
8689         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8690         (Stub_addend_reader::operator()): Use new branch encoding method
8691         to avoid code duplication.
8692
8693 2010-01-11  Doug Kwan  <dougkwan@google.com>
8694
8695         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8696         (Target_arm::do_finalize_sections): Define special EXIDX section
8697         symbols only if referenced.
8698         * gc.h (Garbage_collection::add_reference): New method.
8699         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8700         code duplication.
8701
8702 2010-01-11  Ian Lance Taylor  <iant@google.com>
8703
8704         * script.cc (Version_script_info::build_expression_list_lookup):
8705         Change complaing about duplicate wildcard match from error to
8706         warning.
8707
8708         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8709         of 2009-12-30.
8710         (Version_script_info::Version_script_info): Initialize globs_,
8711         default_version_, default_is_global_, and exact_.  Don't
8712         initialize globals_ or locals_.
8713         (Version_script_info::build_lookup_tables): Build local symbols
8714         first.
8715         (Version_script_info::unquote): New function.
8716         (Version_script_info::add_exact_match): New function.
8717         (Version_script_info::build_expression_list_lookup): Remove lookup
8718         parameter.  Add is_global parameter.  Change all callers.  Handle
8719         wildcard pattern specially.  Unquote pattern.  Call
8720         add_exact_match.
8721         (Version_script_info::get_name_to_match): New function.
8722         (Version_script_info::get_symbol_version): New function.
8723         (Version_script_info::get_symbol_version_helper): Remove.
8724         (Version_script_info::check_unmatched_names): Call unquote.
8725         * script.h (class Version_script_info): Change get_symbol_version
8726         to be non-inline and add is_global parameter; change all callers.
8727         Rewrite symbol_is_local.  Update declarations.  Define struct
8728         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8729         Remove globals_ and locals_ members.  Add exact_, globs_,
8730         default_version_, is_global_.
8731         (Version_script_info::Glob): Remove pattern, add expression and
8732         is_global.  Update constructor.  Change all callers.
8733         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8734         default version.
8735         (Versions::symbol_section_contents): If a symbol is undefined, or
8736         defined in a dynamic object, set the version index to
8737         VER_NDX_LOCAL.
8738         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8739         symbol_is_local.
8740         (Symbol_table::add_from_pluginobj): Likewise.
8741         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8742
8743 2010-01-11  Doug Kwan  <dougkwan@google.com>
8744
8745         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8746         (incremental_dump_LDADD): Add linking option for libintl.
8747         * Makefile.in: Regenerate.
8748
8749 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8750
8751         PR gold/11144
8752         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8753         instead of -Ds.
8754         * testsuite/Makefile.in: Regenerated.
8755
8756 2010-01-10  Doug Kwan  <dougkwan@google.com>
8757
8758         * options.h (DEFINE_var): Use parentheses around argument varname__
8759         in macro body to avoid any unintended subsequent substitutions.
8760
8761 2010-01-10  Ian Lance Taylor  <iant@google.com>
8762
8763         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8764         candidates before doing symbol resolution.
8765
8766         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8767         ODR candidates if only one is weak.
8768
8769 2010-01-08  Ian Lance Taylor  <iant@google.com>
8770
8771         * script.cc (Version_script_info::build_expression_list_lookup):
8772         Don't warn about ambiguous version, just record the ambiguity.
8773         (Version_script_info::get_symbol_version_helper): Give error if
8774         version is ambiguous.
8775
8776 2010-01-08  Doug Kwan  <dougkwan@google.com>
8777
8778         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8779         prev_data_size_ and prev_addralign_.  Remove initializer for
8780         deleted data member has_been_changed_.
8781         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8782         to determine if the table is empty.
8783         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8784         Remove.
8785         (Stub_table::add_reloc_stub): Define method in class definition
8786         instead of just declaring it there.
8787         (Stub_table::add_cortex_a8_stub): New method definition.
8788         (Stub_table::update_data_size_and_addralign): Ditto.
8789         (Stub_table::finalize_stubs): Ditto.
8790         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8791         (Stub_table::do_addralign_): Return address alignment in the
8792         (Stub_table::do_reset_address_and_file_offset): Define method in
8793         class definition instead of declaring it there.  Set current data
8794         size to be the data size of the previous pass.
8795         (Stub_table::set_final_data_size): Use current data size as the
8796         final data size.
8797         (Stub_table::relocate_stub): Change parameter type of stub from
8798         Reloc_stub pointer to Stub pointer.
8799         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8800         (Stub_table::Cortex_a8_stub_list): New typedef.
8801         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8802          Stub_table::prev_addralign_): New data member.
8803         (Arm_relobj::Arm_relobj): Initialize data member
8804         section_has_cortex_a8_workaround_.
8805         (Arm_relobj::section_has_cortex_a8_workaround,
8806          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8807          definitions.
8808         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8809         declarations.
8810         (Target_arm::relocate_stub): Change parameter type of stub from
8811         Reloc_stub pointer to Stub pointer.
8812         (Insn_template::size, Insn_template::alignment): Handle
8813         THUMB16_SPECIAL_TYPE.
8814         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8815          Stub_table::update_data_size_and_addralign,
8816          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8817         definitions.
8818         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8819         (Stub_table::do_write): Ditto.
8820         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8821
8822 2010-01-08  Ian Lance Taylor  <iant@google.com>
8823
8824         PR 11108
8825         * symtab.h (class Symbol): Remove fields is_target_special_ and
8826         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8827         (Symbol::is_defined_in_discarded_section): New function.
8828         (Symbol::set_is_defined_in_discarded_section): New function.
8829         (Symbol::has_plt_offset): Rewrite.
8830         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8831         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8832         Don't initialize is_target_special_ or has_plt_offset_.
8833         Initialize is_defined_in_discarded_section_.
8834         (Symbol_table::add_from_relobj): If appropriate, set
8835         is_defined_in_discarded_section.
8836         * resolve.cc (Symbol::override_base_with_special): Don't test
8837         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8838         * target-reloc.h (relocate_section): Do special handling for
8839         symbols defined in discarded sections for global symbols as well
8840         as local symbols.
8841
8842 2010-01-08  Ian Lance Taylor  <iant@google.com>
8843
8844         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8845         the SHT_SYMTAB case.
8846
8847 2010-01-08  Ian Lance Taylor  <iant@google.com>
8848
8849         * object.cc (Sized_relobj::do_layout): Don't get confused if
8850         layout_eh_frame returns NULL.
8851
8852 2010-01-08  Ian Lance Taylor  <iant@google.com>
8853
8854         PR 11084
8855         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8856         dynamic symbol table, use the normal symbol table.
8857         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8858         symbol table.
8859
8860 2010-01-08  Ian Lance Taylor  <iant@google.com>
8861
8862         PR 11072
8863         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8864         sections.
8865
8866 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8867
8868         * version.cc (print_version): Change to "Copyright 2010".
8869
8870 2010-01-08  Ian Lance Taylor  <iant@google.com>
8871
8872         PR 10287
8873         PR 11063
8874         * i386.cc (class Target_i386): Change return type of plt_section
8875         to be non-const.
8876         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8877         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8878         tls_desc_rel_ field.
8879         (Output_data_plt_i386::rel_tls_desc): New function.
8880         (Target_i386::rel_tls_desc_section): New function.
8881         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8882         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8883         R_386_TLS_DESC reloc in rel_tls_desc_section.
8884         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8885         Define struct Tlsdesc_info.
8886         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8887         (Target_x86_64::do_reloc_symbol_index): New function.
8888         (Target_x86_64::add_tlsdesc_info): New function.
8889         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8890         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8891         tlsdesc_rel_ field.
8892         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8893         all callers.
8894         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8895         (Target_x86_64::rela_tlsdesc_section): New function.
8896         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8897         handling.
8898         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8899         (Target_x86_64::do_reloc_addend): New function.
8900         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8901         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8902         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8903         (Output_reloc::type): New function.
8904         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8905         (Output_reloc::is_target_specific): New function.
8906         (Output_reloc::target_arg): New function.
8907         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8908         absolute relocs and target specific relocs.
8909         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8910         add_target_specific.
8911         (class Output_data_reloc) [SHT_RELA]: Likewise.
8912         * output.cc (Output_reloc::Output_reloc): Add four new versions
8913         for absolute relocs and target specific relocs.
8914         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8915         (Output_reloc::get_symbol_index): Likewise.
8916         (Output_reloc::local_section_offset): Check that local_sym_index_
8917         is not TARGET_CODE or 0.
8918         (Output_reloc::symbol_value): Likewise.
8919         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8920         reloc.
8921         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8922         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8923         functions.
8924         * layout.cc (add_target_dynamic_tags): Use output section for
8925         DT_PLTRELSZ and DT_JMPREL.
8926
8927 2010-01-07  Ian Lance Taylor  <iant@google.com>
8928
8929         PR 11061
8930         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8931         function.
8932         (class Output_data_reloc_generic): Define.
8933         (class Output_data_reloc_base): Change base class to
8934         Output_data_reloc_generic.  Change add() method to call
8935         bump_relative_reloc_count for a relative reloc.  Remove
8936         sort_relocs_ field.
8937         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8938         to sort_relocs().
8939         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8940         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8941         appropriate.
8942         * layout.h (class Layout): Update declaration.
8943
8944 2010-01-07  Ian Lance Taylor  <iant@google.com>
8945
8946         * output.h (class Output_data): Add const version of
8947         output_section and do_output_section.
8948         (class Output_section_data): Add const version of
8949         do_output_section.
8950         (class Output_section): Likewise.
8951         * layout.cc (Layout::add_target_dynamic_tags): New function.
8952         * layout.h (class Layout): Update declarations.
8953         * arm.cc (Target_arm::do_finalize_sections): Use
8954         add_target_dynamic_tags.
8955         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8956         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8957         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8958         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8959
8960 2010-01-07  Ian Lance Taylor  <iant@google.com>
8961
8962         PR 11042
8963         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8964         object as needed.
8965
8966 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8967             Ian Lance Taylor  <iant@google.com>
8968
8969         PR 11019
8970         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8971         Xindex::read_symtab_xindex.
8972
8973 2010-01-07  Doug Kwan  <dougkwan@google.com>
8974
8975         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8976         (Insn_template::thumb16_bcond_insn): New method declaration.
8977         (Insn_template): Fix spelling.
8978         (Stub::thumb16_special): New method declaration.
8979         (Stub::do_write): Define virtual method which was previously pure
8980         virtual.
8981         (Stub::do_thumb16_special): New method declaration.
8982         (Stub::do_fixed_endian_write): New template member.
8983         (Reloc_stub::do_write): Remove.
8984         (Reloc_stub::do_fixed_endian_write): Remove.
8985         (Cortex_a8_stub): New class definition.
8986         (Stub_factory::make_cortex_a8_stub): New method definition.
8987         (Stub_factory::Stub_factory): Add missing static storage class
8988         qualifier for elf32_arm_stub_a8_veneer_blx.
8989
8990 2010-01-07  Ian Lance Taylor  <iant@google.com>
8991
8992         PR 10980
8993         * options.h (class General_options): Add --warn-unresolved-symbols
8994         and --error-unresolved-symbols.
8995         * errors.cc (Errors::undefined_symbol): Implement
8996         --warn-unresolved-symbols.
8997
8998         * options.h (class General_options): Add -z text and -z textoff.
8999         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9000
9001 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9002
9003         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9004         (Garbage_collection::cident_sections): New function.
9005         (Garbage_collection::add_cident_section): New function.
9006         (Garbage_collection::cident_sections_): New member.
9007         (gc_process_relocs): Add references to sections whose names are C
9008         identifiers.
9009         * gold.h (cident_section_start_prefix): New constant.
9010         (cident_section_stop_prefix): New constant.
9011         (is_cident): New function.
9012         * layout.cc (Layout::define_section_symbols): Replace string constants
9013         with the newly defined constants.
9014         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9015         C identifiers.
9016         * testsuite/Makefile.am: Add gc_orphan_section_test.
9017         * testsuite/Makefile.in: Regenerate.
9018         * testsuite/gc_orphan_section_test.cc: New file.
9019         * testsuite/gc_orphan_section_test.sh: New file.
9020
9021 2010-01-06  Ian Lance Taylor  <iant@google.com>
9022
9023         PR 10980
9024         * options.h (class General_options): Add --warn-shared-textrel.
9025         * layout.cc (Layout::finish_dynamic_section): Implement
9026         --warn-shared-textrel.
9027
9028         PR 10980
9029         * options.h (class General_options): Add --warn-multiple-gp.
9030
9031 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9032
9033         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9034         $(THREADSLIB) and $(LIBDL).
9035         * Makefile.in: Rebuild.
9036
9037 2010-01-06  Ian Lance Taylor  <iant@google.com>
9038
9039         PR 10980
9040         * options.cc (General_options::parse_section_start): New function.
9041         (General_options::section_start): New function.
9042         (General_options::General_options): Initialize all members.
9043         * options.h: Include <map>
9044         (class General_options): Add --section-start.  Add section_starts_
9045         member.
9046         * layout.cc (Layout::attach_allocated_section_to_segment): If
9047         --section-start was used, set the address of the segment.  Remove
9048         local sort_sections.
9049         (Layout::relaxation_loop_body): If the address of the load segment
9050         has been set by --section-start, don't use it.
9051         * output.h (Output_segment::update_flags_for_output_section): New
9052         function.
9053         * output.cc (Output_segment::add_output_section): Call
9054         update_flags_for_output_section.
9055
9056 2010-01-05  Ian Lance Taylor  <iant@google.com>
9057
9058         PR 10980
9059         * options.h (class General_options): Add --undefined-version.
9060         * script.cc (struct Version_expression): Add was_matched_by_symbol
9061         field.
9062         (Version_script_info::matched_symbol): New function.
9063         (Version_script_info::get_symbol_version_helper): Call
9064         matched_symbol.
9065         (Version_script_info::check_unmatched_names): New function.
9066         * script.h (class Version_script_info): Update declarations.
9067         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9068
9069         * options.h (class General_options): Use DEFINE_bool_alias for
9070         allow_multiple_definition.
9071         * resolve.cc (Symbol_table::should_override): Don't test
9072         allow_multiple_definition.
9073
9074         PR 10980
9075         * options.h (class General_options): Add --cref.
9076         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9077         until after printing cref table.
9078         * cref.cc: Include "symtab.h".
9079         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9080         (Cref_table_compare::operator()): New function.
9081         (Cref_inputs::gather_cref): New function.
9082         (filecol): New static const.
9083         (Cref_inputs::print_cref): New function.
9084         (Cref::print_cref): New function.
9085         * cref.h: Include <cstdio>.
9086         (class Cref): Update declarations.
9087         * mapfile.h (Mapfile::file): New function.
9088         * object.h (class Object): Define Symbols.  Declare virtual
9089         do_get_global_symbols.
9090         (Object::get_global_symbols): New function.
9091         * object.cc (Input_objects::add_object): Pass object to cref_ if
9092         --cref.
9093         (Input_objects::archive_start): Likewise.
9094         (Input_objects::archive_stop): Likewise.
9095         (Input_objects::print_cref): New function.
9096         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9097         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9098         --cref.
9099         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9100         function.
9101         * plugin.h (class Sized_pluginobj): Update declarations.
9102
9103 2010-01-05  Ian Lance Taylor  <iant@google.com>
9104
9105         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9106         to is_default_version.  Rename insdef to insdefault.
9107         (Symbol_table::add_from_relobj): Rename def to is_default_version
9108         and local to is_forced_local.
9109         (Symbol_table::add_from_pluginobj): Likewise.
9110         (Symbol_table::add_from_dynobj): Likewise.
9111         (Symbol_table::define_special_symbol): Rename insdef to
9112         insdefault.
9113
9114 2010-01-04  Ian Lance Taylor  <iant@google.com>
9115
9116         PR 10980
9117         * options.h (class General_options): Add
9118         --allow-multiple-definition and -z muldefs.
9119         * resolve.cc (Symbol_table::should_override): Don't warn about a
9120         multiple symbol definition if --allow-multiple-definition or -z
9121         muldefs.
9122
9123         PR 10980
9124         * options.h (class General_options): Add --add-needed and
9125         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9126         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9127         error if --copy-dt-needed-entries aka --add-needed is used and
9128         would cause a change in behaviour.
9129
9130         PR 10980
9131         * options.h (class General_options): Add -G as a short version of
9132         --shared.  Add no-op options -assert, -g, and -i.
9133
9134 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9135
9136         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9137         check for .text or .gnu.linkonce.t sections.
9138         * icf.cc (Icf::find_identical_sections): Ditto.
9139         Change the detection for mangled function name within the section
9140         name.
9141         * icf.h (is_section_foldable_candidate): New function.
9142
9143 2009-12-30  Ian Lance Taylor  <iant@google.com>
9144
9145         PR 10980
9146         * options.h (class General_options): Permit two dashes with
9147         --retain-symbols-file.
9148
9149 2009-12-30  Ian Lance Taylor  <iant@google.com>
9150
9151         PR 10979
9152         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9153         don't put the file header and segment headers in the text
9154         segment.
9155
9156         PR 10979
9157         * common.cc (Sort_commons::operator()): Stabilize sort when both
9158         entries are NULL.
9159         (Symbol_table::do_allocate_commons_list): When allocating common
9160         symbols, skip a symbol which is no longer common.
9161         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9162         an object before checking its type.
9163         * testsuite/common_test_2.c: New file.
9164         * testsuite/common_test_3.c: New file.
9165         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9166         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9167         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9168         (common_test_2_pic.o, common_test_2.so): New targets.
9169         (common_test_3_pic.o, common_test_3.so): New targets.
9170         * testsuite/Makefile.in: Rebuild.
9171
9172         PR 10979
9173         * script.cc (read_input_script): If we see a new SECTIONS clause,
9174         and we have added an input section, give an error.
9175         * layout.h (class Layout): Add have_added_input_section function.
9176         Add have_added_input_section_ field.
9177         * layout.cc (Layout::Layout): Initialize
9178         have_added_input_section_.
9179         (Layout::layout): Set have_added_input_section_.
9180         (Layout::layout_eh_frame): Likewise.
9181
9182 2009-12-30  Ian Lance Taylor  <iant@google.com>
9183
9184         PR 10931
9185         * options.h (class General_options): Add --sort-common option.
9186         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9187         * common.cc (Sort_common): Add sort_order parameter to
9188         constructor.  Add sort_order_ field.
9189         (Sort_commons::operator): Check sort_order_.
9190         (Symbol_table::allocate_commons): Determine the sort order.
9191         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9192         Change all callers.
9193         (Symbol_table::do_allocate_commons_list): Likewise.
9194
9195 2009-12-30  Ian Lance Taylor  <iant@google.com>
9196
9197         PR 10916
9198         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9199         symbols from this object, don't change the visibility of an
9200         undefined symbol.
9201         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9202
9203 2009-12-30  Ian Lance Taylor  <iant@google.com>
9204
9205         PR 10861
9206         * script.h (class Version_script_info): Define Language enum.
9207         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9208         new fields globals_, locals_, and is_finalized_.
9209         * script.cc: Various formatting fixes.
9210         (class Parser_closure): Change language_stack_ from a vector of
9211         std::string to one of Version_script_info::Language.  Adjust all
9212         uses accordingly.
9213         (class Lazy_demangler): Remove.
9214         (struct Version_expression): Change language from std::string to
9215         Version_script_info::Language.
9216         (Version_script_info::Version_script_info): New function.
9217         (Version_script_info::~Version_script_info): Don't call clear.
9218         (Version_script_info::finalize): New function.
9219         (Version_script_info::build_lookup_tables): New function.
9220         (Version_script_info::build_expression_list_lookup): New
9221         function.
9222         (Version_script_info::get_symbol_version_helper): Rewrite to use
9223         lookup tables.
9224         (Version_script_info::print_expression_list): Adjust to use
9225         Version_script_info::Language.
9226         (script_push_lex_into_version_mode): Check that the version script
9227         has not been finalized.
9228         (version_script_push_lang): Change language string to
9229         Version_script_info::Language.
9230         * options.cc (Command_line::version_script): New function.
9231         * options.h (class General_options): Add finalize_dynamic_list
9232         function.  Change version_script from declaration to definition.
9233         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9234         * testsuite/version_script.map: Remove duplicate def of foo.
9235         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9236         version_script.map.
9237         * testsuite/Makefile.in: Rebuild.
9238
9239 2009-12-30  Ian Lance Taylor  <iant@google.com>
9240
9241         PR 10843
9242         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9243         if the input symbol index is 0, make the output symbol index 0.
9244
9245 2009-12-30  Ian Lance Taylor  <iant@google.com>
9246
9247         PR 10670
9248         * options.h (class General_options): Add -x/--discard-all.
9249         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9250         --discard-all.  If the local symbol needs a dynamic entry, check
9251         that before handling --discard-locals.
9252
9253 2009-12-30  Ian Lance Taylor  <iant@google.com>
9254
9255         PR 10450
9256         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9257         flags to PF_R.
9258         (Output_segment::add_output_section): Don't change the flags if
9259         the type is PT_TLS.
9260
9261         PR 10450
9262         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9263         GNU hash table if they need a dynamic value.  Otherwise, don't add
9264         them if they are defined in a dynamic object or are forced local.
9265
9266 2009-12-29  Ian Lance Taylor  <iant@google.com>
9267
9268         PR 10450
9269         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9270         .gnu.hash table for a 32-bit target.
9271
9272         PR 10450
9273         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9274         regular and a dynamic object only needs a dynamic symbol table
9275         entry if it is externally visible.
9276
9277         PR 10450
9278         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9279         constructor.  Add global_offset_table_ field.
9280         (Target_i386::got_section): Set global_offset_table_.
9281         (Target_i386::do_finalize_sections): Set global_offset_table_
9282         size.
9283         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9284         in constructor.  Add global_offset_table_ field.
9285         (Target_x86_64::got_section): Set global_offset_table_.
9286         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9287         size.
9288
9289         * layout.cc (Layout::Layout): Initialize increase_relro_.
9290         (Layout::get_output_section): Add is_relro, is_last_relro, and
9291         is_first_non_relro parameters.  Change all callers.
9292         (Layout::choose_output_section): Likewise.
9293         (Layout::add_output_section_data): Likewise.
9294         (Layout::make_output_section): Likewise.
9295         (Layout::set_segment_offsets): Clear increase_relro when using a
9296         linker script.
9297         * layout.h (class Layout): Add increase_relro method.  Add
9298         increase_relro_ field.  Update declarations.
9299         * output.cc (Output_section::Output_section): Initialize
9300         is_last_relro_ and is_first_non_relro_.
9301         (Output_segment::add_output_section): Group relro sections is
9302         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9303         (Output_segment::maximum_alignment): Remove relro handling.
9304         (Output_segment::set_section_addresses): Add increase_relro
9305         parameter.  Change all callers.  Add initial alignment to align
9306         relro sections on separate page.  Remove old relro handling.
9307         (Output_segment::set_section_list_addresses): Remove in_relro
9308         parameter.  Change all callers.
9309         (Output_segment::set_offset): Add increase parameter.  Change all
9310         callers.  Remove old relro handling.
9311         * output.h (class Output_section): Add new methods: is_last_relro,
9312         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9313         Add is_last_relro_ and is_first_non_relro_ fields.
9314         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9315         Create separate .got.plt section.  Call increase_relro.
9316         * x86_64.cc (Target_x86_64::got_section): Likewise.
9317         * testsuite/relro_script_test.t: Add .got.plt.
9318
9319         PR 10450
9320         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9321         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9322         (Layout::finalize): Call set_dynamic_symbol_size.
9323         (Layout::set_dynamic_symbol_size): New function.
9324         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9325         set_dynamic_symbol_size.
9326
9327         PR 10450
9328         * output.h (class Output_section): Add is_entsize_zero_ field.
9329         * output.cc (Output_section::Output_section): Initialize
9330         is_entsize_zero_.
9331         (Output_section::set_entsize): If two different entsizes are
9332         requested, force it to zero.
9333         (Output_section::add_input_section): Set flags for .debug_str
9334         before updating section flags.  Set entsize.
9335         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9336         and SHF_STRING if all input sections have those flags.
9337
9338 2009-12-29   Rafael Espindola  <espindola@google.com>
9339
9340         * main.cc (main): Fix the sys time reporting.
9341         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9342         reporting.
9343
9344 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9345
9346         * options.cc (General_options::parse_version): Allow -v to exit
9347         without an error if there is nothing to link.
9348
9349 2009-12-29  Ian Lance Taylor  <iant@google.com>
9350
9351         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9352         using a version of gcc before 4.1.
9353         * configure: Rebuild.
9354
9355 2009-12-28  Chris Demetriou  <cgd@google.com>
9356
9357         * attributes.cc (Output_attributes_section_data::do_write): Use
9358         std::vector::front rather than std::vector::data.
9359
9360 2009-12-28  Ian Lance Taylor  <iant@google.com>
9361
9362         * symtab.h (class Symbol_table): Add enum Defined.
9363         * resolve.cc (Symbol_table::should_override): Add defined
9364         parameter.  Change all callers.  Test whether object is NULL
9365         before calling a method on it.
9366         (Symbol_table::report_resolve_problem): Add defined parameter.
9367         Change all callers.
9368         (Symbol_table::should_override_with_special): Likewise.
9369         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9370         parameter.  Change all callers.
9371         (Symbol_table::do_define_in_output_data): Likewise.
9372         (Symbol_table::define_in_output_segment): Likewise.
9373         (Symbol_table::do_define_in_output_segment): Likewise.
9374         (Symbol_table::define_as_constant): Likewise.
9375         (Symbol_table::do_define_as_constant): Likewise.
9376         * script.h (class Symbol_assignment): Add is_defsym parameter to
9377         constructor; change all callers.
9378         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9379         parameter.  Change all callers.  Add is_defsym_ field.
9380         (class Parser_closure): Add parsing_defsym parameter to
9381         constructor; change all callers.  Add parsing_defsym accessor
9382         function.  Add parsing_defsym_ field.
9383
9384 2009-12-28  Ian Lance Taylor  <iant@google.com>
9385
9386         * gold.cc (queue_middle_tasks): Fix formatting.
9387         * object.cc (Relobj::is_section_name_included): Likewise.
9388
9389 2009-12-23  Ian Lance Taylor  <iant@google.com>
9390
9391         * i386.cc (Target_i386::do_calls_non_split): Recognize
9392         -fsplit-stack prologue for a function with a static chain.
9393         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9394         -fsplit-stack prologue when using %r11.
9395
9396 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9397
9398         * options.cc (General_options::parse_version): Make -v continue and do
9399         the link like GNU ld does.
9400
9401 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9402
9403         * Makefile.am (CCFILES): Add timer.cc.
9404         (HFILES): Add timer.h.
9405         * configure.ac: Check for sysconf and times.
9406         * main.cc: include timer.h.
9407         (main): Use Timer instead of get_run_time.
9408         * timer.cc: New.
9409         * timer.h: New.
9410         * workqueue.cc: include timer.h.
9411         (Workqueue::find_and_run_task):
9412         Report user, sys and wall time.
9413         * Makefile.in: Regenerate.
9414         * config.in: Regenerate.
9415         * configure: Regenerate.
9416
9417 2009-12-16  Doug Kwan  <dougkwan@google.com>
9418
9419         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9420         sections.
9421         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9422         relaxed input sections.
9423         * output.cc (Output_section::find_relaxed_input_section): Change
9424         return type to Output_relaxed_input_section pointer.  Adjust code
9425         for new type of relaxed_input_section_map_.
9426         * output.h (Output_section::find_relaxed_input_section): Change
9427         return type to Output_relaxed_input_section pointer.
9428         (Output_section::Output_relaxed_input_section_by_input_section_map):
9429         New type.
9430         (Output_section::relaxed_input_section_map_): Change type to
9431         Output_section::Output_relaxed_input_section_by_input_section_map.
9432         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9433         input section.
9434
9435 2009-12-15  Ian Lance Taylor  <iant@google.com>
9436
9437         * layout.cc (Layout::create_shstrtab): Only write out after input
9438         sections if we are compressing debug sections.
9439
9440 2009-12-15  Ian Lance Taylor  <iant@google.com>
9441
9442         * archive.cc (Archive::add_symbols): Only look up a symbol without
9443         a version if there is, in fact, a version.
9444
9445 2009-12-14  Ian Lance Taylor  <iant@google.com>
9446
9447         Revert -Wshadow changes, all changes from:
9448         2009-12-11  Doug Kwan  <dougkwan@google.com>
9449         2009-12-11  Nick Clifton  <nickc@redhat.com>
9450         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9451
9452 2009-12-11  Doug Kwan  <dougkwan@google.com>
9453
9454         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9455         due to -Wshadow.
9456         * attributes.cc (Object_attribute::size): Ditto.
9457         (Attributes_section_data::size): Ditto.
9458         (Attributes_section_data::Attributes_section_data): Ditto.
9459         (Output_attributes_section_data::do_write): Ditto.
9460         * attributes.h (Object_attribute::set_type): Ditto.
9461         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9462
9463 2009-12-11  Nick Clifton  <nickc@redhat.com>
9464
9465         * archive.cc: Fix shadowed variable warnings.
9466         * arm.cc: Likewise.
9467         * compressed_output.cc: Likewise.
9468         * compressed_output.h: Likewise.
9469         * configure: Likewise.
9470         * dwarf_reader.cc: Likewise.
9471         * dynobj.cc: Likewise.
9472         * dynobj.h: Likewise.
9473         * ehframe.cc: Likewise.
9474         * ehframe.h: Likewise.
9475         * errors.cc: Likewise.
9476         * expression.cc: Likewise.
9477         * fileread.cc: Likewise.
9478         * fileread.h: Likewise.
9479         * freebsd.h: Likewise.
9480         * i386.cc: Likewise.
9481         * icf.cc: Likewise.
9482         * incremental.h: Likewise.
9483         * layout.cc: Likewise.
9484         * layout.h: Likewise.
9485         * mapfile.cc: Likewise.
9486         * merge.cc: Likewise.
9487         * merge.h: Likewise.
9488         * object.cc: Likewise.
9489         * object.h: Likewise.
9490         * options.h: Likewise.
9491         * output.cc: Likewise.
9492         * output.h: Likewise.
9493         * parameters.cc: Likewise.
9494         * plugin.cc: Likewise.
9495         * powerpc.cc: Likewise.
9496         * reduced_debug_output.cc: Likewise.
9497         * reduced_debug_output.h: Likewise.
9498         * reloc.cc: Likewise.
9499         * reloc.h: Likewise.
9500         * resolve.cc: Likewise.
9501         * script-sections.cc: Likewise.
9502         * script.cc: Likewise.
9503         * script.h: Likewise.
9504         * sparc.cc: Likewise.
9505         * symtab.cc: Likewise.
9506         * symtab.h: Likewise.
9507         * target-select.cc: Likewise.
9508         * target-select.h: Likewise.
9509         * token.h: Likewise.
9510         * workqueue.cc: Likewise.
9511         * workqueue.h: Likewise.
9512         * x86_64.cc: Likewise.
9513
9514 2009-12-10  Doug Kwan  <dougkwan@google.com>
9515
9516         * arm.cc (attributes.h): New include.
9517         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9518         (Arm_relobj::~Arm_relobj): Delete object pointed by
9519         attributes_section_data_.
9520         (Arm_relobj::attributes_section_data): New method definition.
9521         (Arm_relobj::attributes_section_data_): New data member declaration.
9522         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9523         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9524         attributes_section_data_.
9525         (Arm_dynobj::attributes_section_data): New method definition.
9526         (Arm_dynobj::attributes_section_data_): New data member declaration.
9527         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9528         initialization value of may_use_blx_ to false.
9529         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9530         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9531         object attributes to compute results instead of hard-coding.
9532         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9533         Target_arm::get_secondary_compatible_arch,
9534         Target_arm::set_secondary_compatible_arch
9535         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9536         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9537         New method declarations.
9538         (Target_arm::get_aeabi_object_attribute): New method definition.
9539         (Target_arm::attributes_section_data_): New data member declaration.
9540         (read_arm_attributes_section): New template definition.
9541         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9542         (Arm_dynobj::do_read_symbols): Ditto.
9543         (Target_arm::do_finalize_sections): Merge attributes sections from
9544         input.  Check for BLX use after attributes section merging.
9545         Fix __exidx_start and __exidx_end visibility.  Create an
9546         .ARM.attributes section if necessary.
9547         (Target_arm::get_secondary_compatible_arch,
9548         Target_arm::set_secondary_compatible_arch,
9549         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9550         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9551         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9552         New method definitions.
9553
9554 2009-12-09  Ian Lance Taylor  <iant@google.com>
9555
9556         * plugin.cc (Plugin::load): Don't cast from void* to a function
9557         pointer.
9558
9559 2009-12-09  Ian Lance Taylor  <iant@google.com>
9560
9561         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9562         information fields.
9563
9564 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9565
9566         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9567         Replace two_file_shared_1.so with two_file_shared_2.so.
9568         * testsuite/Makefile.in: Regenerated.
9569
9570 2009-12-08  Doug Kwan  <dougkwan@google.com>
9571
9572         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9573         (HFILES): Add attributes.h and int_encoding.h.
9574         * Makefile.in: Regenerate.
9575         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9576         function definitions to int_encoding.cc
9577         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9578         prototypes to int_encoding.h
9579         * reduced_debug_output.cc (int_encoding.h): New include.
9580         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9581         function definitions to int_encoding.cc
9582         (insert_into_vector, read_from_pointer): Move template definitions to
9583         int_encoding.h
9584         * attributes.cc: New file.
9585         * attributes.h: New file.
9586         * int_encoding.cc: New file.
9587         * int_encoding.h: New file.
9588
9589 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9590
9591         PR gold/11055
9592         * incremental-dump.cc (dump_incremental_inputs): New.
9593         (main): Use dump_incremental_inputs.
9594
9595 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9596
9597         PR gold/10893
9598         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9599         checking elfcpp::STT_FUNC.
9600         (Target_i386::Relocate::relocate): Likewise.
9601         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9602
9603         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9604         symbols from shared libraries into normal FUNC symbols.
9605
9606         * symtab.h (Symbol): Add is_func and use it.
9607
9608 2009-12-05  Doug Kwan  <dougkwan@google.com>
9609
9610         * arm.cc (Target_arm::arm_info): Initialize new fields
9611         attributes_section and attributes_vendor.
9612         * i386.cc (Target_i386::i386_info): Same.
9613         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9614         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9615         fields attributes_section and attributes_vendor.
9616         * sparc.cc (Target_sparc::sparc_info): Same.
9617         * target.h (Target::attributes_section, Target::attributes_vendor,
9618         Target::is_attributes_section, Target::attribute_arg_type,
9619         Target::attributes_order): New method definitions.
9620         (Target::Target_info::attributes_section,
9621         Target::Target_info::attributes_vendor): New fields.
9622         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9623         virtual method definitions.
9624         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9625         attributes_section and attributes_vendor.
9626         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9627
9628 2009-12-05  Doug Kwan  <dougkwan@google.com>
9629
9630         * arm.cc: Update comments about interworking and stub generation.
9631         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9632         considered as non-PIC.
9633         (Arm_relocate_functions::base_abs): Fix formatting.
9634         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9635         of function to use GOT entry address instead of offset.
9636         (Target_arm::Scan::global): Issue an error if a symbol would need a
9637         PLT does not get one because it is untyped.  Remove code to create
9638         dynamic symbols for relative branches.
9639         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9640         takes unsigned integer instead of boolean.
9641
9642 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9643
9644         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9645         (two_file_test_LDADD): Likewise.
9646         (common_test_1_LDADD): Likewise.
9647         (exception_test_LDADD) Likewise.
9648         (weak_test_LDADD): Likewise.
9649         (many_sections_test_LDADD): Likewise.
9650         (initpri1_LDADD): Likewise.
9651         (script_test_1_LDADD): Likewise.
9652         (script_test_2_LDADD): Likewise.
9653         (justsyms_LDADD): Likewise.
9654         (binary_test_LDADD): Likewise.
9655         (large_LDADD): Likewise.
9656         * testsuite/Makefile.in: Regenerated.
9657
9658 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9659
9660         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9661         (Symbol_table::override_with_special): Likewise.
9662         (Symbol_table::add_from_object): Likewise.
9663
9664 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9665
9666         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9667         Don't set the data_offset twice.
9668
9669 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9670
9671         * testsuite/Makefile.in: Regenerate.
9672
9673 2009-12-03  Doug Kwan  <dougkwan@google.com>
9674
9675         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9676         (Target_arm::do_finalize_sections): Add parameter for symbol table
9677         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9678         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9679         parameter for symbol table pointer.
9680         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9681         an additional parameter for a pointer to symbol table.
9682         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9683         parameter for a symbol table pointer.
9684         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9685         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9686         Ditto.
9687         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9688         parameter for a symbol table pointer.
9689
9690 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9691
9692         * incremental.cc (Incremental_inputs_header)
9693         (Incremental_inputs_header_write, Incremental_inputs_entry)
9694         (Incremental_inputs_entry_write): Move ...
9695         * incremental.h (Incremental_inputs_header)
9696         (Incremental_inputs_header_write, Incremental_inputs_entry)
9697         (Incremental_inputs_entry_write): here.
9698
9699 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9700
9701         * incremental.cc (make_sized_incremental_binary): Set the target.
9702         Error if it is incompatible.
9703         * output.h (Output_file): Add filename method.
9704
9705 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9706
9707         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9708         from the get_* methods.
9709
9710 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9711
9712         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9713         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9714         Write 0 for the data_offset of scripts.
9715
9716 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9717
9718         * testsuite/Makefile.am: Add the incremental_test.sh test.
9719         * testsuite/incremental_test.sh: New.
9720         * testsuite/incremental_test_1.c: New.
9721         * testsuite/incremental_test_2.c: New.
9722
9723 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9724
9725         * incremental-dump.cc (main): Fix typos.
9726
9727 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9728
9729         PR gold/11025
9730         * incremental-dump.cc (main): Use llu to print 64 bit values.
9731
9732 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9733             H.J. Lu  <hongjiu.lu@intel.com>
9734
9735         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9736         $(LIBDL).
9737         (incremental_dump_LDADD): Likewise.
9738         * Makefile.in: Regenerated.
9739
9740 2009-11-25  Doug Kwan  <dougkwan@google.com>
9741
9742         Revert:
9743
9744         2009-11-25  Doug Kwan  <dougkwan@google.com>
9745
9746                 * arm.cc (Target_arm::Target_arm): Move method definition
9747                 outside of class definition.  Add code to handle
9748                 --target1-rel, --target1-abs and --target2= options.
9749                 (Target_arm::get_reloc_reloc_type): Change method to be
9750                 non-static and const.
9751                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9752                 New data member declaration.
9753                 (Target_arm::Scan::local, Target_arm::Scan::global,
9754                 Target_arm::Relocate::relocate,
9755                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9756                 Adjust call to Target_arm::get_real_reloc_type.
9757                 (Target_arm::get_real_reloc_type): Use command line options
9758                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9759                 * options.h (--target1-rel, --target1-abs, --target2): New
9760                 ARM-only options.
9761
9762 2009-11-25  Doug Kwan  <dougkwan@google.com>
9763
9764         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9765         class definition.  Add code to handle --target1-rel, --target1-abs
9766         and --target2= options.
9767         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9768         and const.
9769         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9770         member declaration.
9771         (Target_arm::Scan::local, Target_arm::Scan::global,
9772         Target_arm::Relocate::relocate,
9773         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9774         call to Target_arm::get_real_reloc_type.
9775         (Target_arm::get_real_reloc_type): Use command line options to
9776         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9777         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9778         options.
9779
9780 2009-11-25  Doug Kwan  <dougkwan@google.com>
9781
9782         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9783         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9784         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9785         formatting.
9786         (Arm_relocate_functions::thm_call): Replace body with a call to
9787         Arm_relocate_functions::thumb_branch_common.
9788         (Arm_relocate_functions::thm_jump24,
9789         Arm_relocate_functions::thm_xpc22): New method definitions.
9790         (Arm_relocate_functions::thumb_branch_common): New method definition.
9791         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9792         operator.
9793         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9794         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9795
9796 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9797
9798         * Makefile.am: Build incremental-dump
9799         * Makefile.in: Regenerate.
9800         * incremental-dump.cc: New.
9801         * incremental.cc (Incremental_inputs_header_data,
9802         Incremental_inputs_entry_data): Move to incremental.h
9803         * incremental.h: (Incremental_inputs_header_data,
9804         Incremental_inputs_entry_data): Move from incremental.cc
9805
9806 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9807
9808         * incremental.cc (Incremental_inputs_header,
9809         Incremental_inputs_header_write, Incremental_inputs_entry,
9810         Incremental_inputs_entry_write): Add a typedef with the data type.
9811
9812 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9813
9814         * incremental.cc (Incremental_inputs_header,
9815         Incremental_inputs_header_write, Incremental_inputs_entry,
9816         Incremental_inputs_entry_write): Update comment about which
9817         type has the filed descriptions.
9818
9819 2009-11-15  Doug Kwan  <dougkwan@google.com>
9820
9821         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9822         (Arm_relocate_functions::arm_branch_common): Change method defintion
9823         in class definition to a method declaration and update list of formal
9824         parameters.
9825         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9826         Arm_relocation_functions::jump24): Adjust call to
9827         Arm_relocate_functions::arm_branch_common.  Update list of formal
9828         parameters.
9829         (Arm_relocate_functions::xpc25): New method definition.
9830         (Arm_relocate_functions::arm_branch_common): Move method defintion
9831         out from class definition.  Use stubs for mode-switching and extending
9832         branch ranges.
9833         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9834         specially.  Change code to enable use of stubs in ARM branches.
9835
9836 2009-11-10  Doug Kwan  <dougkwan@google.com>
9837
9838         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9839         in method declaration.
9840         (Target_arm::relocate_stub): New method declaration.
9841         (Target_arm::default_target): Change to return a pointer instead of
9842         a const reference.
9843         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9844         Target_arm::default_target.
9845         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9846         method definition.
9847         (Target_arm::relocate_section): Adjust view.
9848         (Target_arm::relocate_stub): New method definition.
9849
9850 2009-11-10  Doug Kwan  <dougkwan@google.com>
9851
9852         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9853         a format warning.
9854         * incremental.cc (open_incremental_binary): Initialized local
9855         variables to avoid warnings.
9856         * object.cc (make_elf_object): Ditto.
9857         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9858         a format warning.
9859
9860 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9861
9862         PR gold/10930
9863         * testsuite/plugin_test.c: Include "config.h".
9864
9865 2009-11-09  Doug Kwan  <dougkwan@google.com>
9866
9867         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9868         (arm_symbol_value): Remove.
9869         (Arm_relocate_functions::arm_branch_common,
9870         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9871         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9872         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9873         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9874         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9875         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9876         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9877         Arm_relocate_functions::thm_mobw_abs_nc,
9878         Arm_relocate_functions::thm_mov_abs,
9879         Arm_relocate_functions::movw_prel_nc,
9880         Arm_relocate_functions::thm_movt_abs,
9881         Arm_relocate_functions::movt_prel,
9882         Arm_relocate_functions::thm_movw_prel_nc,
9883         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9884         (Target_arm::Relocate::relocate): Only decompose address into two
9885         parts if relocation type uses the thumb-bit and pass the actual
9886         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9887         calls to methods in Arm_relocate_functions for this change.
9888
9889 2009-11-08  Ian Lance Taylor  <iant@google.com>
9890
9891         PR 10925
9892         * reloc.cc: Instantiate
9893         Sized_relobj::initialize_input_to_output_maps and
9894         Sized_relobj:free_input_to_output_maps.
9895
9896 2009-11-06  Ian Lance Taylor  <iant@google.com>
9897
9898         PR 10876
9899         * defstd.cc (in_segment): Set only_if_ref true for "end".
9900
9901 2009-11-06  Doug Kwan  <dougkwan@google.com>
9902
9903         * arm.cc (class Reloc_stub): Correct a comment.
9904         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9905         (Target_arm::scan_section_for_stubs): New method declaration.
9906         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9907         Change methods from private to protected.
9908         (Target_arm::do_may_relax): New method definition.
9909         (Target_arm::do_relax, Target_arm::group_sections,
9910         Target_arm::scan_reloc_for_stub,
9911         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9912         (Target_arm::arm_input_section_map_): New data member declaration.
9913         (Target_arm::scan_reloc_for_stub,
9914         Target_arm::scan_reloc_section_for_stubs,
9915         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9916         Target_arm::do_relax): New method definitions.
9917
9918 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9919
9920         * configure.ac: Check for (struct stat)::st_mtim
9921         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9922         * config.in: Regenerate.
9923         * configure: Regenerate.
9924
9925 2009-11-05  Ian Lance Taylor  <iant@google.com>
9926
9927         PR 10910
9928         * output.cc (Output_segment::add_output_section): Add missing
9929         return statement.
9930
9931 2009-11-04  Ian Lance Taylor  <iant@google.com>
9932
9933         PR 10880
9934         * object.h (class Object): Add is_needed and set_is_needed
9935         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9936         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9937         defined in a dynamic object and referenced by a regular object,
9938         set is_needed for the dynamic object.
9939         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9940         if the file is marked with as_needed and it is not needed.
9941
9942 2009-11-04  Ian Lance Taylor  <iant@google.com>
9943
9944         PR 10887
9945         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9946         tags if data is discarded by linker script.
9947         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9948         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9949         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9950         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9951
9952 2009-11-04  Ian Lance Taylor  <iant@google.com>
9953
9954         * layout.cc (Layout::get_output_section): Add is_interp and
9955         is_dynamic_linker_section parameters.  Change all callers.
9956         (Layout::choose_output_section): Likewise.
9957         (Layout::make_output_section): Likewise.
9958         (Layout::add_output_section_data): Add is_dynamic_linker_section
9959         parameter.  Change all callers.
9960         * layout.h (class Layout): Update declarations.
9961         * output.h (class Output_section): Add is_interp, set_is_interp,
9962         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9963         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9964         generate_code_fills_at_write_ to a bitfield.
9965         * output.cc (Output_section::Output_sections): Initialize new
9966         fields.
9967         (Output_segment::add_output_section): Add do_sort parameter.
9968         Change all callers.
9969
9970 2009-11-03  Ian Lance Taylor  <iant@google.com>
9971
9972         PR 10860
9973         * options.h (class General_options): Add --warn-common.
9974         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9975         merging two common symbols.
9976         (Symbol_table::should_override): Handle --warn-common when merging
9977         a common symbol with a defined symbol.  Use report_resolve_problem
9978         for multiple definitions.
9979         (Symbol_table::report_resolve_problem): New function.
9980         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9981
9982 2009-11-03  Doug Kwan  <dougkwan@google.com>
9983
9984         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9985         stub_factory_.
9986         (Target_arm::stub_factory): New method definition.
9987         (Target_arm::new_arm_input_section,
9988         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9989         Target_arm::reloc_uses_thumb_bit): New method declarations.
9990         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9991         New type definitions.
9992         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9993         member declarations.
9994         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9995         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9996         New method definitions.
9997
9998 2009-11-03  Ian Lance Taylor  <iant@google.com>
9999
10000         * options.h (class General_options): Add --warn_constructors.
10001
10002 2009-11-03  Ian Lance Taylor  <iant@google.com>
10003
10004         PR 10893
10005         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10006         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10007
10008 2009-11-03  Ian Lance Taylor  <iant@google.com>
10009
10010         PR 10895
10011         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10012         --msgid-bugs-address.
10013         (install-pdf): New target.
10014         (install-data_yes): Look up one directory to find mkinstalldirs.
10015
10016 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10017
10018         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10019         tree.
10020
10021 2009-10-30  Doug Kwan  <dougkwan@google.com>
10022
10023         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10024
10025 2009-10-30  Doug Kwan  <dougkwan@google.com>
10026
10027         * arm.cc (Stub_addend_reader): New struct template definition
10028         and partial specializations.
10029         (Stub_addend_reader::operator()): New method definition for a
10030         partially specialized template.
10031
10032 2009-10-30  Doug Kwan  <dougkwan@google.com>
10033
10034         * arm.cc (Arm_relobj::processor_specific_flags): New method
10035         definition.
10036         (Arm_relobj::do_read_symbols): New method declaration.
10037         (Arm_relobj::processor_specific_flags_): New data member declaration.
10038         (Arm_dynobj): New class definition.
10039         (Target_arm::do_finalize_sections): Add input_objects parameter.
10040         (Target_arm::do_adjust_elf_header): New method declaration.
10041         (Target_arm::are_eabi_versions_compatible,
10042         (Target_arm::merge_processor_specific_flags): New method declaration.
10043         (Target_arm::do_make_elf_object): New overloaded method definitions
10044         and declaration.
10045         (Arm_relobj::do_read_symbols): New method definition.
10046         (Arm_dynobj::do_read_symbols): Ditto.
10047         (Target_arm::do_finalize_sections): Add input_objects parameters.
10048         Merge processor-specific flags from all input objects.
10049         (Target_arm::are_eabi_versions_compatible,
10050         Target_arm::merge_processor_specific_flags,
10051         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10052         New method definitions.
10053         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10054         Input_objects pointer type parameter.
10055         * layout.cc (Layout::finalize): Pass input objects to target's.
10056         finalize_sections function.
10057         * output.cc (Output_file_header::do_sized_write): Set ELF file
10058         header's processor-specific flags.
10059         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10060         Input_objects pointer type parameter.
10061         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10062         * target.h (Input_objects): New forward class declaration.
10063         (Target::processor_specific_flags,
10064         Target::are_processor_specific_flags_sect): New method definitions.
10065         (Target::finalize_sections): Add input_objects parameter.
10066         (Target::Target): Initialize processor_specific_flags_ and
10067         are_processor_specific_flags_set_.
10068         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10069         parameter.
10070         (Target::set_processor_specific_flags): New method definition.
10071         (Target::processor_specific_flags_,
10072         Target::are_processor_specific_flags_set_): New data member
10073         declarations.
10074         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10075         Input_objects pointer type parameter.
10076
10077 2009-10-30  Doug Kwan  <dougkwan@google.com>
10078
10079         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10080
10081 2009-10-28  Ian Lance Taylor  <iant@google.com>
10082
10083         * object.h (class Relobj): Drop options parameter from
10084         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10085         do_scan_relocs, do_relocate.  Change all callers.
10086         (class Sized_relobj): Drop options parameters from
10087         do_gc_process_relocs, do_scan_relocs, do_relocate,
10088         do_relocate_sections, relocate_sections, emit_relocs_scan,
10089         emit_relocs_scan_reltype.  Change all callers.
10090         (struct Relocate_info): Remove options field and all references to
10091         it.
10092         * reloc.h (class Read_relocs): Remove options constructor
10093         parameter and options_ field.  Change all callers.
10094         (class Gc_process_relocs, class Scan_relocs): Likewise.
10095         (class Relocate_task): Likewise.
10096         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10097         all callers.
10098         (scan_relocatable_relocs): Likewise.
10099         * target.h (class Sized_target): Remove options parameter from
10100         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10101         all callers.
10102         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10103         callers.
10104         * arm.cc: Update functions to remove options parameters.
10105         * i386.cc: Likewise.
10106         * powerpc.cc: Likewise.
10107         * sparc.cc: Likewise.
10108         * x86_64.cc: Likewise.
10109         * testsuite/testfile.cc: Likewise.
10110
10111 2009-10-28  Doug Kwan  <dougkwan@google.com>
10112
10113         * arm.cc (Arm_relobj): New class definition.
10114         (Arm_relobj::scan_sections_for_stubs,
10115         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10116         New method definitions.
10117
10118 2009-10-28  Cary Coutant  <ccoutant@google.com>
10119
10120         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10121         (Plugin::cleanup_done_): New member.
10122         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10123         (Plugin_manager::cleanup_done_): Remove.
10124         (Plugin_manager::add_input_file): Edit error message.
10125         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10126         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10127
10128 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10129
10130         * fileread.cc: (File_read::View::~View): Use the new
10131         data_ownership_ filed.
10132         (File_read::~File_read): Dispose the new whole_file_view_.
10133         (File_read::open): Mmap the whole file if needed.
10134         (File_read::open): Use whole_file_view_ instead of contents_.
10135         (File_read::find_view): Use whole_file_view_ if applicable.
10136         (File_read::do_read): Use whole_file_view_ instead of contents_.
10137         (File_read::make_view): Use whole_file_view_ instead of contents_,
10138         update File_read::View::View call.
10139         (File_read::find_or_make_view): Update File_read::View::View
10140         call.
10141         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10142         remove contents_
10143         (File_read::View::Data_ownership): New enum.
10144         (File_read::View::View): Replace bool mapped_ with Data_ownership
10145         argument.
10146         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10147         (File_read::View::data_ownership_): New field.
10148         (File_read::contents_): Remove (replaced by whole_file_view_).
10149         (File_read::whole_file_view_): New field.
10150         * options.h (class General_options): Add --keep-files-mapped.
10151
10152 2009-10-27  Cary Coutant  <ccoutant@google.com>
10153
10154         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10155         * testsuite/Makefile.am (plugin_test_5): New test case.
10156         * testsuite/Makefile.in: Regenerate.
10157
10158 2009-10-25  Doug Kwan  <dougkwan@google.com>
10159
10160         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10161         from private to protected to allow access by child class.
10162         (Sized_relobj::do_relocate_sections): New method declaration.
10163         (Sized_relobj::relocate_sections): Virtualize.
10164         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10165         Sized_relobj::relocate_sections.  Instantiate template explicitly
10166         for different target sizes and endianity.
10167
10168 2009-10-24  Doug Kwan  <dougkwan@google.com>
10169
10170         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10171         (Arm_input_section::as_arm_input_section): New method.
10172         (Arm_output_section): New class definition.
10173         (Arm_output_section::create_stub_group,
10174         Arm_output_section::group_sections): New method definitions.
10175
10176 2009-10-22  Doug Kwan  <dougkwan@google.com>
10177
10178         * arm.cc (Arm_input_section): New class definition.
10179         (Arm_input_section::init, Arm_input_section:do_write,
10180         Arm_input_section::set_final_data_size,
10181         Arm_input_section::do_reset_address_and_file_offset): New method
10182         definitions.
10183
10184 2009-10-21  Doug Kwan  <dougkwan@google.com>
10185
10186         * arm.cc (Stub_table, Arm_input_section): New forward class
10187         declarations.
10188         (Stub_table): New class defintion.
10189         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10190         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10191         New method definition.
10192
10193 2009-10-21  Doug Kwan  <dougkwan@google.com>
10194
10195         * arm.cc: Update copyright comments.
10196         (Target_arm): New forward class template declaration.
10197         (Arm_address): New type.
10198         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10199         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10200         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10201         constants.
10202         (Insn_template): Same.
10203         (DEF_STUBS): New macro.
10204         (Stub_type): New enum type.
10205         (Stub_template): New class definition.
10206         (Stub): Same.
10207         (Reloc_stub): Same.
10208         (Stub_factory): Same.
10209         (Target_arm::Target_arm): Initialize may_use_blx_ and
10210         should_force_pic_veneer_.
10211         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10212         Target_arm::should_force_pic_veneer,
10213         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10214         Target_arm::using_thumb_only, Target_arm:;default_target): New
10215         method defintions.
10216         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10217         New data member declarations.
10218         (Insn_template::size, Insn_template::alignment): New method defintions.
10219         (Stub_template::Stub_template): New method definition.
10220         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10221         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10222         (Stub_factory::Stub_factory): New method definition.
10223         * gold.h (string_hash): New template.
10224         * output.h (Input_section_specifier::hash_value): Use
10225         gold::string_hash.
10226         (Input_section_specifier::string_hash): Remove.
10227         * stringpool.cc (Stringpool_template::string_hash): Use
10228         gold::string_hash.
10229
10230 2009-10-20  Doug Kwan  <dougkwan@google.com>
10231
10232         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10233         symbols of relaxed input sections.
10234         * output.h (Output_section::find_relaxed_input_section): Make
10235         method public.
10236
10237 2009-10-16  Doug Kwan  <dougkwan@google.com>
10238
10239         * dynobj.cc (Versions::Versions): Initialize version_script_.
10240         Only insert base version symbol definition for a shared object
10241         if version script defines any version versions.
10242         (Versions::define_base_version): New method definition.
10243         (Versions::add_def): Check that base version is not needed.
10244         (Versions::add_need): Define base version lazily.
10245         * dynobj.h (Versions::define_base_version): New method declaration.
10246         (Versions::needs_base_version_): New data member declaration.
10247         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10248         (check_DATA): Add no_version_test.stdout.
10249         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10250         New make rules.
10251         * testsuite/Makefile.in: Regenerate.
10252         * testsuite/no_version_test.c: New file.
10253         * testsuite/no_version_test.sh: Ditto.
10254
10255 2009-10-16  Doug Kwan  <dougkwan@google.com>
10256
10257         * expression.cc (class Segment_start_expression): New class definition.
10258         (Segment_start_expression::value): New method definition.
10259         (script_exp_function_segment_start): Return a new
10260         Segment_start_expression.
10261         * gold/script-c.h (script_saw_segment_start_expression): New function
10262         prototype.
10263         * script-sections.cc (Script_sections::Script_sections): Initialize
10264         SAW_SEGMENT_START_EXPRESSION_ to false.
10265         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10266         and -Tbbs options to specify section addresses if given in
10267         command line and no SEGMENT_START expression is seen in a script.
10268         * script-sections.h (Script_sections::saw_segment_start_expression,
10269         Script_sections::set_saw_segment_start_expression): New method
10270         definition.
10271         (Script_sections::saw_segment_start_expression_): New data member
10272         declaration.
10273         * script.cc (script_saw_segment_start_expression): New function.
10274         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10275         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10276         script_test_7.sh and script_test_8.sh.
10277         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10278         script_test_8.stdout.
10279         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10280         (script_test_6, script_test_6.stdout, script_test_7,
10281         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10282         * Makefile.in: Regenerate.
10283         * testsuite/script_test_6.sh: New file.
10284         * testsuite/script_test_6.t: Same.
10285         * testsuite/script_test_7.sh: Same.
10286         * testsuite/script_test_7.t: Same.
10287         * testsuite/script_test_8.sh: Same.
10288
10289 2009-10-16  Doug Kwan  <dougkwan@google.com>
10290
10291         * output.cc (Output_segment::set_section_list_address): Cast
10292         expressions to unsigned long long type to avoid format warnings.
10293
10294 2009-10-15  Ian Lance Taylor  <iant@google.com>
10295
10296         * script.cc (Script_options::add_symbol_assignment): Always add a
10297         dot assignment to script_sections_.
10298         * script-sections.cc (Script_sections::add_dot_assignment):
10299         Initialize if necessary.
10300
10301         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10302         program headers with no load segment if there is a linker script.
10303
10304         * layout.cc (Layout::set_segment_offsets): Align the file offset
10305         to the segment aligment for -N or -n with no load segment.
10306         * output.cc (Output_segment::add_output_section): Don't crash if
10307         the first section is a TLS section.
10308         (Output_segment::set_section_list_addresses): Print an error
10309         message if the address moves backward in a linker script.
10310         * script-sections.cc
10311         (Output_section_element_input::set_section_addresses): Don't
10312         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10313         (Orphan_output_section::set_section_addresses): Likewise.
10314
10315 2009-10-15  Doug Kwan  <dougkwan@google.com>
10316
10317         * layout.cc (Layout::finish_dynamic_section): Generate tags
10318         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10319         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10320         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10321
10322 2009-10-14  Ian Lance Taylor  <iant@google.com>
10323
10324         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10325         fields.
10326         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10327         data_shdr fields of relinfo.
10328         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10329         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10330         R_386_TLS_LDO_32, adjust based on section flags.
10331         (Target_i386::Relocate::fix_up_ldo): Remove.
10332
10333 2009-10-13  Ian Lance Taylor  <iant@google.com>
10334
10335         Add support for -pie.
10336         * options.h (class General_options): Add -pie and
10337         --pic-executable.
10338         (General_options::output_is_position_independent): Test -pie.
10339         (General_options::output_is_executable): Return true if not shared
10340         and not relocatable.
10341         (General_options::output_is_pie): Remove.
10342         * options.cc (General_options::finalize): Reject incompatible uses
10343         of -pie.
10344         * gold.cc (queue_middle_tasks): A -pie link is not static.
10345         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10346         * symtab.cc (Symbol::final_value_is_known): Return false if
10347         output_is_position_independent.
10348         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10349         output_is_position_independent.
10350         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10351         output_is_position_independent.
10352         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10353         output_is_position_independent.
10354         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10355         two_file_pie_test.
10356         (basic_pie_test.o, basic_pie_test): New targets.
10357         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10358         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10359         (two_file_pie_test): New target.
10360         * testsuite/Makefile.in: Rebuild.
10361         * README: Remove note saying that -pie is not supported.
10362
10363 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10364
10365         * options.h (class General_options): Add -init and -fini.
10366         * layout.cc (Layout::finish_dynamic_section): Emit
10367         given init and fini functions.
10368
10369 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10370
10371         * gc.h (gc_process_relocs): Check if icf is enabled using new
10372         function.
10373         * gold.cc (queue_initial_tasks): Likewise.
10374         (queue_middle_tasks): Likewise.
10375         * object.cc (do_layout): Likewise.
10376         * symtab.cc (is_section_folded): Likewise.
10377         * main.cc (main): Likewise.
10378         * reloc.cc (Read_relocs::run): Likewise.
10379         (Sized_relobj::do_scan_relocs): Likewise.
10380         * icf.cc (is_function_ctor_or_dtor): New function.
10381         (Icf::find_identical_sections): Check if function is ctor or dtor when
10382         safe icf is chosen.
10383         * options.h (General_options::icf): Change option to be an enum.
10384         (Icf_status): New enum.
10385         (icf_enabled): New method.
10386         (icf_safe_folding): New method.
10387         (set_icf_status): New method.
10388         (icf_status_): New variable.
10389         * (options.cc) (General_options::finalize): Set icf_status_.
10390         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10391         icf_test and icf_keep_unique_test to use the --icf enum flag.
10392         * testsuite/icf_safe_test.sh: New file.
10393         * testsuite/icf_safe_test.cc: New file.
10394
10395 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10396
10397         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10398         includes to gc.h and icf.h.
10399         * arm.cc: Include gc.h.
10400         * gold.cc: Likewise.
10401         * i386.cc: Likewise.
10402         * powerpc.cc: Likewise.
10403         * sparc.cc: Likewise.
10404         * x86_64.cc: Likewise.
10405         * gc.h: Include icf.h.
10406
10407 2009-10-11  Ian Lance Taylor  <iant@google.com>
10408
10409         * plugin.cc: Include "gold.h" before other header files.
10410
10411 2009-10-10  Chris Demetriou  <cgd@google.com>
10412
10413         * options.h (Input_file_argument::Input_file_type): New enum.
10414         (Input_file_argument::is_lib_): Replace with...
10415         (Input_file_argument::type_): New member.
10416         (Input_file_argument::Input_file_argument): Take Input_file_type
10417         'type' rather than boolean 'is_lib' as second argument.
10418         (Input_file_argument::is_lib): Use type_.
10419         (Input_file_argument::is_searched_file): New function.
10420         (Input_file_argument::may_need_search): Handle is_searched_file.
10421         * options.cc (General_options::parse_library): Support -l:filename.
10422         (General_options::parse_just_symbols): Update for Input_file_argument
10423         changes.
10424         (Command_line::process): Likewise.
10425         * archive.cc (Archive::get_file_and_offset): Likewise.
10426         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10427         * script.cc (read_script_file, script_add_file): Likewise.
10428         * fileread.cc (Input_file::Input_file): Likewise.
10429         (Input_file::will_search_for): Handle is_searched_file.
10430         (Input_file::open): Likewise.
10431         * readsyms.cc (Read_symbols::get_name): Likewise.
10432         * testsuite/Makefile.am (searched_file_test): New test.
10433         * testsuite/Makefile.in: Regenerate.
10434         * testsuite/searched_file_test.cc: New file.
10435         * testsuite/searched_file_test_lib.cc: New file.
10436
10437 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10438             Ian Lance Taylor  <iant@google.com>
10439
10440         * descriptor.cc: Include <cstdio> and "binary-io.h".
10441         (Descriptors::open): Open the files in binary mode always.
10442         * script.cc (Lex::get_token): Treat \r as whitespace.
10443
10444 2009-10-09  Ian Lance Taylor  <iant@google.com>
10445
10446         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10447
10448 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10449             Ian Lance Taylor  <iant@google.com>
10450
10451         * configure.ac: Check for readv function also.
10452         * fileread.cc (readv): Define if not HAVE_READV.
10453         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10454         does not exist.
10455         * config.in: Regenerate.
10456         * configure: Regenerate.
10457
10458 2009-10-09  Doug Kwan  <dougkwan@google.com>
10459
10460         * layout.cc (Layout::make_output_section): Call target hook to make
10461         ordinary output section.
10462         (Layout::finalize): Adjust parameter list of call the
10463         Target::may_relax().
10464         * layout.h (class Layout::section_list): New method.
10465         * merge.h (Output_merge_base::entsize): Change visibility to public.
10466         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10467         New methods.
10468         (Output_merge_string::do_is_string): New method.
10469         * object.cc (Sized_relobj::do_setup): renamed from
10470         Sized_relobj::set_up.
10471         * object.h (Sized_relobj::adjust_shndx,
10472         Sized_relobj::initializ_input_to_output_maps,
10473         Sized_relobj::free_input_to_output_maps): Change visibilities to
10474         protected.
10475         (Sized_relobj::setup): Virtualize.
10476         (Sized_relobj::do_setup): New method declaration.
10477         (Sized_relobj::invalidate_section_offset,
10478         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10479         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10480         * options.cc (parse_int): New function.
10481         * options.h (parse_int): New declaration.
10482         (DEFINE_int): New macro.
10483         (stub_group_size): New option.
10484         * output.cc (Output_section::Output_section): Initialize memebers
10485         merge_section_map_, merge_section_by_properties_map_,
10486         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10487         (Output_section::add_input_section): Handled deferred code-fill
10488         generation and remove an old comment.
10489         (Output_section::add_relaxed_input_section): New method definition.
10490         (Output_section::add_merge_input_section): Use merge section by
10491         properties map to speed to search.  Update merge section maps
10492         as appropriate.
10493         (Output_section::build_relaxation_map): New method definition.
10494         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10495         Same.
10496         (Output_section::relax_input_section): Renamed to
10497         Output_section::convert_input_sections_to_relaxed_sections and change
10498         interface to take a vector of pointers to relaxed sections.
10499         (Output_section::find_merge_section,
10500         Output_section::find_relaxed_input_section): New method definitions.
10501         (Output_section::is_input_address_mapped,
10502         Output_section::output_offset, Output_section::output_address):
10503         Use output section data maps to speed up searching.
10504         (Output_section::find_starting_output_address): Add comments.
10505         (Output_section::do_write,
10506         Output_section::write_to_postprocessing_buffer): Do code-fill
10507         generation as appropriate.
10508         (Output_section::get_input_sections): Invalidate relaxed input section
10509         map.
10510         (Output_section::restore_states): Adjust type of checkpoint .
10511         Invalidate relaxed input section map.
10512         * output.h (Output_merge_base): New class declaration.
10513         (Input_section_specifier): New class defintion.
10514         (class Output_relaxed_input_section) Change base class to
10515         Output_section_data_build.
10516         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10517         base class initializer.
10518         (Output_section::add_relaxed_input_section): New method declaration.
10519         (Output_section::Input_section): Change visibility to protected.
10520         (Output_section::Input_section::relobj,
10521         Output_section::Input_section::shndx): Handle relaxed input sections.
10522         Output_section::input_sections) Change visibility to protected.  Also
10523         define overload to return a non-const pointer.
10524         (Output_section::Merge_section_properties): New class defintion.
10525         (Output_section::Merge_section_by_properties_map,
10526         Output_section::Output_section_data_by_input_section_map,
10527         Output_section::Relaxation_map): New types.
10528         (Output_section::relax_input_section): Rename method to
10529         Output_section::convert_input_sections_to_relaxed_sections and change
10530         interface to take a vector of relaxed section pointers.
10531         (Output_section::find_merge_section,
10532         Output_section::find_relaxed_input_section,
10533         Output_section::build_relaxation_map,
10534         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10535         New method declarations.
10536         (Output_section::merge_section_map_
10537         Output_section::merge_section_by_properties_map_,
10538         Output_section::relaxed_input_section_map_,
10539         Output_section::is_relaxed_input_section_map_valid_,
10540         Output_section::generate_code_fills_at_write_): New data members.
10541         * script-sections.cc
10542         (Output_section_element_input::set_section_addresses): Call
10543         current_data_size and addralign methods of relaxed input sections.
10544         (Orphan_output_section::set_section_addresses): Call current_data_size
10545         and addralign methods of relaxed input sections.
10546         * symtab.cc (Symbol_table::compute_final_value): Extract template
10547         from the body of Symbol_table::sized_finalize_symbol.
10548         (Symbol_table::sized_finalized_symbol): Call
10549         Symbol_table::compute_final_value.
10550         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10551         (Symbol_table::compute_final_value): New templated method declaration.
10552         * target.cc (Target::do_make_output_section): New method defintion.
10553         * target.h (Target::make_output_section): New method declaration.
10554         (Target::relax): Add more parameters for input objects, symbol table
10555         and layout.  Adjust call to do_relax.
10556         (Target::do_make_output_section): New method declaration.
10557         (Target::do_relax): Add parameters for input objects, symbol table
10558         and layout.
10559
10560 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10561
10562         * pread.c: Include stdio.h.
10563
10564 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10565
10566         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10567         defined.
10568
10569 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10570
10571         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10572         Change read_shndx type to unsigned int.
10573         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10574         int.
10575         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10576         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10577         Change read_shndx type to unsigned int.
10578         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10579         int.
10580         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10581         * layout.cc (Layout::create_symtab_sections): Cast the result of
10582         local_symcount * symsize to off_t in the gold_assert.
10583
10584 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10585
10586         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10587         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10588         R_ARM_BASE_ABS.
10589         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10590         (Arm_relocate_functions::thm_abs5): New function.
10591         (Arm_relocate_functions::abs12): New function.
10592         (Arm_relocate_functions::abs16): New function.
10593         (Arm_relocate_functions::base_abs): New function.
10594         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10595         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10596         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10597         R_ARM_BASE_ABS.
10598         (Scan::global): Likewise.
10599         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10600         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10601         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10602         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10603         R_ARM_BASE_ABS.
10604
10605 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10606
10607         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10608         (Arm_relocate_functions::movt_prel): New function.
10609         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10610         (Arm_relocate_functions::thm_movt_prel): New function.
10611         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10612         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10613         (Scan::global, Relocate::relocate): Likewise.
10614         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10615
10616 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10617
10618         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10619         Incremental_checker.
10620         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10621         unsigned int.
10622         (class Incremental_inputs_header): New class.
10623         (Incremental_inputs_header_writer): Edit comment.
10624         (Incremental_inputs_entry): New class.
10625         (Incremental_inputs_entry_writer): Edit comment.
10626         (Sized_incremental_binary::do_find_incremental_inputs_section):
10627         Add *strtab_shndx parameter, fill it.
10628         (Sized_incremental_binary::do_check_inputs): New method.
10629         (Incremental_checker::can_incrementally_link_output_file): Use
10630         Sized_incremental_binary::check_inputs.
10631         (Incremental_inputs::report_command_line): Save command line in
10632         command_line_.
10633         * incremental.h:
10634         (Incremental_binary::find_incremental_inputs_section): New
10635         method.
10636         (Incremental_binary::do_find_incremental_inputs_section): Add
10637         strtab_shndx parameter.
10638         (Incremental_binary::do_check_inputs): New pure virtual method.
10639         (Sized_incremental_binary::do_check_inputs): Declare.
10640         (Incremental_checker::Incremental_checker): Add incremental_inputs
10641         parameter, use it to initialize incremental_inputs_.
10642         (Incremental_checker::incremental_inputs_): New field.
10643         (Incremental_checker::command_line): New method.
10644         (Incremental_checker::inputs): New method.
10645         (Incremental_checker::command_line_): New field.
10646
10647 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10648
10649         * incremental.cc: Include <cstdarg> and "target-select.h".
10650         (vexplain_no_incremental): New function.
10651         (explain_no_incremental): New function.
10652         (Incremental_binary::error): New method.
10653         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10654         method.
10655         (make_sized_incremental_binary): New function.
10656         (open_incremental_binary): New function.
10657         (can_incrementally_link_file): Add checks if output is ELF and has
10658         inputs section.
10659         * incremental.h: Include "elfcpp_file.h" and "output.h".
10660         (Incremental_binary): New class.
10661         (Sized_incremental_binary): New class.
10662         (open_incremental_binary): Declare.
10663         * object.cc (is_elf_object): Use
10664         elfcpp::Elf_recognizer::is_elf_file.
10665         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10666         * output.h (Output_file::filesize): New method.
10667
10668 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10669
10670         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10671         New function.
10672         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10673         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10674         function.
10675         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10676         function.
10677         (Arm_relocate_functions::movw_abs_nc): New function.
10678         (Arm_relocate_functions::movt_abs): New function.
10679         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10680         (Arm_relocate_functions::thm_movt_abs): New function.
10681         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10682         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10683         (Scan::global): Likewise.
10684         (Relocate::relocate): Likewise.
10685         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10686
10687 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10688
10689         * arm.cc (Arm_relocate_functions::got_prel) New function.
10690         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10691         (Relocate::relocate): Likewise.
10692         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10693
10694 2009-10-06  Ian Lance Taylor  <iant@google.com>
10695
10696         * options.h (class General_options): Define
10697         split_stack_adjust_size parameter.
10698         * object.h (class Object): Add uses_split_stack_ and
10699         has_no_split_stack_ fields.  Add uses_split_stack and
10700         has_no_split_stack accessor functions.  Declare
10701         handle_split_stack_section.
10702         (class Reloc_symbol_changes): Define.
10703         (class Sized_relobj): Define Function_offsets.  Declare
10704         split_stack_adjust, split_stack_adjust_reltype, and
10705         find_functions.
10706         * object.cc (Object::handle_split_stack_section): New function.
10707         (Sized_relobj::do_layout): Call handle_split_stack_section.
10708         * dynobj.cc (Sized_dynobj::do_layout): Call
10709         handle_split_stack_section.
10710         * reloc.cc (Sized_relobj::relocate_sections): Call
10711         split_stack_adjust for executable sections in split_stack
10712         objects.  Pass reloc_map to relocate_section.
10713         (Sized_relobj::split_stack_adjust): New function.
10714         (Sized_relobj::split_stack_adjust_reltype): New function.
10715         (Sized_relobj::find_functions): New function.
10716         * target-reloc.h: Include "object.h".
10717         (relocate_section): Add reloc_symbol_changes parameter.  Change
10718         all callers.
10719         * target.h (class Target): Add calls_non_split method.  Declare
10720         do_calls_non_split virtual method.  Declare match_view and
10721         set_view_to_nop.
10722         * target.cc: Include "elfcpp.h".
10723         (Target::do_calls_non_split): New function.
10724         (Target::match_view): New function.
10725         (Target::set_view_to_nop): New function.
10726         * gold.cc (queue_middle_tasks): Give an error if mixing
10727         split-stack and non-split-stack objects with -r.
10728         * i386.cc (Target_i386::relocate_section): Add
10729         reloc_symbol_changes parameter.
10730         (Target_i386::do_calls_non_split): New function.
10731         * x86_64.cc (Target_x86_64::relocate_section): Add
10732         reloc_symbol_changes parameter.
10733         (Target_x86_64::do_calls_non_split): New function.
10734         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10735         parameter.
10736         * powerpc.cc (Target_powerpc::relocate_section): Add
10737         reloc_symbol_changes parameter.
10738         * sparc.cc (Target_sparc::relocate_section): Add
10739         reloc_symbol_changes parameter.
10740         * configure.ac: Call AM_CONDITIONAL for the default target.
10741         * configure: Rebuild.
10742         * testsuite/Makefile.am (TEST_AS): New variable.
10743         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10744         (check_DATA): Add split_i386 and split_x86_64 files.
10745         (SPLIT_DEFSYMS): Define.
10746         (split_i386_[1234n].o): New targets.
10747         (split_i386_[124]): New targets.
10748         (split_i386_[1234r].stdout): New targets.
10749         (split_x86_64_[1234n].o): New targets.
10750         (split_x86_64_[124]): New targets.
10751         (split_x86_64_[1234r].stdout): New targets.
10752         (MOSTLYCLEANFILES): Add new executables.
10753         * testsuite/split_i386.sh: New file.
10754         * testsuite/split_x86_64.sh: New file.
10755         * testsuite/split_i386_1.s: New file.
10756         * testsuite/split_i386_2.s: New file.
10757         * testsuite/split_i386_3.s: New file.
10758         * testsuite/split_i386_4.s: New file.
10759         * testsuite/split_i386_n.s: New file.
10760         * testsuite/split_x86_64_1.s: New file.
10761         * testsuite/split_x86_64_2.s: New file.
10762         * testsuite/split_x86_64_3.s: New file.
10763         * testsuite/split_x86_64_4.s: New file.
10764         * testsuite/split_x86_64_n.s: New file.
10765         * testsuite/testfile.cc (Target_test): Update relocation_section
10766         function.
10767         * testsuite/Makefile.in: Rebuild.
10768
10769 2009-10-06  Ian Lance Taylor  <iant@google.com>
10770
10771         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10772         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10773         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10774         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10775         the address on ldo_addrs_.
10776         (Target_i386::Relocate::fix_up_ldo): New function.
10777
10778 2009-10-06   Rafael Espindola  <espindola@google.com>
10779
10780         * plugin.cc (add_input_library): New.
10781         (Plugin::load): Add add_input_library to tv.
10782         (Plugin_manager::add_input_file): Add the is_lib argument.
10783         (add_input_file): Update call to Plugin_manager::add_input_file.
10784         (add_input_library): New.
10785         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10786
10787 2009-09-30  Doug Kwan  <dougkwan@google.com>
10788
10789         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10790         symbol and call Symbol::may_need_copy_reloc to determine if
10791         a copy reloc is needed.
10792         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10793         nocopyreloc is given in command line.
10794         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10795         given in command line.
10796         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10797         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10798         of the removed Target_i386::may_need_copy_reloc.
10799         * options.h (copyreloc): New option with default value false.
10800         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10801         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10802         instead of the removed Target_powerpc::may_need_copy_reloc.
10803         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10804         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10805         instead of the removed Target_sparc::may_need_copy_reloc.
10806         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10807         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10808         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10809         instead of the removed Target_x86_64::may_need_copy_reloc.
10810
10811 2009-09-30  Ian Lance Taylor  <iant@google.com>
10812
10813         * object.h (class Object): Remove target_ field, and target,
10814         sized_target, and set_target methods.
10815         (Object::sized_target): Remove.
10816         (class Sized_relobj): Update declarations.  Remove sized_target.
10817         * object.cc (Sized_relobj::setup): Remove target parameter.
10818         Change all callers.
10819         (Input_objects::add_object): Don't do anything with the target.
10820         (make_elf_sized_object): Add punconfigured parameter.  Change all
10821         callers.  Set or test parameter target.
10822         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10823         Change all callers.
10824         * parameters.cc (Parameters::set_target): Change parameter type to
10825         be non-const.
10826         (Parameters::default_target): Remove.
10827         (set_parameters_target): Change parameter type to be non-const.
10828         (parameters_force_valid_target): New function.
10829         (parameters_clear_target): New function.
10830         * parameters.h (class Parameters): Update declarations.  Remove
10831         default_target method.  Add sized_target and clear_target
10832         methods.  Change target_ to be non-const.
10833         (set_parameters_target): Update declaration.
10834         (parameters_force_valid_target): Declare.
10835         (parameters_clear_target): Declare.
10836         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10837         as NULL if we aren't searching.
10838         (Add_symbols::run): Don't check for compatible target.
10839         * fileread.cc (Input_file::open_binary): Call
10840         parameters_force_valid_target.
10841         * gold.cc (queue_middle_tasks): Likewise.
10842         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10843         set_target on object.
10844         * dynobj.h (class Sized_dynobj): Update declarations.
10845         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10846         make_elf_object returns NULL.
10847         (Archive::include_member): Don't check whether object target is
10848         compatible.
10849         * output.cc (Output_section::add_input_section): Get target from
10850         parameters.
10851         (Output_section::relax_input_section): Likewise.
10852         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10853         parameters.
10854         (Sized_relobj::do_scan_relocs): Likewise.
10855         (Sized_relobj::relocate_sections): Likewise.
10856         * resolve.cc (Symbol_table::resolve): Likewise.
10857         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10858         parameter.  Change all callers.
10859         (Symbol_table::add_from_object): Get target from parameters.
10860         (Symbol_table::add_from_relobj): Don't check object target.
10861         (Symbol_table::add_from_dynobj): Likewise.
10862         (Symbol_table::define_special_symbol): Get target from
10863         parameters.
10864         * symtab.h (class Symbol_table): Update declaration.
10865         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10866         parameter.  Change all callers.  Clear parameter target.
10867         (Binary_test): Test target here.
10868         * testsuite/object_unittest.cc (gold_testsuite): Remove
10869         target_test_pointer parameter.  Change all callers.
10870         (Object_test): Test target here.
10871
10872 2009-09-26  Ian Lance Taylor  <iant@google.com>
10873
10874         * testsuite/initpri1.c: Don't try to use constructor priorities if
10875         compiling with gcc before 4.3.
10876
10877 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10878
10879         * testsuite/retain_symbols_file_test.sh (check_present): Change
10880         output file name to retain_symbols_file_test.stdout.
10881         (check_absent): Likewise.
10882
10883 2009-09-18  Craig Silverstein  <csilvers@google.com>
10884
10885         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10886         * options.cc: Include <cerrno> and <fstream>.
10887         (General_options::finalize): Parse -retain-symbols-file tag.
10888         * options.h: New flag.
10889         (General_options): New method should_retain_symbol, new
10890         variable symbols_to_retain.
10891         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10892         should_retain_symbol map.
10893         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10894         * testsuite/Makefile.in: Regenerate.
10895         * testsuite/retain_symbols_file_test.sh: New file.
10896
10897 2009-09-18  Nick Clifton  <nickc@redhat.com>
10898
10899         * po/es.po: Updated Spanish translation.
10900
10901 2009-09-17  Doug Kwan  <dougkwan@google.com>
10902
10903         * debug.h (DEBUG_RELAXATION): New constant.
10904         (DEBUG_ALL): Add DEBUG_RELAXATION.
10905         (debug_string_to_enum): Add relaxation debug option.
10906         * layout.cc
10907         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10908         Layout::Relaxation_debug_check::read_sections,
10909         Layout::Relaxation_debug_check::read_sections): New method definitions.
10910         (Layout::Layout): Initialize data members
10911         record_output_section_data_from_scrips_,
10912         script_output_section_data_list_ and relaxation_debug_check_.
10913         (Layout::save_segments, Layout::restore_segments,
10914         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10915         Layout::relaxation_loop_body): New method definitions.
10916         (Layout::finalize): Support relaxation.  Move section layout code to
10917         Layout::relaxation_loop_body.
10918         (Layout::set_asection_address_from_script): Move code for orphan
10919         section placement out.
10920         (Layout::place_orphan_sections_in_script): New method definition.
10921         * layout.h (Output_segment_headers, Output_file_header):
10922         New forward class declarations.
10923         (Layout::~Layout): Define.
10924         (Layout::new_output_section_data_from_script): New method definition.
10925         (Layout::place_orphan_sections_in_script): New method declaration.
10926         (Layout::Segment_states): New type declaration.
10927         (Layout::save_segments, Layout::restore_segments,
10928         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10929         Layout::relaxation_loop_body): New method declarations.
10930         (Layout::Output_section_data_list): New type declaration.
10931         (Layout::Relaxation_debug_check): New class definition.
10932         (Layout::record_output_section_data_from_script_,
10933         Layout::script_output_section_data_list_, Layout::segment_states_,
10934         Layout::relaxation_debug_check_): New data members.
10935         * output.cc: (Output_section_headers::do_size): New method definition.
10936         (Output_section_headers::Output_section_headers): Move size
10937         computation to Output_section_headers::do_size.
10938         (Output_segment_headers::do_size): New method definition.
10939         (Output_file_header::Output_file_header): Move size computation to
10940         Output_file_header::do_size and call it.
10941         (Output_file_header::do_size): New method definition.
10942         (Output_data_group::Output_data_group): Adjust call to
10943         Output_section_data.
10944         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10945         (Output_symtab_xindex::do_write): Add array bound check.
10946         (Output_section::Input_section::print_to_mapfile): Handle
10947         RELAXED_INPUT_SECTION_CODE.
10948         (Output_section::Output_section): Initialize data member checkpoint_.
10949         (Output_section::~Output_section): Delete checkpoint object pointed
10950         by checkpoint_.
10951         (Output_section::add_input_section): Always add an Input_section if
10952         relaxing.
10953         (Output_section::add_merge_input_section): Add assert.
10954         (Output_section::relax_input_section): New method definition.
10955         (Output_section::set_final_data_size): Set load address to zero for
10956         an unallocated section.
10957         (Output_section::do_address_and_file_offset_have_reset_values):
10958         New method definition.
10959         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10960         Handle relaxed input section.
10961         (Output_section::sort_attached_input_sections): Checkpoint input
10962         section list lazily.
10963         (Output_section::get_input_sections): Change type of input_sections to
10964         list of Simple_input_section pointers.  Checkpoint input section list
10965         lazily.  Also handle relaxed input sections.
10966         (Output_section::add_input_section_for_script): Take a reference to
10967         a Simple_input_section object instead of Relobj pointer and section
10968         index as parameter.  Handle relaxed input sections.
10969         (Output_section::save_states, Output_section::restore_states): New
10970         method definitions.
10971         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10972         (Output_data::is_data_size_fixed): New method definition.
10973         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10974         if it is fixed.
10975         (Output_data::address_and_file_offset_have_reset_values): New method
10976         definition.
10977         (Output_data::do_address_and_file_offset_have_reset_values): New method
10978         definition.
10979         (Output_data::set_data_size): Check that data size is not fixed.
10980         (Output_data::fix_data_size): New method definition.
10981         (Output_data::is_data_size_fixed_): New data member.
10982         (Output_section_headers::set_final_data_size): New method definition.
10983         (Output_section_headers::do_size): New method declaration.
10984         (Output_segment_headers::set_final_data_size): New method definition.
10985         (Output_segment_headers::do_size): New method declaration.
10986         (Output_file_header::set_final_data_size)::New method definition.
10987         (Output_file_header::do_size)::New method declaration.
10988         (Output_section_data::Output_section_data): Add new parameter
10989         is_data_size_fixed and use it to fix data size.
10990         (Output_data_const::Output_data_const): Adjust call to base class
10991         constructor and fix data size.
10992         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10993         base class constructor and fix data size.
10994         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10995         base class constructor and fix data size.
10996         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10997         class constructor and fix data size.
10998         (Output_data_group::set_final_data_size): New method definition.
10999         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11000         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11001         class constructor and fix data size.
11002         (Output_relaxed_input_section): New class definition.
11003         (Output_section::Simple_input_section): New class definition.
11004         (Output_section::get_input_sections): Adjust parameter list.
11005         (Output_section::add_input_section_for_script): Same.
11006         (Output_section::save_states, Output_section::restore_states,
11007         Output_section::do_address_and_file_offset_have_reset_values,
11008         (Output_section::Input_section::Input_section): Handle
11009         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11010         Output_relaxed_input_section.
11011         (Output_section::Input_section::is_input_section,
11012         Output_section::Input_section::set_output_section): Handle relaxed
11013         input section.
11014         (Output_section::Input_section::is_relaxed_input_section,
11015         Output_section::Input_section::output_section_data,
11016         Output_section::Input_section::relaxed_input_section): New method
11017         definitions.
11018         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11019         value.
11020         (Output_section::Input_section::u1_): Update comments.
11021         (Output_section::Input_section::u2_): Add new union member poris.
11022         (Output_section::Checkpoint_output_section): New classs definition.
11023         (Output_section::relax_input_section): New method declaration.
11024         (Output_section::checkpoint_): New data member.
11025         (Output_segment): Update comments.
11026         (Output_segment::Output_segment): Un-privatize copy constructor.
11027         (Output_segment::operator=): Un-privatize.
11028         * script-sections.cc (Output_section_element::Input_section_list):
11029         Change element type to Output_section::Simple_input_section.
11030         (Output_section_element_dot_assignment::set_section_addresses):
11031         Register output section data for relaxation clean up.
11032         (Output_data_exression::Output_data_expression): Adjust call to base
11033         constructor to fix data size.
11034         (Output_section_element_data::set_section_addresses): Register
11035         Output_data_expression object for relaxation clean up.
11036         (struct Input_section_info): Replace Relobj pointer and section index
11037         pair with Output_section::Simple_input_section and Convert struct to a
11038         class.
11039         (Input_section_sorter::operator()): Adjust access to
11040         Input_section_info data member to use accessors.
11041         (Output_section_element_input::set_section_addresses): Use layout
11042         parameter.  Adjust code to use Output_section::Simple_input_section
11043         and Input_secction_info classes.  Register filler for relaxation
11044         clean up.
11045         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11046         and section index pair with Output_section::Simple_input_section
11047         class.  Adjust code accordingly.
11048         (Phdrs_element::release_segment): New method definition.
11049         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11050         segment list.
11051         (Script_sections::release_segments): New method definition.
11052         * gold/script-sections.h (Script_sections::release_segments): New
11053         method declaration.
11054         * gold/target.h (Target::may_relax, Target::relax,
11055         Target::do_may_relax, Target::do_relax): New method definitions.
11056
11057 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11058
11059         * arm.cc (has_signed_unsigned_overflow): New function.
11060         (Arm_relocate_functions::abs8): New function.
11061         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11062         (Target_arm::Scan::global): Likewise.
11063         (Target_arm::relocate::relocate): Likewise.
11064         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11065         Likewise.
11066
11067 2009-09-16  Cary Coutant  <ccoutant@google.com>
11068
11069         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11070         * testsuite/Makefile.in: Regenerate.
11071
11072 2009-09-11  Nick Clifton  <nickc@redhat.com>
11073
11074         * po/gold.pot: Updated by the Translation project.
11075
11076 2009-09-08  Cary Coutant  <ccoutant@google.com>
11077
11078         * output.cc (Output_file::open): Add execute permission to empty file.
11079         * testsuite/Makefile.am (permission_test): New test.
11080         * testsuite/Makefile.in: Regenerate.
11081
11082 2009-09-02  Ian Lance Taylor  <iant@google.com>
11083
11084         * output.cc (Output_file::resize): Call map_no_anonymous rather
11085         than map.
11086
11087 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11088
11089         * gold.cc: Include "incremental.h".
11090         (queue_initial_tasks): Call Incremental_checker methods.
11091         * incremental.cc: Include "output.h".
11092         (Incremental_checker::can_incrementally_link_output_file): New
11093         method.
11094         * incremental.h (Incremental_checker): New class.
11095
11096         * output.cc (Output_file::open_for_modification): New method.
11097         (Output_file::map_anonymous): Changed return type to bool.  Record
11098         map in base_ field.
11099         (Output_file::map_no_anonymous): New method, broken out of map.
11100         (Output_file::map): Use map_no_anonymous and map_anonymous.
11101         * output.h (class Output_file): Update declarations.
11102
11103 2009-08-24  Cary Coutant  <ccoutant@google.com>
11104
11105         * options.h (Command_line::Pre_options): New class.
11106         (Command_line::pre_options): New member.
11107         * options.cc (gold::options::ready_to_register): New variable.
11108         (One_option::register_option): Do nothing if not registering options.
11109         Assert if same short option registered twice.
11110         (General_options::General_options): Turn off option registration when
11111         done constructing.
11112         (Command_line::Pre_options::Pre_options): New constructor.
11113
11114 2009-08-24  Cary Coutant  <ccoutant@google.com>
11115
11116         * options.h (General_options::no_keep_memory): Remove incorrect
11117         short option.
11118
11119 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11120
11121         * Makefile.am (am__skiplex, am__skipyacc): New.
11122         * Makefile.in: Regenerate.
11123
11124 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11125
11126         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11127         (INCLUDES): ... this.
11128         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11129         (AM_CPPFLAGS): Renamed from ...
11130         (INCLUDE): ... this.
11131         * Makefile.in, testsuite/Makefile.in: Regenerate.
11132
11133         * Makefile.in: Regenerate.
11134         * aclocal.m4: Likewise.
11135         * config.in: Likewise.
11136         * configure: Likewise.
11137         * testsuite/Makefile.in: Likewise.
11138
11139         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11140         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11141         * Makefile.in: Regenerate.
11142         * testsuite/Makefile.in: Regenerate.
11143
11144 2009-08-19  Cary Coutant  <ccoutant@google.com>
11145
11146         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11147         symbols in shared libraries overridden by hidden or internal symbols
11148         in the main program.
11149
11150 2009-08-19  Chris Demetriou  <cgd@google.com>
11151
11152         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11153         checking source file names in error messages.
11154
11155 2009-08-18  Doug Kwan  <dougkwan@google.com>
11156
11157         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11158         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11159         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11160         an elfcpp::Ehdr as parameter.
11161         * object.cc (Object::set_target): Remove the version that looks up
11162         a target and sets it.
11163         (Sized_relobj::setup): Take a Target object instead of
11164         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11165         (make_elf_sized_object): Find target and ask target to
11166         make an ELF object.
11167         * object.h: (Object::set_target): Remove the version that looks up
11168         a target and sets it.
11169         (Sized_relobj::setup): Take a Target object instead of
11170         an elfcpp:Ehdr as parameter.
11171         * target.cc: Include dynobj.h.
11172         (Target::do_make_elf_object_implementation): New.
11173         (Target::do_make_elf_object): New.
11174         * target.h (Target::make_elf_object): New template declaration.
11175         (Target::do_make_elf_object): New method declarations.
11176         (Target::do_make_elf_object_implementation): New template declaration.
11177
11178 2009-08-14  Ian Lance Taylor  <iant@google.com>
11179
11180         * gold.h (FUNCTION_NAME): Define.
11181         (gold_unreachable): Use FUNCTION_NAME.
11182
11183 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11184
11185         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11186         symbol in the --keep-unique list is not found.
11187
11188 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11189
11190         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11191         been maked as --keep-unique.
11192         (Icf::unfold_section): New function.
11193         * icf.h (Icf::unfold_section): New function.
11194         * options.h (General_options::keep_unique): New option.
11195         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11196         * testsuite/Makefile.in: Regenerate.
11197         * testsuite/icf_keep_unique_test.sh: New file.
11198         * testsuite/icf_keep_unique_test.cc: New file.
11199
11200 2009-08-12  Cary Coutant  <ccoutant@google.com>
11201
11202         PR 10471
11203         * resolve.cc (Symbol_table::resolve): Check for references from
11204         dynamic objects to hidden and internal symbols.
11205         * testsuite/Makefile.am (hidden_test.sh): New test.
11206         * testsuite/Makefile.in: Regenerate.
11207         * testsuite/hidden_test.sh: New script.
11208         * testsuite/hidden_test_1.c: New test source.
11209         * testsuite/hidden_test_main.c: New test source.
11210
11211 2009-08-11  Doug Kwan  <dougkwan@google.com>
11212
11213         * arm.cc: Update comments.
11214         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11215         segment to locate the .ARM.exidx section if present.
11216
11217 2009-08-09  Doug Kwan  <dougkwan@google.com>
11218
11219         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11220         patch.
11221
11222 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11223         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11224         compiler warnings.
11225
11226 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11227
11228         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11229         valid tls_segment only for non-debug-section relocations.
11230         * testsuite/Makefile.am: Add gc_tls_test.
11231         * testsuite/Makefile.in: Regenerate.
11232         * testsuite/gc_tls_test.cc: New file.
11233         * testsuite/gc_tls_test.sh: New file.
11234
11235 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11236
11237         * icf.cc: New file.
11238         * icf.h: New file.
11239         * Makefile.am (CCFILES): Add icf.cc.
11240         (HFILES): Add icf.h
11241         * Makefile.in: Regenerate.
11242         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11243         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11244         section, symbol and addend information for the relocs.
11245         * gold.cc (queue_middle_tasks): Call identical code folding.
11246         * gold.h: Add defines for multimap.
11247         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11248         to the call of finalize_local_symbols.
11249         * main.cc (main): Create object of class Icf.
11250         * object.cc (Sized_relobj::do_layout): Allow this function to be
11251         called twice during icf.
11252         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11253         to sections marked as identical by icf.
11254         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11255         when available.
11256         (Sized_relobj::do_section_entsize): New function.
11257         * object.h (Object::section_entsize): New function.
11258         (Object::do_section_entsize): New pure virtual function.
11259         (Relobj::finalize_local_symbols): Add new parameter.
11260         (Relobj::do_section_entsize): New function.
11261         * options.h (General_options::icf): New option.
11262         (General_options::icf_iterations): New option.
11263         (General_options::print_icf_sections): New option.
11264         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11265         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11266         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11267         icf.
11268         * symtab.cc (Symbol_table::is_section_folded): New function.
11269         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11270         to sections marked as identical by icf.
11271         * symtab.h (Symbol_table::set_icf): New function.
11272         (Symbol_table::icf): New function.
11273         (Symbol_table::is_section_folded): New function.
11274         (Symbol_table::icf_): New data member.
11275         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11276         * testsuite/Makefile.am: Add commands to build icf_test.
11277         * testsuite/Makefile.in: Regenerate.
11278         * testsuite/icf_test.sh: New file.
11279         * testsuite/icf_test.cc: New file.
11280
11281 2009-07-24  Chris Demetriou  <cgd@google.com>
11282
11283         * layout.cc (is_compressible_debug_section): Fix incorrect
11284         comment about compressed section names.
11285
11286 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11287
11288         PR 10419
11289         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11290
11291 2009-07-16  Ian Lance Taylor  <iant@google.com>
11292
11293         PR 10400
11294         * layout.h: #include <map>.
11295         (class Kept_section): Change from struct to class.  Add accessors
11296         and setters.  Add section size to Comdat_group mapping.  Change
11297         Comdat_group to std::map.  Add is_comdat_ field.  Add
11298         linkonce_size field in union.
11299         (class Layout): Update declaration of find_or_add_kept_section.
11300         Don't declare find_kept_object.
11301         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11302         parameter.  Add object, shndx, is_comdat, and is_group_name
11303         parameters.  Change all callers.  Adjust for new Kept_section.
11304         (Layout::find_kept_object): Remove.
11305         * object.cc (Sized_relobj::include_section_group): Update use of
11306         Kept_section.  Rename secnum to shndx.  Only record
11307         Kept_comdat_section if sections are the same size.
11308         (Sized_relobj::include_linkonce_section): Update use of
11309         Kept_section.  Only record Kept_comdat_section if sections are the
11310         same size.  Set size of linkonce section.
11311         (Sized_relobj::map_to_kept_section): Update call to
11312         get_kept_comdat_section.
11313         * object.h (class Sized_relobj): Rename fields in
11314         Kept_comdat_section to drop trailing underscores; change object
11315         field to Relobj*.  Change Kept_comdat_section_table to store
11316         struct rather than pointer.
11317         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11318         Add kept_object and kept_shndx parameters.  Change all callers.
11319         (Sized_relobj::get_kept_comdat_section): Change return type to
11320         bool.  Add kept_object and kept_shndx parameters.  Change all
11321         callers.
11322         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11323         Layout::find_or_add_kept_section.
11324
11325 2009-07-09  Ian Lance Taylor  <iant@google.com>
11326
11327         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11328         Reserve space in the hash table.
11329
11330 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11331
11332         * fileread.cc (File_read::get_mtime): New method.
11333         * fileread.h (Timespec): New structure.
11334         (File_read::get_mtime): New method.
11335         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11336         Renamed from timestamp_nsec.
11337         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11338         Elf_Xword.
11339         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11340         timestamp_nsec.
11341         (Incremental_inputs::report_archive): Save mtime; style fix.
11342         (Incremental_inputs::report_obejct): Save mtime; style fix.
11343         (Incremental_inputs::report_script): Save mtime; style fix.
11344         (Incremental_inputs::finalize_inputs): Style fix.
11345         (Incremental_inputs::finalize): Style fix.
11346         (Incremental_inputs::create_input_section_data): Store inputs
11347         mtime.
11348         * incremental.h (Incremental_inputs::report_script): Add mtime
11349         argument.
11350         (Incremental_inputs::Input_info::Input_info): Intialize only one
11351         union member.
11352         (Incremental_inputs::Input_info::archive): Move to nameless
11353         union.
11354         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11355         (Incremental_inputs::Input_info::script): Move to nameless union.
11356         (Incremental_inputs::mtime): New field.
11357         * script.cc (read_input_script): Pass file mtime to
11358         Incremental_input.
11359         * script.h (Script_info::inputs): Style fix.
11360
11361 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11362
11363         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11364         instead of 32.
11365
11366 2009-06-24  Ian Lance Taylor  <iant@google.com>
11367
11368         PR 10156
11369         * layout.cc (Layout::choose_output_section): If we find an
11370         existing section, update the flags.
11371         (Layout::create_notes): New function, broken out of
11372         Layout::finalize.
11373         (Layout::finalize): Don't create note sections.
11374         (Layout::create_note): Don't crash if linker script discards
11375         section.
11376         (Layout::create_gold_note): Likewise.
11377         (Layout::create_build_id): Likewise.  Don't set
11378         after_input_sections on the section.
11379         (Layout::create_executable_stack_info): Remove target parameter.
11380         Change caller.
11381         * layout.h (class Layout): Declare create_notes.  Update
11382         declaration of create_executable_stack_info.
11383         * gold.cc (queue_middle_tasks): Call create_notes.
11384         * output.cc (Output_section::update_flags_for_input_section): Move
11385         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11386         invalid.
11387         * output.h (Output_data::mark_address_invalid): New function.
11388         (class Output_section): Only declare, not define,
11389         update_flags_for_input_section.  Remove set_flags.
11390
11391 2009-06-24  Ian Lance Taylor  <iant@google.com>
11392
11393         * script-sections.cc (Output_section_definition::
11394         set_section_addresses): Rename shadowing local load_address to
11395         laddr.
11396
11397 2009-06-24  Ian Lance Taylor  <iant@google.com>
11398
11399         PR 10244
11400         * reloc.cc (relocate_sections): Skip empty relocation sections.
11401
11402 2009-06-23  Ian Lance Taylor  <iant@google.com>
11403
11404         PR 10156
11405         * layout.cc (Layout::create_note): Use choose_output_section
11406         rather than make_output_section.
11407
11408 2009-06-23  Ian Lance Taylor  <iant@google.com>
11409
11410         PR 10237
11411         * options.cc (General_options::parse_V): Set printed_version_.
11412         (General_options::General_options): Initialize printed_version_.
11413         * options.h (class General_options): Add printed_version_ field.
11414         * gold.cc (queue_initial_tasks): If there are no input files,
11415         don't give a fatal error if we printed the version information.
11416         (queue_middle_tasks): If using -r with a shared object, give a
11417         fatal error rather than an ordinary error.
11418
11419 2009-06-23  Ian Lance Taylor  <iant@google.com>
11420
11421         PR 10219
11422         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11423         (Layout::make_output_section): Set have_stabstr_section_ if we see
11424         a .stab*str section.
11425         (Layout::finalize): Call link_stabs_sections.
11426         (Layout::link_stabs_sections): New file.
11427         * layout.h (class Layout): Add have_stabstr_section_ field.
11428         Declare link_stabs_sections.
11429
11430 2009-06-23  Doug Kwan  <dougkwan@google.com>
11431
11432         * Makefile.am (libgold_a_LIBADD): New.
11433         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11434         * Makefile.in: Regenerate.
11435         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11436         * configure: Regenerate.
11437         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11438         * fileread.cc: Include sys/state.h
11439         * gold.h: Declare memmem and strndup if found missing.
11440         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11441
11442 2009-06-23  Ian Lance Taylor  <iant@google.com>
11443
11444         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11445         * configure: Rebuild.
11446
11447 2009-06-23  Ian Lance Taylor  <iant@google.com>
11448
11449         PR 10147
11450         * object.cc (Object::section_contents): Don't try to get a view if
11451         the section has length zero.
11452         (Object::handle_gnu_warning_section): If the section is empty, use
11453         the name of the section as the warning.
11454
11455 2009-06-23  Ian Lance Taylor  <iant@google.com>
11456
11457         PR 10133
11458         * stringpool.h (class Stringpool_template): Add optimize_ field.
11459         (Stringpool_template::set_optimize): New function.
11460         * stringpool.cc (Stringpool_template::Stringpool_template):
11461         Initialize optimize_ field.
11462         (Stringpool_template::set_string_offsets): Test local optimize
11463         fild rather than parameter.
11464         * layout.cc (Layout::Layout): Call set_optimize on the section
11465         name stringpool.
11466
11467 2009-06-22  Ian Lance Taylor  <iant@google.com>
11468
11469         PR 10030
11470         * yyscript.y: Parse TARGET.
11471         * script.cc (script_set_target): New function.
11472         * script-c.h (script_set_target): Declare.
11473         * options.cc (General_options::string_to_object_format): Rename
11474         from string_to_object_format in anonymous namespace.  Change
11475         callers.
11476         * options.h (class General_options): Declare
11477         string_to_object_format.
11478
11479 2009-06-22  Ian Lance Taylor  <iant@google.com>
11480
11481         * script-sections.cc (Script_sections::create_segments): Don't put
11482         program headers in a PT_LOAD segment if -n or -N.
11483
11484 2009-06-22  Ian Lance Taylor  <iant@google.com>
11485
11486         PR 10141
11487         * options.h (class General_options): Add -z lazy and -z now.  Sort
11488         -z options into alphabetical order.
11489         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11490
11491 2009-06-21  Ian Lance Taylor  <iant@google.com>
11492
11493         * layout.cc (Layout::make_output_section): Call
11494         Target::new_output_section.
11495         (Layout::attach_allocated_section_to_segment): Put large section
11496         sections in a separate load segment with the large segment flag
11497         set.
11498         (Layout::segment_precedes): Sort large data segments after other
11499         load segments.
11500         (align_file_offset): New static function.
11501         (Layout::set_segment_offsets): Use align_file_offset.
11502         * output.h (class Output_section): Add is_small_section_ and
11503         is_large_section_ fields.
11504         (Output_section::is_small_section): New function.
11505         (Output_section::set_is_small_section):  New function.
11506         (Output_section::is_large_section): New function.
11507         (Output_section::set_is_large_section): New function.
11508         (Output_section::is_large_data_section): New function.
11509         (class Output_segment): Add is_large_data_segment_ field.
11510         (Output_segment::is_large_data_segment): New function.
11511         (Output_segment::set_is_large_data_segment): New function.
11512         * output.cc (Output_section::Output_section): Initialize new
11513         fields.
11514         (Output_segment::Output_segment): Likewise.
11515         (Output_segment::add_output_section): Add assertion that large
11516         data sections always go in large data segments.  Force small data
11517         sections to the end of the list of data sections.  Force small BSS
11518         sections to the start of the list of BSS sections.  For large BSS
11519         sections to the end of the list of BSS sections.
11520         * symtab.h (class Symbol): Declare is_common_shndx.
11521         (Symbol::is_defined): Check Symbol::is_common_shndx.
11522         (Symbol::is_common): Likewise.
11523         (class Symbol_table): Define enum Commons_section_type.  Update
11524         declarations.  Add small_commons_ and large_commons_ fields.
11525         * symtab.cc (Symbol::is_common_shndx): New function.
11526         (Symbol_table::Symbol_table): Initialize new fields.
11527         (Symbol_table::add_from_object): Put small and large common
11528         symbols in the right list.
11529         (Symbol_table::sized_finalized_symbol): Check
11530         Symbol::is_common_shndx.
11531         (Symbol_table::sized_write_globals): Likewise.
11532         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11533         common symbol lists.  Don't call do_allocate_commons_list if the
11534         list is empty.
11535         (Symbol_table::do_allocate_commons_list): Remove is_tls
11536         parameter.  Add comons_section_type parameter.  Change all
11537         callers.  Handle small and large common symbols.
11538         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11539         Symbol::is_common_shndx.
11540         * resolve.cc (symbol_to_bits): Likewise.
11541         * target.h (Target::small_common_shndx): New function.
11542         (Target::small_common_section_flags): New function.
11543         (Target::large_common_shndx): New function.
11544         (Target::large_common_section_flags): New function.
11545         (Target::new_output_section): New function.
11546         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11547         small_common_section_flags, and large_common_section_flags
11548         fields.
11549         (Target::do_new_output_section): New virtual function.
11550         * arm.cc (Target_arm::arm_info): Initialize new fields.
11551         * i386.cc (Target_i386::i386_info): Likewise.
11552         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11553         Likewise.
11554         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11555         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11556         (Target_x86_64::do_new_output_section): New function.
11557         * configure.ac: Define conditional MCMODEL_MEDIUM.
11558         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11559         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11560         (large_LDFLAGS): Define.
11561         * testsuite/large.c: New file.
11562         * testsuite/testfile.cc (Target_test::test_target_info):
11563         Initialize new fields.
11564         * configure, testsuite/Makefile.in: Rebuild.
11565
11566 2009-06-05  Doug Kwan  <dougkwan@google.com>
11567
11568         * Makefile.am (CCFILES): Add target.cc.
11569         * Makefile.in: Regenerate.
11570         * i386.cc (class Target_i386): Define new virtual method to
11571         override do_is_local_label_name in parent.
11572         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11573         local symbols if --discard-locals or -X is given.
11574         * options.h (class General_options): Declare new options
11575         '--discard-locals' and '-X' for discarding locals.
11576         * target.h (class Target): Define new methods is_local_label_name.
11577         Declare new virtual method do_is_local_label_name.
11578         * target.cc: New file.
11579         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11580         (check_SCRIPTS): Add discard_locals_test.sh.
11581         (check_DATA): Add discard_local_tests.syms.
11582         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11583         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11584         * testsuite/Makefile.in: Regenerate.
11585         * testsuite/discard_locals_test.c: New file.
11586         * testsuite/discard_locals_test.sh: Same.
11587
11588 2009-06-05  Doug Kwan  <dougkwan@google.com>
11589
11590         * object.cc (Sized_relobj::Sized_relobj): Initialize
11591         discarded_eh_frame_shndx_ to -1U.
11592         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11593         section.
11594         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11595         a discarded .eh_frame section.
11596         (Sized_relobj::do_finalize_local_symbols): Ditto.
11597         * object.h (class Sized_relobj): Declare new member
11598         discarded_eh_frame_shndx_.
11599         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11600         (local_labels_test.o, local_labels_test): New rules.
11601         * testsuite/Makefile.in: Regenerate.
11602
11603 2009-06-04  Doug Kwan  <dougkwan@google.com>
11604
11605         * layout.cc (Layout::section_name_mapping): Add mapping for
11606         special ARM sections.
11607
11608 2009-06-03  Doug Kwan  <dougkwan@google.com>
11609
11610         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11611         (utils::has_overflow): Same.
11612
11613 2009-06-03  Ian Lance Taylor  <iant@google.com>
11614
11615         * layout.cc (Layout::section_name_mapping): New array, replacing
11616         Layout::linkonce_mapping.
11617         (Layout::section_name_mapping_count): New variable, replacing
11618         Layout::linkonce_mapping_count.
11619         (Layout::linkonce_output_name): Remove.
11620         (Layout::output_section_name): Rewrite.
11621         * layout.h (class Layout): Rename Linkonce_mapping to
11622         Section_name_mapping, linkonce_mapping to section_name_mapping,
11623         linkonce_mapping_count to section_name_mapping_count.  Don't
11624         declare linkonce_output_name.
11625
11626 2009-06-03  Doug Kwan  <dougkwan@google.com>
11627
11628         * gold/arm.cc (namespace utils): New.
11629         (Target_arm::reloc_is_non_pic): Define new method.
11630         (class Arm_relocate_functions): New.
11631         (Target_arm::Relocate::relocate): Handle relocation types used by
11632         Android.
11633
11634 2009-06-03  Ian Lance Taylor  <iant@google.com>
11635
11636         * arm.cc (Target_arm::scan::global): Use || instead of |.
11637
11638 2009-06-02  Doug Kwan  <dougkwan@google.com>
11639
11640         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11641         issued_non_pic_error_.
11642         (class Target_arm::Scan): Declare new method check_non_pic.
11643         Define new method symbol_needs_plt_entry.
11644         Declare new data member issued_non_pic_error_.
11645         (class Target_arm::Relocate): Declare new method
11646         should_apply_static_reloc.
11647         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11648         (Target_arm::Scan::check_non_pic): Define new method.
11649         (Target_arm::Scan::local): Handle a small subset of reloc types used
11650         by Android.
11651         (Target_arm::Scan::local): Same.
11652         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11653
11654 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11655
11656         * incremental.cc (Incremental_inputs::report_command_line): Filter
11657         out --incremental-* options.
11658
11659 2009-05-29  Doug Kwan  <dougkwan@google.com>
11660
11661         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11662         template class.
11663         (class Target_arm): Update comment.
11664         (Target_arm::Target_arm): Initialize new data members GOT_,
11665         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11666         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11667         and Target_arm::rel_dyn_section.
11668         Declare new_enum Target_arm::Got_type.
11669         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11670         and DYNBSS_.
11671         Update commments for member do_dynsym_value.
11672         (Target_arm::got_size, Target_arm::plt_section,
11673         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11674         new methods inside class defintion.
11675         (Target_arm::got_section): Define new method.
11676         (Target_arm::rel_dyn_section): Same.
11677         (Output_data_plt_arm): New template class.
11678         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11679         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11680         (Output_data_plt_arm::add_entry): Same.
11681         (Output_data_plt_arm::first_plt_entry): Define new
11682         static data member for PLT instruction template.
11683         (Output_data_plt_arm::plt_entry): Same.
11684         (Output_data_plt_arm::do_write): Define new method.
11685         (Target_arm::make_plt_entry): Same.
11686         (Target_arm::do_finalize_sections): Same.
11687         (Target_arm::do_dynsym_value): Same.
11688
11689 2009-05-28  Doug Kwan  <dougkwan@google.com>
11690
11691         * Makefile.am (TARGETSOURCES): Add arm.cc.
11692         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11693         * Makefile.in: Regenerate.
11694         * arm.cc: New file.
11695         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11696
11697 2009-05-26  Doug Kwan  <dougkwan@google.com>
11698
11699         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11700         (General_options::check_excluded_libs): Strip off directories in
11701         archive name before matching like GNU ld does.
11702         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11703         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11704         (exclude_libs_test_LDFLAGS): Add linker option
11705         -Wl,--exclude-libs,libexclude_libs_test_3
11706         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11707         an explicit archive without using -l.
11708         (alt/libexclude_libs_test_3.a): New make rule.
11709         * testsuite/Makefile.in: Regenerate.
11710         * testsuite/exclude_libs_test.c : Declare lib3_default().
11711         (main): Call it.
11712         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11713         * exclude_libs_test_3.c: New file.
11714
11715 2009-05-26  Nick Clifton  <nickc@redhat.com>
11716
11717         * po/id.po: New Indonesian translation.
11718         * po/gold.pot: Updated template file.
11719
11720 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11721
11722         * testsuite/Makefile.am: Add -ffunction-sections to compile
11723         gc_comdat_test files.  Add -Wl,--gc-sections to build
11724         gc_comdat_test.
11725         * testsuite/Makefile.in: Regenerate.
11726         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11727
11728 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11729
11730         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11731         kept comdat section was garbage collected.
11732         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11733         * testsuite/Makefile.in: Regenerate.
11734         * testsuite/gc_comdat_test.sh: New file.
11735         * testsuite/gc_comdat_test_1.cc: New file.
11736         * testsuite/gc_comdat_test_2.cc: New file.
11737
11738 2009-05-19  Doug Kwan  <dougkwan@google.com>
11739
11740         * archive.cc (Archive::Archive): Move constructor from archive.h
11741         to here.  Initialize no_export_.
11742         (Archive::get_elf_object_for_member): Set no_export flag of object.
11743         * archive.h (Archive::Archive): Move constructor body to
11744         archive.cc.
11745         (Archive::no_export): New method.
11746         (Archive::no_export_): New field.
11747         * object.h (Object::Object): Initialize no_export_ to false.
11748         (Object::no_export, Object::set_no_export): New methods.
11749         (Object::no_export_): New field.
11750         * options.cc (General_options::parse_exclude_libs): New method.
11751         (General_options::check_excluded_libs) Same.
11752         * options.h (exclude_libs): New option.
11753         (General_options::check_excluded_libs): New method declaration.
11754         (General_options::excluded_libs_): New field.
11755         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11756         default or protected visibility if an object has no-export flag set.
11757         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11758         (check_SCRIPTS): Add exclude_libs_test.sh.
11759         (check_DATA): Add exclude_libs_test.syms.
11760         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11761         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11762         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11763         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11764         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11765         libexclude_libs_test_2.a): New rules.
11766         * testsuite/Makefile.in: Regenerate.
11767         * testsuite/exclude_libs_test.c: New file.
11768         * testsuite/exclude_libs_test.sh: Ditto.
11769         * testsuite/exclude_libs_test_1.c: Ditto.
11770         * testsuite/exclude_libs_test_2.c: Ditto.
11771
11772 2009-05-15  Ian Lance Taylor  <iant@google.com>
11773
11774         * configure.ac: Check for declarations for cases where libiberty.h
11775         checks HAVE_DECL_xxx.
11776         * configure, config.in: Rebuild.
11777
11778 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11779
11780         * gold.h (Incremental_argument_list): Remove (invalid) forward
11781         declaration.
11782         * incremental.cc (Incremental_inputs::report_achive): New method.
11783         (Incremental_inputs::report_object): New method.
11784         (Incremental_inputs::report_script): New method.
11785         (Incremental_inputs::finalize_inputs): New method.
11786         (Incremental_inputs::finalize): Call finalize_inputs().
11787         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11788         Create inputs entries.
11789         * incremental.h (Incremental_input_type): New enum.
11790         (Incremental_inputs::Incremental_input): Initialize new fields.
11791         (Incremental_inputs::report_inputs): New method.
11792         (Incremental_inputs::report_achive): New method.
11793         (Incremental_inputs::report_object): New method.
11794         (Incremental_inputs::report_script): New method.
11795         (Incremental_inputs::finalize_inputs): New method.
11796         (Incremental_inputs::Input_info): New struct.
11797         (Incremental_inputs::Input_info_map): New typedef.
11798         (Incremental_inputs::lock_): New field.
11799         (Incremental_inputs::Inputs_): New field.
11800         (Incremental_inputs::Inputs_map): New field.
11801         * main.cc (main): Call Incremental_input::report_inputs.
11802         * options.h (Input_argument_list): Typedef moved from
11803         Input_arguments.
11804         (Input_file_group::Files): Remove, use ::Input_argument_list.
11805         (Input_file_group::Input_argument_list): Remove, use
11806         ::Input_argument_list.
11807         * plugin.cc (Plugin_manager::add_input_file): Add error in
11808         incremental build.
11809         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11810         functions.
11811         * script.cc (read_input_script): Call
11812         Incremental_input::report_script.
11813         * script.h (Script_info): New class.
11814
11815 2009-04-27  Ian Lance Taylor  <iant@google.com>
11816
11817         * x86_64.cc (do_adjust_output_section): Set entsize to
11818         plt_entry_size.
11819
11820 2009-04-23  Elliott Hughes  <enh@google.com>
11821
11822         * output.cc (Output_file::close): After short writes, continue
11823         writing from the correct offset in the buffer being written.
11824
11825 2009-04-23  Chris Demetriou  <cgd@google.com>
11826
11827         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11828         * configure: Regenerate.
11829         * config.in: Regenerate.
11830         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11831         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11832
11833 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11834
11835         * incremental.cc (Incremental_inputs_header_data): Renamed from
11836         Incremental_input_header_data.
11837         (Incremental_inputs_header_data::data_size): New field.
11838         (Incremental_inputs_header_data::put_input_file_count): Renamed
11839         from input_file_count.
11840         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11841         from command_line_offset.
11842         (Incremental_inputs_header_data::put_reserved): Renamed from
11843         put_reserved.
11844         (Incremental_inputs_entry_data): Renamed from
11845         Incremental_input_entry_data.
11846         (Incremental_inputs_entry_data::data_size): New field.
11847         (Incremental_inputs::report_command_line): New method.
11848         (Incremental_inputs::finalize): New method.
11849         (Incremental_inputs::create_incremental_inputs_data): New method.
11850         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11851         * incremental.h: New file.
11852         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11853         (Layout::finalize): Create incremental inputs section in
11854         incremental builds.
11855         (Layout::create_incremental_info_sections): New method.
11856         * layout.h (Layout::incremental_inputs): New method.
11857         (Layout::create_incremental_info_sections): New method.
11858         (Layout::incremental_inputs_): New field.
11859         * main.cc (main): Notify Incremental_input of the command line.
11860
11861 2009-04-01  Ian Lance Taylor  <iant@google.com>
11862             Mikolaj Zalewski  <mikolajz@google.com>
11863
11864         * gold.h (reserve_unordered_map): Define, three versions, one for
11865         each version of Unordered_map.
11866         * layout.cc (Layout::Layout): Remove options parameter.  Add
11867         number_of_input_files parameter.  Don't initialize options_.
11868         Initialize number_of_input_files_ and resized_signatures_.  Move
11869         sections_are_attached_.
11870         (Layout::layout_group): Reserve space for group_signatures_.
11871         (Layout::find_or_add_kept_section): Change name parameter to be a
11872         reference.  Resize signatures_ map when it gets large enough.
11873         (Layout::layout_eh_frame): Use parameters->options() instead of
11874         this->options_.
11875         (Layout::make_output_section): Likewise.
11876         (Layout::attach_allocated_section_to_segment): Likewise.
11877         (Layout::finalize, Layout::create_executable_stack): Likewise.
11878         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11879         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11880         * layout.h (class Layout): Update declarations.  Remove options_
11881         field.  Add number_of_input_files_ and resized_signatures_
11882         fields.  Move sections_are_attached_ field.
11883         * main.cc (main): Pass number of input files to Layout
11884         constructor.  Don't pass options.
11885
11886 2009-03-30  Ian Lance Taylor  <iant@google.com>
11887
11888         * ffsll.c (ffsll): Correct implementation.
11889
11890 2009-03-27  Ian Lance Taylor  <iant@google.com>
11891
11892         * ffsll.c: New file.
11893         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11894         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11895         * ftruncate.c (ftruncate): Declare before definition.
11896         * mremap.c (mremap): Likewise.
11897         * pread.c (pread): Likewise.
11898         * configure, Makefile.in, config.in: Rebuild.
11899
11900         * mremap.c: New file.
11901         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11902         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11903         (mremap): Declare if HAVE_MREMAP is not defined.
11904         * configure, Makefile.in, config.in: Rebuild.
11905
11906 2009-03-27  Cary Coutant  <ccoutant@google.com>
11907
11908         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11909         position independent.
11910         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11911         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11912
11913 2009-03-24  Cary Coutant  <ccoutant@google.com>
11914
11915         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11916         an executable.
11917         (needs_dynamic_reloc): Likewise.
11918
11919 2009-03-24  Ian Lance Taylor  <iant@google.com>
11920
11921         * yyscript.y (file_cmd): Recognize EXTERN.
11922         (extern_name_list, extern_name_list_body): New nonterminals.
11923         * script.cc (script_add_extern): Define.
11924         * script-c.h (script_add_extern): Declare.
11925
11926 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11927
11928         * object.cc (is_elf_object): Define.
11929         * object.h (is_elf_object): Declare.
11930         * archive.cc (Archive::get_elf_object_for_member): Call
11931         is_elf_object.
11932         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11933
11934 2009-03-24  Elliott Hughes  <enh@google.com>
11935
11936         * output.cc (Output_file::map_anonymous): Define.
11937         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11938         try an anonymous one.  Report the size if the mmap fails.
11939         * output.h (class Output_file): Declare map_anonymous.
11940
11941 2009-03-24  Ian Lance Taylor  <iant@google.com>
11942
11943         * target-select.cc (instantiate_target): Don't acquire the lock if
11944         the instantiated_target_ field has already been set.
11945
11946 2009-03-23  Ian Lance Taylor  <iant@google.com>
11947
11948         * gold-threads.h (class Initialize_lock): Define.
11949         * gold-threads.cc (class Initialize_lock_once): Define.
11950         (initialize_lock_control): New static variable.
11951         (initialize_lock_pointer): New static variable.
11952         (initialize_lock_once): New static function.
11953         (Initialize_lock::Initialize_lock): Define.
11954         (Initialize_lock::initialize): Define.
11955         * target-select.h: Include "gold-threads.h".
11956         (class Target_selector): Add lock_ and initialize_lock_ fields.
11957         Don't define instantiate_target, just declare it.
11958         * target-select.cc (Target_selector::Target_selector): Initialize
11959         new fields.
11960         (Target_selector::instantiate_target): Define.
11961         * descriptors.h: Include "gold-threads.h".
11962         (class Descriptors): Add initialize_lock_ field.
11963         * descriptors.cc (Descriptors::Descriptors): Initialize new
11964         field.
11965         (Descriptors::open): Use initialize_lock_ field
11966         * errors.h (class Errors): Add initialize_lock_ field.
11967         * errors.cc (Errors::Errors): Initialize new field.
11968         (Errors::initialize_lock): Use initialize_lock_ field.
11969         * powerpc.cc (class Target_selector_powerpc): Remove
11970         instantiated_target_ field.  In do_recognize call
11971         instantiate_target rather than do_instantiate_target.  In
11972         do_instantiate_target just allocate a new target.
11973         * sparc.cc (class Target_selector_sparc): Likewise.
11974
11975         * freebsd.h: New file.
11976         * i386.cc: Include "freebsd.h".
11977         (Target_i386): Derive from Target_freebsd rather than
11978         Sized_target.
11979         (Target_selector_i386): Derive from Target_selector_freebsd rather
11980         than Target_selector.
11981         * x86_64.cc: Include "freebsd.h".
11982         (Target_x86_64): Derive from Target_freebsd rather than
11983         Sized_target.
11984         (Target_selector_x86_64): Derive from Target_selector_freebsd
11985         rather than Target_selector.
11986         * target.h (class Target): Add adjust_elf_header and
11987         do_adjust_elf_header.
11988         * output.cc (Output_file_header:: do_sized_write): Call target
11989         adjust_elf_header routine.
11990         * configure.tgt: Set targ_osabi.
11991         * configure.ac: Define GOLD_DEFAULT_OSABI.
11992         * parameters.cc (Parameters::default_target): Pass
11993         GOLD_DEFAULT_OSABI to select_target.
11994         * target-select.h (class Target_selector): Make instantiate_target
11995         protected rather than private.
11996         * Makefile.am (HFILES): Add freebsd.h.
11997         * configure, Makefile.in, config.in: Rebuild.
11998
11999         * merge.cc (do_add_input_section): Correct pend value.  Change
12000         message about last entry not being null terminated from error to
12001         warning.
12002
12003 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12004
12005         * incremental.cc: New file.
12006         * Makefile.am (CCFILES): Add incremental.cc.
12007         * Makefile.in: Rebuild.
12008
12009 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12010
12011         * layout.cc (Layout::output_section_name): Preserve names
12012         of '.note.' sections.
12013
12014 2009-03-19  Ian Lance Taylor  <iant@google.com>
12015
12016         * descriptors.cc (Descriptors::open): Check that the options are
12017         valid before using them.
12018
12019 2009-03-18  Ian Lance Taylor  <iant@google.com>
12020
12021         * script-sections.h: Include <list>.
12022         (class Script_sections): Change Sections_elements from std::vector
12023         to std::list.  Typedef public Elements_iterator.  Add
12024         orphan_section_placement_, data_segment_align_start_, and
12025         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12026         field.
12027         * script-sections.cc (class Orphan_section_placement): New class.
12028         (class Sections_element): Add virtual functions is_relro and
12029         orphan_section_init.  Remove virtual function place_orphan_here.
12030         (class Output_section_definition): Add is_relro and
12031         orphan_section_init.  Remove place_orphan_here.
12032         (class Orphan_output_section): Likewise.
12033         (Script_sections::Script_sections): Update for field changes.
12034         (Script_sections::data_segment_align): Set saw_data_segment_align_
12035         and data_segment_align_start_, not data_segment_align_index.
12036         (Script_sections::data_segment_relro_end): Check
12037         saw_data_segment_align_.  Use data_segment_align_start_ rather
12038         than data_segment_align_index_.
12039         (Script_sections::place_orphan): Rewrite to use
12040         Orphan_section_placement.
12041
12042 2009-03-17  Ian Lance Taylor  <iant@google.com>
12043
12044         * archive.cc (Archive::add_symbols): Check for a version attached
12045         to the symbol name in the archive map.
12046         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12047         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12048         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12049         (ver_test_11.a): New target.
12050         * testsuite/Makefile.in: Rebuild.
12051
12052         * configure.ac: Check for chsize and posix_fallocate.  Replace
12053         ftruncate.
12054         * ftruncate.c: New file, from gnulib.
12055         * output.cc (posix_fallocate): Define dummy version if not
12056         HAVE_POSIX_FALLOCATE.
12057         (Output_file::map): Call posix_fallocate rather than lseek and
12058         write.
12059         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12060         * configure, Makefile.in, config.in: Rebuild.
12061
12062 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12063
12064         * layout.h (Layout::create_note): Add section_name parameter.
12065         * layout.cc (Layout::create_note): Likewise.
12066         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12067
12068 2009-03-17  Ian Lance Taylor  <iant@google.com>
12069
12070         * descriptors.cc: Include "options.h".
12071         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12072         (Descriptors::open): Always use O_CLOEXEC when opening a new
12073         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12074         then set FD_CLOEXEC.
12075
12076         * sparc.cc (class Target_sparc): Add has_got_section.
12077         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12078         make sure we have a GOT section.
12079
12080         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12081         (Target_sparc::Scan::local): Likewise.
12082         (Target_sparc::Scan::global): Likewise.
12083         (Target_sparc::Relocate::relocate): Likewise.
12084         (Target_sparc::Relocate::relocate_tls): Likewise.
12085
12086         * symtab.cc (Symbol_table::define_default_version): New function,
12087         broken out of add_from_object.
12088         (Symbol_table::add_from_object): Call define_default_version.
12089         (Symbol_table::define_special_symbol): Add resolve_oldsym
12090         parameter.  Change all callers.  If the version for a symbol comes
12091         from a version script, resolve it with the symbol with the same
12092         name with no version.  Also add the symbol without a version if
12093         appropriate.
12094         (do_define_in_output_data): If resolving with oldsym, don't delete
12095         sym.
12096         (do_define_in_output_segment): Likewise.
12097         (do_define_as_constant): Likewise.
12098         * symtab.h (class Symbol_table): Update declarations.
12099
12100 2009-03-13  Ian Lance Taylor  <iant@google.com>
12101
12102         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12103         (Read_symbols::requeue): New function.
12104         (Read_symbols::do_read_symbols): If make_elf_object fails because
12105         the target type is not configured, and the file was searched for,
12106         issue a warning and retry with the next directory.
12107         (Add_symbols::run): If the file has an incompatible format, and
12108         it was searched for, requeue the Read_symbols task.  On error,
12109         release the object.
12110         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12111         dirindex parameter to constructor.  Change all callers.  Declare
12112         incompatible_warning and requeue.
12113         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12114         input_argument_ and input_group_ fields.  Add them to
12115         constructor.  Change all callers.
12116         (class Read_script): Add dirindex_ field.  Add it to constructor.
12117         Change all callers.
12118         * archive.cc (Archive::setup): Remove input_objects parameter.
12119         Change all callers.
12120         (Archive::get_file_and_offset): Likewise.
12121         (Archive::read_all_symbols): Likewise.
12122         (Archive::read_symbols): Likewise.
12123         (Archive::get_elf_object_for_member): Remove input_objects
12124         parameter.  Add punconfigured parameter.  Change all callers.
12125         (Archive::add_symbols): Change return type to bool.  Check return
12126         value of include_member.
12127         (Archive::include_all_members): Likewise.
12128         (Archive::include_member): Change return type to bool.  Return
12129         false if first included object has incompatible target.  Set
12130         included_member_ field.
12131         (Add_archive_symbols::run): If add_symbols returns false, requeue
12132         Read_symbols task.
12133         * archive.h (class Archive): Add included_member_ field.
12134         Initialize it in constructor.  Add input_file and searched_for
12135         methods.  Update declarations.
12136         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12137         input_argument_ fields.  Add them to constructor.  Change all
12138         callers.
12139         * script.cc: Include "target-select.h".
12140         (class Parser_closure): Add skip_on_incompatible_target_ and
12141         found_incompatible_target_ fields.  Add
12142         skip_on_incompatible_target parameter to constructor.  Change all
12143         callers.  Add methods skip_on_incompatible_target,
12144         clear_skip_on_incompatible_target, found_incompatible_target, and
12145         set_found_incompatible_target.
12146         (read_input_script): Add dirindex parameter.  Change all callers.
12147         If parser finds an incompatible target, requeue Read_symbols
12148         task.
12149         (script_set_symbol): Clear skip_on_incompatible_target in
12150         closure.
12151         (script_add_assertion, script_parse_option): Likewise.
12152         (script_start_sections, script_add_phdr): Likewise.
12153         (script_check_output_format): New function.
12154         * script.h (read_input_script): Update declaration.
12155         * script-c.h (script_check_output_format): Declare.
12156         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12157         (ignore_cmd): Remove OUTPUT_FORMAT.
12158         * fileread.cc (Input_file::Input_file): Add explicit this.
12159         (Input_file::will_search_for): New function.
12160         (Input_file::open): Add pindex parameter.  Change all callers.
12161         * fileread.h (class Input_file): Add input_file_argument method.
12162         Declare will_search_for.  Update declarations.
12163         * object.cc (make_elf_object): Add punconfigured parameter.
12164         Change all callers.
12165         * object.h (class Object): Make input_file public.  Add
12166         searched_for method.
12167         (make_elf_object): Update declaration.
12168         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12169         restart search.
12170         * dirsearch.h (class Dirsearch): Update declaration.
12171         * options.h (class General_options): Add --warn-search-mismatch.
12172         * parameters.cc (Parameters::is_compatible_target): New function.
12173         * parameters.h (class Parameters): Declare is_compatible_target.
12174         * workqueue.cc (Workqueue::add_blocker): New function.
12175         * workqueue.h (class Workqueue): Declare add_blocker.
12176
12177         * fileread.cc (Input_file::open): Remove options parameter.
12178         Change all callers.
12179         (Input_file::open_binary): Likewise.
12180         * script.cc (read_input_script): Likewise.
12181         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12182         options parameter from constructor.  Change all callers.
12183         (class Read_script): Likewise.
12184         * fileread.h (class Input_file): Update declarations.
12185         * script.h (read_input_script): Update declaration.
12186
12187 2009-03-10  Nick Clifton  <nickc@redhat.com>
12188
12189         * po/es.po: New Spanish translation.
12190
12191 2009-03-06  Cary Coutant  <ccoutant@google.com>
12192
12193         * options.cc (parse_short_option): Keep dash_z from registering itself.
12194
12195 2009-03-03  Ian Lance Taylor  <iant@google.com>
12196
12197         PR 9918
12198         * target-reloc.h (relocate_section): Pass output_section to
12199         relocate.
12200         * i386.cc (Target_i386::should_apply_static_reloc): Add
12201         output_section parameter.  Change all callers.
12202         (Target_i386::Relocate::relocate): Add output_section parameter.
12203         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12204         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12205         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12206         * testsuite/two_file_shared.sh: New script.
12207         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12208         (check_DATA): Add two_file_shared.dbg.
12209         (two_file_shared.dbg): New target.
12210         * testsuite/Makefile.in: Rebuild.
12211
12212 2009-03-01  Ian Lance Taylor  <iant@google.com>
12213
12214         * configure.ac: Check for byteswap.h.
12215         * configure: Rebuild.
12216         * config.in: Rebuild.
12217
12218 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12219
12220         * layout.cc (Layout::find_or_add_kept_section): New function.
12221         (Layout::add_comdat): Removed.
12222         * layout.h (struct Kept_section): Move out of class Layout.
12223         Remove trailing underscores from field names.  Add group_sections
12224         field.  Rename group_ field to is_group.  Change all uses.
12225         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12226         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12227         comdat_groups_ field.
12228         (Sized_relobj::include_section_group): Use
12229         find_or_add_kept_section and Kept_section::group_sections.
12230         (Sized_relobj::include_linkonce_section): Likewise.
12231         * object.cc (class Sized_relobj): Don't define Comdat_group or
12232         Comdat_group_table.  Remove find_comdat_group and
12233         add_comdat_group.  Remove comdat_groups_ field.
12234         * plugin.cc (include_comdat_group): Use
12235         Layout::find_or_add_kept_section.
12236
12237 2009-02-28  Ian Lance Taylor  <iant@google.com>
12238
12239         * README: --gc-sections and map files are now supported.  Document
12240         some build requirements.
12241
12242         PR 6992
12243         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12244         relocatable link set the value of the section symbol to zero.
12245         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12246         relocatable link don't include the section address in the local
12247         symbol value.
12248
12249 2009-02-27  Ian Lance Taylor  <iant@google.com>
12250
12251         PR 6811
12252         * options.h (class Search_directory): Add is_system_directory.
12253         (class General_options): Declare is_in_system_directory.
12254         * options.cc (get_relative_sysroot): Make static.
12255         (get_default_sysroot): Make static.
12256         (General_optoins::is_in_system_directory): New function.
12257         * fileread.cc (Input_file::is_in_system_directory): New function.
12258         * fileread.h (class Input_file): Declare is_in_system_directory.
12259         * object.h (class Object): Add is_in_system_directory.
12260         (class Input_objects): Remove system_library_directory_ field.
12261         * object.cc (Input_objects::add_object): Don't set
12262         system_library_directory_.
12263         (input_objects::found_in_system_library_directory): Remove.
12264         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12265         parameter.  Change all callers.
12266         (Symbol_table::sized_write_globals): Likewise.
12267         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12268         Call Object::is_in_system_directory.
12269         * symtab.h (class Symbol_table): Update declarations.
12270
12271         PR 5990
12272         * descriptors.h (Open_descriptor): Add is_on_stack field.
12273         * descriptors.cc (Descriptors::open): If the descriptor is on the
12274         top of the stack, remove it.  Initialize is_on_stack field.
12275         (Descriptors::release): Only add pod to stack if it is not on the
12276         stack already.
12277         (Descriptors::close_some_descriptor): Clear stack_next and
12278         is_on_stack fields.
12279
12280         PR 7091
12281         * output.cc (Output_section::find_starting_output_address): Rename
12282         from starting_output_address; add PADDR parameter; change return
12283         type.
12284         * output.h (class Output_section): Declare
12285         find_starting_output_address instead of starting_output_address.
12286         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12287         section symbol for which we can't find a merge section.
12288
12289         PR 9836
12290         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12291         hidden or internal, force the symbol to be local.
12292         * resolve.cc (Symbol::override_visibility): Define.
12293         (Symbol::override_base): Use override_visibility.
12294         (Symbol_table::resolve): Likewise.
12295         (Symbol::override_base_with_special): Likewise.
12296         (Symbol_table::override_with_special): If the visibility is hidden
12297         or internal, force the symbol to be local.
12298         * symtab.h (class Symbol): Add set_visibility and
12299         override_visibility.
12300         * testsuite/ver_test_1.sh: New file.
12301         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12302         (check_DATA): Add ver_test_1.syms.
12303         (ver_test_1.syms): New target.
12304         * testsuite/Makefile.in: Rebuild.
12305
12306 2009-02-25  Cary Coutant  <ccoutant@google.com>
12307
12308         * layout.cc (Layout::choose_output_section): Don't rename sections
12309         when using a linker script that has a SECTIONS clause.
12310         * Makefile.in: Regenerate.
12311
12312         * testsuite/Makefile.am (script_test_5.sh): New test case.
12313         * testsuite/Makefile.in: Regenerate.
12314         * testsuite/script_test_5.cc: New file.
12315         * testsuite/script_test_5.sh: New file.
12316         * testsuite/script_test_5.t: New file.
12317
12318 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12319
12320         * archive.cc (Archive::include_member): Update calls to add_symbols.
12321         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12322         the Layout argument.
12323         * dynobj.h (do_add_symbols): Add the Layout argument.
12324         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12325         Layout argument.
12326         * object.h (Object::add_symbols): Add the Layout argument.
12327         (Object::do_add_symbols): Add the Layout argument.
12328         (Sized_relobj::do_add_symbols): Add the Layout argument.
12329         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12330         Unify the two versions.
12331         (Add_plugin_symbols): Remove.
12332         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12333         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12334         (Add_plugin_symbols): Remove.
12335         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12336         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12337         (Add_symbols::run): Make it work with Pulginobj.
12338
12339 2009-02-06  Ian Lance Taylor  <iant@google.com>
12340
12341         * object.cc (Sized_relobj::do_layout): Make info message start
12342         with lower case letter.
12343
12344 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12345
12346         * binary.cc: Fix file comment.
12347
12348         * options.h (enum Incremental_disposition): Define.
12349         (class General_options): Add new options: --incremental,
12350         --incremental_changed, --incremental_unchanged,
12351         --incremental_unknown.  Add incremental_disposition_ and
12352         implicit_incremental_ fields.
12353         (General_options::incremental_disposition): New function.
12354         (class Position_dependent_options): Add incremental_disposition
12355         option.
12356         (Position_dependent_options::copy_from_options): Set incremental
12357         dispositions.
12358         * options.cc (General_options::parse_incremental_changed): New
12359         function.
12360         (General_options::parse_incremental_unchanged): New function.
12361         (General_options::parse_incremental_unknown): New function.
12362         (General_options::General_options): Initialize new fields
12363         incremental_disposition_ and implicit_incremental_.
12364         (General_options::finalize): Check for uasge of --incremental-*
12365         without --incremental.
12366
12367 2009-02-06  Chris Demetriou  <cgd@google.com>
12368
12369         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12370         pointer and to report location as the file name associated with
12371         the symbol.
12372         (gold_undefined_symbol_at_location): New function to replace the
12373         old gold_undefined_symbol functionality.
12374         * target-reloc.h (relocate_section): Update to use
12375         gold_undefined_symbol_at_location.
12376         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12377         Call gold_undefined_symbol function rather than gold_error.
12378         * errors.h (Errors::undefined_symbol): Take location as a
12379         string, rather than calculating it from a relocation.
12380         * errors.cc (Errors::fatal): Print "fatal error:" before the
12381         formatted message.
12382         (Errors::error, Errors::error_at_location): Print "error: "
12383         before the formatted message.
12384         (Errors::undefined_symbol): Take location as a string, rather
12385         than calculating it from a relocation.
12386         (gold_undefined_symbol_at_location): New function akin to
12387         old gold_undefined_symbol, calculates location from relocation.
12388         (gold_undefined_symbol): Change to take only a Symbol pointer
12389         and to report location as the file name associated with the symbol.
12390         * testsuite/debug_msg.sh: Update for changed error messages.
12391         * testsuite/undef_symbol.sh: Likewise.
12392
12393 2009-02-04  Duncan Sands  <baldrick@free.fr>
12394
12395         PR 9812
12396         * reduced_debug_output.h
12397         (Output_reduced_debug_abbrev_section::failed): Use format for
12398         gold_warning.
12399         (Output_reduced_debug_info_section::faild): Likewise.
12400
12401 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12402
12403         * script.cc (Lazy_demangler): New class.
12404         (Version_script_info::get_symbol_version_helper): Demangle a
12405         symbol only once.
12406
12407 2009-01-29  Cary Coutant  <ccoutant@google.com>
12408
12409         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12410         to __tls_get_addr.
12411         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12412
12413 2009-01-28  Ian Lance Taylor  <iant@google.com>
12414
12415         * version.cc (version_string): Bump to 1.9.
12416
12417         * gold.h: Include <cstring> and <stdint.h>.
12418         * version.cc: Include <cstdio>.
12419         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12420         warning.
12421         * reduced_debug_output.cc (insert_into_vector): Rename from
12422         Insert_into_vector; change all callers.  Use Swap_unaligned to
12423         avoid aliasing issue; remove union since it is unnecessary.
12424
12425 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12426
12427         * Makefile.am (CCFILES): Add gc.cc.
12428         (HFILES): Add gc.h.
12429         * Makefile.in: Regenerate.
12430         * gold.cc (Gc_runner): New class.
12431         (queue_initial_tasks): Call garbage collection related tasks
12432         when corresponding options are invoked.
12433         (queue_middle_gc_tasks): New function.
12434         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12435         processed early before laying out sections during garbage collection.
12436         * gold.h (queue_middle_gc_tasks): New function.
12437         (is_prefix_of): Move from "layout.cc".
12438         * i386.cc (Target_i386::gc_process_relocs): New function.
12439         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12440         * main.cc (main): Create object of class "Garbage_collection".
12441         * object.cc (Relobj::copy_symbols_data): New function.
12442         (Relobj::is_section_name_included): New function.
12443         (Sized_relobj::do_layout): Allow this function to be called twice
12444         during garbage collection and defer layout of section during the
12445         first call.
12446         * object.h (Relobj::get_symbols_data): New function.
12447         (Relobj::is_section_name_included): New function.
12448         (Relobj::copy_symbols_data): New function.
12449         (Relobj::set_symbols_data): New function.
12450         (Relobj::get_relocs_data): New function.
12451         (Relobj::set_relocs_data): New function.
12452         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12453         (Relobj::gc_process_relocs): New function.
12454         (Relobj::do_gc_process_relocs): New pure virtual function.
12455         (Relobj::sd_): New data member.
12456         (Sized_relobj::is_output_section_offset_invalid): New function.
12457         (Sized_relobj::do_gc_process_relocs): New function.
12458         * options.h (General_options::gc_sections): Modify to not be a no-op.
12459         (General_options::print_gc_sections): New option.
12460         * plugin.cc (Plugin_finish::run): Remove function call to
12461         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12462         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12463         * reloc.cc (Read_relocs::run): Add task to process relocs and
12464         determine unreferenced sections when doing garbage collection.
12465         (Gc_process_relocs): New class.
12466         (Sized_relobj::do_gc_process_relocs): New function.
12467         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12468         sections that are garbage collected.
12469         * reloc.h (Gc_process_relocs): New class.
12470         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12471         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12472         symbols whose corresponding sections are garbage collected.
12473         (Symbol_table::Symbol_table): Add new parameter for the garbage
12474         collection object.
12475         (Symbol_table::gc_mark_undef_symbols): New function.
12476         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12477         (Symbol_table::gc_mark_dyn_syms): New function.
12478         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12479         as garbage.
12480         (Symbol_table::add_from_object): Likewise.
12481         (Symbol_table::add_from_relobj): When building shared objects, do not
12482         treat externally visible symbols as garbage.
12483         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12484         table information for static and relocatable links.
12485         * symtab.h (Symbol_table::set_gc): New function.
12486         (Symbol_table::gc): New function.
12487         (Symbol_table::gc_mark_undef_symbols): New function.
12488         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12489         (Symbol_table::gc_mark_dyn_syms): New function.
12490         (Symbol_table::gc_): New data member.
12491         * target.h (Sized_target::gc_process_relocs): New pure virtual
12492         function.
12493         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12494         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12495
12496 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12497
12498         * options.h (General_options::gc_sections): Define as a no-op for now.
12499         (General_options::no_keep_memory): Ditto.
12500         (General_options::Bshareable): Define.
12501         * options.cc (General_options::finalize): Honor -Bshareable.
12502
12503 2009-01-20  Andreas Schwab  <schwab@suse.de>
12504
12505         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12506         read the value in the contents, since we don't use it.  Use the
12507         template endianness when writing.
12508         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12509
12510 2009-01-19  Andreas Schwab  <schwab@suse.de>
12511
12512         * configure.tgt (powerpc64-*): Fix targ_obj.
12513
12514 2009-01-15  Ian Lance Taylor  <iant@google.com>
12515
12516         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12517         local symbols when stripping all symbols.
12518
12519 2009-01-14  Cary Coutant  <ccoutant@google.com>
12520
12521         * output.cc (Output_reloc): Add explicit instantiations.
12522
12523 2009-01-14  Cary Coutant  <ccoutant@google.com>
12524
12525         * archive.cc (Archive::get_elf_object_for_member): Remove call
12526         to File_read::claim_for_plugin.
12527         * descriptors.cc (Descriptors::open): Remove reference to
12528         is_claimed.
12529         (Descriptors::claim_for_plugin): Remove.
12530         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12531         (Descriptors::is_claimed): Remove.
12532         (claim_descriptor_for_plugin): Remove.
12533         * fileread.cc (File_read::claim_for_plugin): Remove.
12534         * fileread.h (File_read::claim_for_plugin): Remove.
12535         (File_read::descriptor): Reopen descriptor if necessary.
12536         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12537         (Plugin_manager::all_symbols_read): Add task parameter. Change
12538         all callers.
12539         (Plugin_manager::get_input_file): New function.
12540         (Plugin_manager::release_input_file): New function.
12541         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12542         corresponding data member.
12543         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12544         and pass to base constructor. Change all callers.
12545         (get_input_file, release_input_file): New functions.
12546         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12547         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12548         (Plugin_manager::all_symbols_read): Add task parameter.
12549         (Plugin_manager::get_input_file): New function.
12550         (Plugin_manager::release_input_file): New function.
12551         (Plugin_manager::task_): New data member.
12552         (Pluginobj::Pluginobj): Add filesize parameter.
12553         (Pluginobj::filename): New function.
12554         (Pluginobj::descriptor): New function.
12555         (Pluginobj::filesize): New function.
12556         (Pluginobj::filesize_): New data member.
12557         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12558         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12559         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12560
12561         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12562         with archive libraries.
12563         * testsuite/Makefile.in: Regenerate.
12564         * testsuite/plugin_test.c (struct sym_info): New type.
12565         (get_input_file, release_input_file): New static variables.
12566         (onload): Capture new transfer vector entries.
12567         (claim_file_hook): Stop reading at end of file according to filesize.
12568         Factor out parsing of readelf output into separate function.
12569         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12570         APIs and get the source file name from the symbol table.  Convert
12571         source file name to corresponding object file name.  Print info
12572         message when adding new input files.
12573         (parse_readelf_line): New function.
12574         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12575         * testsuite/plugin_test_2.sh: Likewise.
12576         * testsuite/plugin_test_3.sh: Likewise.
12577         * testsuite/plugin_test_4.sh: New test case.
12578
12579 2009-01-07  Ian Lance Taylor  <iant@google.com>
12580
12581         * version.cc (version_string): Bump to 1.8.
12582
12583 2008-12-23  Cary Coutant  <ccoutant@google.com>
12584
12585         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12586         * plugin.cc (Plugin_manager::finish): Rename as
12587         layout_deferred_objects.  Move cleanup to separate function.
12588         (Plugin_manager::cleanup): New function.
12589         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12590         separately.
12591         * plugin.h (Plugin_manager::finish): Rename as
12592         layout_deferred_objects.
12593         (Plugin_manager::cleanup): New function.
12594         (Plugin_manager::cleanup_done): New field.
12595
12596 2008-12-23  Cary Coutant  <ccoutant@google.com>
12597
12598         * plugin.cc (is_visible_from_outside): New function.
12599         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12600         so we don't return "IR only" status for exported symbols or -r links.
12601
12602         * testsuite/Makefile.am (plugin_test_3): New test case.
12603         * testsuite/Makefile.in: Regenerate.
12604         * testsuite/plugin_test_3.sh: New file.
12605
12606 2008-12-22  Cary Coutant  <ccoutant@google.com>
12607
12608         * object.cc (Sized_relobj::layout_section): New function.
12609         (Sized_relobj::do_layout): Defer layout of input sections until after
12610         plugin has provided replacement files.
12611         (Sized_relobj::do_layout_deferred_sections): New function.
12612         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12613         (Relobj::layout_deferred_sections): New function.
12614         (Relobj::do_layout_deferred_sections): New function.
12615         (Sized_relobj::do_layout_deferred_sections): New function.
12616         (Sized_relobj::layout_section): New function.
12617         (Sized_relobj::Deferred_layout): New structure.
12618         (Sized_relobj::deferred_layout_): New field.
12619         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12620         Change all callers.  Layout deferred sections.
12621         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12622         references.
12623         (Plugin_hook::run): Move code from do_plugin_hook inline.
12624         (Plugin_hook::do_plugin_hook): Remove.
12625         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12626         (Plugin_manager::finish): Renamed, was cleanup.
12627         (Plugin_manager::should_defer_layout): New function.
12628         (Plugin_manager::add_deferred_layout_object): New function.
12629         (Plugin_manager::Deferred_layout_list): New type.
12630         (Plugin_manager::deferred_layout_objects_): New field.
12631         (Plugin_hook::do_plugin_hook): Remove.
12632
12633 2008-12-17  Ian Lance Taylor  <iant@google.com>
12634
12635         * options.h (class General_options): Add --no case for
12636         --export-dynamic.
12637
12638 2008-12-16  Cary Coutant  <ccoutant@google.com>
12639
12640         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12641         vector.
12642         (Plugin_manager::claim_file): Create plugin object even if
12643         plugin did not call the add_symbols callback.
12644         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12645         asking for more symbols than were added.
12646         * testsuite/Makefile.am (plugin_test_1): Add test case with
12647         no global symbols.
12648         (empty.syms): New target.
12649         * testsuite/Makefile.in: Regenerate.
12650         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12651         message. Don't call add_symbols if no globals.
12652         (all_symbols_read_hook): Don't provide replacement for empty
12653         claimed file.
12654
12655 2008-12-12  Ian Lance Taylor  <iant@google.com>
12656
12657         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12658         r_type == 0 for a local symbol with r_sym == 0.
12659         (scan_relocatable_relocs): Pass r_sym to
12660         local_non_section_strategy.
12661         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12662         r_sym parameter.
12663
12664         * configure.ac: Update test for TLS descriptors: they are
12665         supported as of glibc 2.9.
12666         * configure: Rebuild.
12667
12668 2008-12-11  Ian Lance Taylor  <iant@google.com>
12669
12670         PR 7091
12671         * target-reloc.h (Default_scan_relocatable_relocs): For each
12672         function, map r_type == 0 to RELOC_DISCARD.
12673
12674 2008-12-10  Cary Coutant  <ccoutant@google.com>
12675
12676         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12677         object to override a kept COMDAT group from a plugin object.
12678
12679 2008-12-09  Ian Lance Taylor  <iant@google.com>
12680
12681         PR 7088
12682         * yyscript.y (file_cmd): Handle INPUT.
12683
12684         * testsuite/initpri1.c: Change all declarations to be full
12685         prototypes by adding void, to avoid compiler warnings.
12686
12687 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12688
12689         * options.cc (General_options::parse_plugin_opt): New.
12690         (General_options::add_plugin): The argument now is just the filename.
12691         (General_options::add_plugin_option): New.
12692         * options.h (plugin_opt): New.
12693         (add_plugin): Change argument name.
12694         (add_plugin_option): New.
12695         * plugin.cc (Plugin::load): Don't parse the plugin option.
12696         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12697         (Plugin::add_option): New.
12698         (Plugin::args_): Change type.
12699         (Plugin::filename_): New.
12700         (Plugin_manager::add_plugin_option): New.
12701         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12702         * testsuite/Makefile.in: Regenerate.
12703
12704 2008-12-05  Cary Coutant  <ccoutant@google.com>
12705
12706         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12707         Handle --strip-lto-sections option.
12708         * options.h (strip_lto_sections): New option.
12709
12710 2008-12-01  Cary Coutant  <ccoutant@google.com>
12711
12712         * plugin.cc (ld_plugin_message): Change format parameter to const.
12713         Fix mismatch between new[] and delete.
12714
12715 2008-11-14  Cary Coutant  <ccoutant@google.com>
12716
12717         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12718         instead of -1U.
12719
12720 2008-11-05  Craig Silverstein  <csilvers@google.com>
12721
12722         * options.cc (General_options::parse_dynamic_list): New function.
12723         * options.h (General_options): New flags dynamic_list,
12724         dynamic_list_data, dynamic_list_cpp_new, and
12725         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12726         (General_options::in_dynamic_list): New function.
12727         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12728         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12729         (Lex::can_continue_name): Likewise.
12730         (yylex): Likewise.
12731         (read_script_file): New parameter script_options.
12732         (read_dynamic_list): New function.
12733         (Script_options::define_dynamic_list): New function.
12734         (dynamic_list_keyword_parsecodes): New variable.
12735         (dynamic_list_keywords): New variable.
12736         * script.h (Script_options::define_dynamic_list): New function
12737         prototype.
12738         (read_dynamic_list): New function prototype.
12739         * symtab.cc (strprefix): New macro.
12740         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12741         dynamic_list_data, dynamic_list_cpp_new, and
12742         dynamic_list_cpp_typeinfo.
12743         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12744         (dynamic_list_expr): New rule.
12745         (dynamic_list_nodes): Likewise.
12746         (dynamic_list_node): Likewise.
12747         * testsuite/Makefile.am (dynamic_list): New test.
12748         * testsuite/Makefile.in: Regenerated.
12749         * testsuite/dynamic_list.t: New file.
12750         * testsuite/dynamic_list.sh: New file.
12751
12752 2008-11-05  Craig Silverstein  <csilvers@google.com>
12753
12754         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12755         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12756         (t11_last): Likewise.
12757         * testsuite/ver_test_6.c (main): Likewise.
12758
12759 2008-10-07  Cary Coutant  <ccoutant@google.com>
12760
12761         * options.c (General_options::finalize): Add check for -static and
12762         -shared.
12763         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12764         is not empty.
12765
12766 2008-10-02  Cary Coutant  <ccoutant@google.com>
12767
12768         * plugin.cc (make_sized_plugin_object): Fix conditional
12769         compilation to work when not all targets are enabled.
12770
12771 2008-09-29  Cary Coutant  <ccoutant@google.com>
12772
12773         * archive.cc (Archive::get_file_and_offset): Use filename instead
12774         of name to get library path.
12775         (Archive::include_member): Unlock external member of a thin archive.
12776
12777         * testsuite/Makefile.am (TEST_AR): New variable.
12778         (thin_archive_test_1): New test.
12779         (thin_archive_test_2): New test.
12780         * testsuite/Makefile.in: Regenerate.
12781         * testsuite/thin_archive_main.cc: New file.
12782         * testsuite/thin_archive_test_1.cc: New file.
12783         * testsuite/thin_archive_test_2.cc: New file.
12784         * testsuite/thin_archive_test_3.cc: New file.
12785         * testsuite/thin_archive_test_4.cc: New file.
12786
12787 2008-09-29  Cary Coutant  <ccoutant@google.com>
12788
12789         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12790         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12791         instead of -1U.
12792         (Sized_relobj::do_finalize_local_symbols): Likewise.
12793         (Sized_relobj::map_to_kept_section): Likewise.
12794         * object.h (Sized_relobj::invalid_address): New constant.
12795         (Sized_relobj::do_output_section_offset): Check for invalid_address
12796         and return -1ULL.
12797         * output.cc (Output_reloc::local_section_offset): Use constant
12798         invalid_address instead of -1U.
12799         (Output_reloc::get_address): Likewise.
12800         (Output_section::output_address): Change -1U to -1ULL.
12801         * output.h (Output_reloc::invalid_address): New constant.
12802         * reloc.cc (Sized_relobj::write_sections): Use constant
12803         invalid_address instead of -1U.
12804         (Sized_relobj::relocate_sections): Likewise.
12805         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12806         values for merge sections.
12807         * target-reloc.h (relocate_for_relocatable): Use constant
12808         invalid_address instead of -1U.
12809
12810 2008-09-19  Cary Coutant  <ccoutant@google.com>
12811
12812         Add plugin functionality for link-time optimization (LTO).
12813         * configure.ac (plugins): Add --enable-plugins option.
12814         * configure: Regenerate.
12815         * config.in: Regenerate.
12816         * Makefile.am (LIBDL): New variable.
12817         (CCFILES): Add plugin.cc.
12818         (HFILES): Add plugin.h.
12819         (ldadd_var): Add LIBDL.
12820         * Makefile.in: Regenerate.
12821
12822         * archive.cc: Include "plugin.h".
12823         (Archive::setup): Don't preread archive symbols when using a plugin.
12824         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12825         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12826         files.
12827         (Archive::include_member): Add symbols from plugin objects.
12828         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12829         * descriptors.cc (Descriptors::open): Check for file descriptors
12830         abandoned by plugins.
12831         (Descriptors::claim_for_plugin): New function.
12832         * descriptors.h (Descriptors::claim_for_plugin): New function.
12833         (Open_descriptor::is_claimed): New field.
12834         (claim_descriptor_for_plugin): New function.
12835         * fileread.cc (File_read::claim_for_plugin): New function.
12836         * fileread.h (File_read::claim_for_plugin): New function.
12837         (File_read::descriptor): New function.
12838         * gold.cc: Include "plugin.h".
12839         (queue_initial_tasks): Add task to call plugin hooks for generating
12840         new object files.
12841         * main.cc: Include "plugin.h".
12842         (main): Load plugin libraries.
12843         * object.h (Pluginobj): Declare.
12844         (Object::pluginobj): New function.
12845         (Object::do_pluginobj): New function.
12846         (Object::set_target): New function.
12847         * options.cc: Include "plugin.h".
12848         (General_options::parse_plugin): New function.
12849         (General_options::General_options): Initialize plugins_ field.
12850         (General_options::add_plugin): New function.
12851         * options.h (Plugin_manager): Declare.
12852         (General_options): Add --plugin option.
12853         (General_options::has_plugins): New function.
12854         (General_options::plugins): New function.
12855         (General_options::add_plugin): New function.
12856         (General_options::plugins_): New field.
12857         * plugin.cc: New file.
12858         * plugin.h: New file.
12859         * readsyms.cc: Include "plugin.h".
12860         (Read_symbols::do_read_symbols): Check for archive before checking
12861         for ELF file.  Call plugin hooks to claim files.
12862         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12863         from a real object file; force override when processing replacement
12864         files.
12865         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12866         (Symbol::init_base_object): Likewise.
12867         (Symbol::init_base_output_data): Likewise.
12868         (Symbol::init_base_output_segment): Likewise.
12869         (Symbol::init_base_constant): Likewise.
12870         (Symbol::init_base_undefined): Likewise.
12871         (Symbol::output_section): Assert that object is not a plugin.
12872         (Symbol_table::add_from_pluginobj): New function.
12873         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12874         undefined.
12875         (Symbol_table::sized_write_globals): Likewise.
12876         (Symbol_table::add_from_pluginobj): Instantiate template.
12877         * symtab.h (Sized_pluginobj): Declare.
12878         (Symbol::in_real_elf): New function.
12879         (Symbol::set_in_real_elf): New function.
12880         (Symbol::in_real_elf_): New field.
12881         (Symbol_table::add_from_pluginobj): New function.
12882
12883         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12884         (LIBDL): New variable.
12885         (LDADD): Add LIBDL.
12886         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12887         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12888         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12889         (MOSTLYCLEANFILES): Likewise.
12890         * testsuite/Makefile.in: Regenerate.
12891         * testsuite/plugin_test.c: New file.
12892         * testsuite/plugin_test_1.sh: New file.
12893         * testsuite/plugin_test_2.sh: New file.
12894
12895 2008-09-16  Ian Lance Taylor  <iant@google.com>
12896
12897         * target-reloc.h (relocate_section): Check whether a symbol is
12898         defined by the ABI before reporting an undefined symbol error.
12899         * target.h (Target::is_defined_by_abi): Make parameter const.
12900         (Target::do_is_defined_by_abi): Likewise.
12901         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12902         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12903         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12904         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12905         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12906         * testsuite/Makefile.in: Rebuild.
12907
12908         * fileread.cc (make_view): Add casts to avoid warning.
12909
12910 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12911
12912         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12913         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12914
12915 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12916
12917         * options.h (General_options::output_is_executable): New.
12918         (General_options::output_is_pie): New.
12919         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12920         for shared libraries.
12921         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12922
12923 2008-09-11  Chris Demetriou  <cgd@google.com>
12924
12925         * options.h (origin): New -z option.
12926         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12927         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12928         in DT_FLAGS_1.
12929
12930 2008-09-05  Cary Coutant  <ccoutant@google.com>
12931
12932         * fileread.cc (File_read::make_view): Add check for attempt to map
12933         beyond end of file.
12934
12935 2008-09-05  Cary Coutant  <ccoutant@google.com>
12936
12937         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12938         explicit instantiations.
12939
12940 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12941
12942         PR gold/6858
12943         * options.cc (General_options::finalize): Allow undefined symbols
12944         in shlibs if linking -shared.
12945
12946         PR gold/6859
12947         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12948         symbols as not needing a dynsym entry.
12949
12950 2008-08-20  Craig Silverstein  <csilvers@google.com>
12951
12952         * fileread.cc (File_read::open): Do not lock the file unless it
12953         was successfully opened.
12954
12955 2008-08-14  Cary Coutant  <ccoutant@google.com>
12956
12957         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12958         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12959         * testsuite/tls_test.cc (struct int128): 128-bit struct
12960         for testing TLS relocs with non-zero addend.
12961         (v12): New TLS variable.
12962         (t12): New test.
12963         (t_last): Add check for v12.
12964         * testsuite/tls_test.h (t12): New function.
12965         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12966
12967 2008-08-13  Ian Lance Taylor  <iant@google.com>
12968
12969         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12970         set tls_segment_ or relro_segment_.
12971         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12972         when appropriate.
12973         * output.h (Output_section::clear_is_relro): New function.
12974         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12975         sections specially even when output_data_ is empty.
12976         (Output_segment::maximum_alignment): When first section is relro,
12977         only force alignment for PT_LOAD segments.
12978         * script.cc (script_data_segment_align): New function.
12979         (script_data_segment_relro_end): New function.
12980         * script-c.h (script_data_segment_align): Declare.
12981         (script_data_segment_relro_end): Declare.
12982         * script-sections.h (class Script_sections): Declare
12983         data_segment_align and data_segment_relro_end.  Add fields
12984         segment_align_index_ and saw_relro_end_.
12985         * script-sections.cc (class Sections_element): Add set_is_relro
12986         virtual function.  Add new bool* parameter to place_orphan_here.
12987         Add get_output_section virtual function.
12988         (class Output_section_definition): Add set_is_relro.  Add new
12989         bool* parameter to place_orphan_here.  Add get_output_section.
12990         Add is_relro_ field.
12991         (Output_section_definition::Output_section_definition): Initialize
12992         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12993         and is_relro_ fields.
12994         (Output_section_definition::place_orphan_here): Add is_relro
12995         parameter.
12996         (Output_section_definition::set_section_addresses): Set relro for
12997         output section.
12998         (Output_section_definition::alternate_constraint): Likewise.
12999         (class Orphan_output_section): Add new bool* parameter to
13000         place_orphan_here.  Add get_output_section.
13001         (Orphan_output_section::place_orphan_here): Add is_relro
13002         parameter.
13003         (Script_sections::Script_sections): Initialize
13004         data_segment_align_index_ and saw_relro_end_.
13005         (Script_sections::data_segment_align): New function.
13006         (Script_sections::data_segment_relro_end): New function.
13007         (Script_sections::place_orphan): Set or clear is_relro.
13008         (Script_sections::set_section_addresses): Force alignment of first
13009         TLS section.
13010         * yyscript.y (exp): Call script_data_segment_align and
13011         script_data_segment_relro_end.
13012         * testsuite/relro_script_test.t: New file.
13013         * testsuite/relro_test.cc (using_script): Declare.
13014         (t1, t2): Test using_script.
13015         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13016         (relro_script_test_SOURCES): Define.
13017         (relro_script_test_DEPENDENCIES): Define.
13018         (relro_script_test_LDFLAGS): Define.
13019         (relro_script_test_LDADD): Define.
13020         (relro_script_test.so): New target.
13021         * testsuite/Makefile.in: Rebuild.
13022
13023 2008-08-06  Cary Coutant <ccoutant@google.com>
13024
13025         * archive.cc (Archive::total_archives, Archive::total_members)
13026         (Archive::total_members_loaded): New variables.
13027         (Archive::setup): Add parameter.  Add option to preread
13028         archive symbols.
13029         (Archive::read_armap): Add counter.
13030         (Archive::get_file_and_offset): New function.
13031         (Archive::get_elf_object_for_member): New function.
13032         (Archive::read_all_symbols): New function.
13033         (Archive::read_symbols): New function.
13034         (Archive::add_symbols): Add counters.
13035         (Archive::include_all_members): Use armap to find members if it's
13036         already built.
13037         (Archive::include_member): Skip reading symbols if already read.
13038         Factored code into Archive::get_file_and_offset and
13039         Archive::get_elf_object_for_member.  Changed call to
13040         Mapfile::report_include_archive_member.
13041         (Archive::print_stats): New function.
13042         * archive.h: Declare Object and Read_symbols_data classes.
13043         (Archive::Archive): Add initializers for new members.
13044         (Archive::setup): Add parameter.
13045         (Archive::print_stats): New function.
13046         (Archive::total_archives, Archive::total_members)
13047         (Archive::total_members_loaded): New variables.
13048         (Archive::get_file_and_offset): New function.
13049         (Archive::get_elf_object_for_member): New function.
13050         (Archive::read_all_symbols): New function.
13051         (Archive::read_symbols): New function.
13052         (Archive::Archive_member): New class.
13053         (Archive::members_): New member.
13054         (Archive::num_members_): New member.
13055         * main.cc: Include archive.h.
13056         (main): Call Archive::print_stats.
13057         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13058         archive parameter; member_name is now the fully-decorated name.
13059         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13060         * options.h: (General_options): Add --preread-archive-symbols option.
13061         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13062         Archive::setup.
13063
13064 2008-08-04  Ian Lance Taylor  <iant@google.com>
13065
13066         * symtab.h (Symbol::use_plt_offset): New function.
13067         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13068         * powerpc.cc (Relocate::relocate): Likewise.
13069         * sparc.cc (Relocate::relocate): Likewise.
13070         * x86_64.cc (Relocate::relocate): Likewise.
13071         * testsuite/weak_plt.sh: New test.
13072         * testsuite/weak_plt_main.cc: New test.
13073         * testsuite/weak_plt_shared.cc: New test.
13074         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13075         (check_PROGRAMS): Add weak_plt.
13076         (check_DATA): Add weak_plt_shared.so.
13077         (weak_plt_main_pic.o, weak_plt): New targets.
13078         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13079         * testsuite/Makefile.in: Rebuild.
13080
13081         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13082         gcctestdir/ld.
13083         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13084         * testsuite/Makefile.in: Rebuild.
13085
13086 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13087
13088         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13089         * Makefile.in: Regenerate.
13090         * po/POTFILES.in: Regenerate.
13091
13092 2008-07-29  Ian Lance Taylor  <iant@google.com>
13093
13094         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13095         symbols before other symbols.
13096         * testsuite/script_test_2.cc (test_addr): Declare.
13097         (test_addr_alias): Declare.
13098         (main): Check that test_addr and test_addr_alias have the right
13099         values.
13100         * testsuite/script_test_2.t: Define test_addr_alias and
13101         test_addr.
13102
13103 2008-07-24  Ian Lance Taylor  <iant@google.com>
13104
13105         PR 5990
13106         * descriptors.cc: New file.
13107         * descriptors.h: New file.
13108         * gold-threads.h (class Hold_optional_lock): New class.
13109         * fileread.cc: Include "descriptors.h".
13110         (File_read::~File_read): Release descriptor rather than closing
13111         it.
13112         (File_read::open) [file]: Call open_descriptor rather than open.
13113         Set is_descriptor_opened_.
13114         (File_read::open) [memory]: Assert that descriptor is not open.
13115         (File_read::reopen_descriptor): New function.
13116         (File_read::release): Release descriptor.
13117         (File_read::do_read): Make non-const.  Reopen descriptor.
13118         (File_read::read): Make non-const.
13119         (File_read::make_view): Reopen descriptor.
13120         (File_read::do_readv): Likewise.
13121         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13122         Update declarations.
13123         * layout.cc: Include "descriptors.h".
13124         (Layout::create_build_id): Use open_descriptor rather than open.
13125         * output.cc: Include "descriptors.h".
13126         (Output_file::open): Use open_descriptor rather than open.
13127         * archive.cc (Archive::const_iterator): Change Archive to be
13128         non-const.
13129         (Archive::begin, Archive::end): Make non-const.
13130         (Archive::count_members): Likewise.
13131         * archive.h (class Archive): Update declarations.
13132         * object.h (Object::read): Make non-const.
13133         * Makefile.am (CCFILES): Add descriptors.cc.
13134         (HFILES): Add descriptors.h.
13135         * Makefile.in: Rebuild.
13136
13137         PR 6716
13138         * gold.h: Always include <clocale>.  Add Solaris workarounds
13139         following code in binutils/sysdep.h.
13140
13141         PR 6048
13142         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13143         this->eh_frame_hdr_ is NULL before using it.
13144
13145         * dynobj.cc (Versions::Versions): Update comment.
13146
13147         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13148         the base version name.
13149
13150         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13151         array size plus one.
13152         (Stringpool_template::set_string_offsets): Subtract one from key
13153         before using it as an array index.
13154         (Stringpool_template::get_offset_with_length): Likewise.
13155         (Stringpool_template::write_to_buffer): Likewise.
13156         * stringpool.h (Stringpool_template::get_offset_from_key):
13157         Likewise.
13158
13159 2008-07-23  Ian Lance Taylor  <iant@google.com>
13160
13161         PR 6658
13162         * object.h (Merged_symbol_value::value): Do our best to handle a
13163         negative addend.
13164
13165         PR 6647
13166         * script.cc (Version_script_info::get_versions): Don't add empty
13167         version tag to return value.
13168         (Version_script_info::get_symbol_version_helper): Change return
13169         type to bool.  Add pversion parameter.  Change all callers.
13170         (script_register_vers_node): Don't require a non-NULL tag.
13171         * script.h (class Version_script_info): Update declarations.
13172         (Version_script_info::get_symbol_version): Change return type to
13173         bool.  Add version parameter.  Change all callers.
13174         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13175         handling.  Handle an empty version from a version script.
13176         (Symbol_table::define_special_symbol): Likewise.
13177         * testsuite/ver_test_10.script: New file.
13178         * testsuite/ver_test_10.sh: New file.
13179         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13180         (check_DATA): Add ver_test_10.syms.
13181         (ver_test_10.syms, ver_test_10.so): New target.
13182         * testsuite/Makefile.in: Rebuild.
13183
13184 2008-07-23  Simon Baldwin  <simonb@google.com>
13185
13186         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13187         to zero for undefined symbols from dynamic libraries.
13188
13189 2008-07-23  Ian Lance Taylor  <iant@google.com>
13190
13191         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13192         Change all callers.
13193         * symtab.h (class Symbol_table): Update declaration.
13194         * testsuite/ver_test_9.cc: New file.
13195         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13196         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13197         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13198         (ver_test_9.so, ver_test_9.o): New targets.
13199         * testsuite/Makefile.in: Rebuild.
13200
13201 2008-07-22  Ian Lance Taylor  <iant@google.com>
13202
13203         * options.h (class General_options): Define --check-sections.
13204         * layout.cc (Layout::set_segment_offsets): Handle
13205         --check-sections.
13206
13207         * options.h (class General_options): Define -n/--nmagic and
13208         -N/--omagic.
13209         * options.cc (General_options::finalize): For -n/--nmagic or
13210         -N/--omagic, set -static.
13211         * layout.cc (Layout::attach_allocated_section_to_segment): If
13212         -N/--omagic, don't put read-only and read-write sections in
13213         different segments.
13214         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13215         finding a read-only segment.
13216         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13217         don't set the minimum segment alignment to the common page size,
13218         and don't set the file offset to the address modulo the page size.
13219         * script-sections.cc (Script_sections::create_segments): If
13220         -n/--omagic, don't put read-only and read-write sections in
13221         different segments.
13222
13223         * cref.cc: New file.
13224         * cref.h: New file.
13225         * options.h (class General_options): Add --print-symbol-counts.
13226         * main.cc (main): Issue defined symbol report if requested.
13227         * archive.cc (Archive::interpret_header): Make into a const member
13228         function.
13229         (Archive::add_symbols): Call Input_objects::archive_start and
13230         archive_stop.
13231         (Archive::const_iterator): Define new class.
13232         (Archive::begin, Archive::end): New functions.
13233         (Archive::include_all_members): Rewrite to use iterator.
13234         (Archive::count_members): New function.
13235         * archive.h (class Archive): Update declarations.
13236         (Archive::filename): New function.
13237         * object.cc: Include "cref.h".
13238         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13239         (Sized_relobj::do_get_global_symbol_counts): New function.
13240         (Input_objects::add_object): Add object to cross-referencer.
13241         (Input_objects::archive_start): New function.
13242         (Input_objects::archive_stop): New function.
13243         (Input_objects::print_symbol_counts): New function.
13244         * object.h: Declare Cref and Archive.
13245         (Object::get_global_symbol_counts): New function.
13246         (Object::do_get_global_symbol_counts): New pure virtual function.
13247         (class Sized_relobj): Add defined_count_ field.  Update
13248         declarations.
13249         (class Input_objects): Add cref_ field.  Update constructor.
13250         Update declarations.
13251         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13252         defined_count_.
13253         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13254         symbol counts.
13255         (Sized_dynobj::do_get_global_symbol_counts): New function.
13256         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13257         defined_count_.  Update declarations.  Define Symbols typedef.
13258         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13259         parameter.  Change all callers.
13260         (Symbol_table::add_from_dynobj): Add sympointers and defined
13261         parameters.  Change all callers.
13262         * symtab.h (class Symbol_table): Update declarations.
13263         * Makefile.am (CCFILES): Add cref.cc.
13264         (HFILES): Add cref.h.
13265         * Makefile.in: Rebuild.
13266
13267 2008-07-22  Simon Baldwin  <simonb@google.com>
13268
13269         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13270         to zero when writing undefined symbols.
13271
13272 2008-07-22  Ian Lance Taylor  <iant@google.com>
13273
13274         * output.cc (Output_section::add_input_section): Don't try to
13275         merge empty merge sections.
13276
13277 2008-07-21  Craig Silverstein  <csilvers@google.com>
13278
13279         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13280         Include symbol version in error message.
13281
13282 2008-07-20  Chris Demetriou  <cgd@google.com>
13283
13284         * configure.ac (gold_cv_c_random_seed): New configured variable.
13285         (RANDOM_SEED_CFLAGS): New substituted variable.
13286         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13287         * configure: Rebuild.
13288         * Makefile.in: Likewise.
13289         * testsuite/Makefile.in: Likewise.
13290
13291 2008-07-18  Ian Lance Taylor  <iant@google.com>
13292
13293         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13294         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13295         * testsuite/ver_test_main.cc (main): Call t4.
13296         (t4, t4_2a): Define.
13297         * testsuite/ver_test_2.cc (t4_2): Define.
13298         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13299         * testsuite/ver_test_4.cc (t4_2a): Define.
13300         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13301         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13302
13303 2008-07-17  Ian Lance Taylor  <iant@google.com>
13304
13305         * dynobj.cc (Versions::add_def): If we give an error about a
13306         missing version, go ahead and create the version anyhow.
13307
13308 2008-07-10  Ian Lance Taylor  <iant@google.com>
13309
13310         Handle output sections with more than 0x7fffffff bytes.
13311         * object.h (class Relobj): Change map_to_output_ to
13312         output_sections_, and just keep a section pointer.  Change all
13313         uses.  Move comdat group support to Sized_relobj.
13314         (Relobj::is_section_specially_mapped): Remove.
13315         (Relobj::output_section): Remove poff parameter.  Change all
13316         callers.
13317         (Relobj::output_section_offset): New function.
13318         (Relobj::set_section_offset): Rewrite.
13319         (Relobj::map_to_output): Remove.
13320         (Relobj::output_sections): New function.
13321         (Relobj::do_output_section_offset): New pure virtual function.
13322         (Relobj::do_set_section_offset): Likewise.
13323         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13324         group support from Relobj.  Update declarations.
13325         (Sized_relobj::get_output_section_offset): New function.
13326         (Sized_relobj::do_output_section_offset): New function.
13327         (Sized_relobj::do_set_section_offset): New function.
13328         * object.cc (Relobj::output_section_address): Remove.
13329         (Sized_relobj::Sized_relobj): Initialize new fields.
13330         (Sized_relobj::include_section_group): Cast find_kept_object to
13331         Sized_relobj.
13332         (Sized_relobj::include_linkonce_section): Likewise.
13333         (Sized_relobj::do_layout): Use separate arrays for output section
13334         and output offset.
13335         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13336         output_sections.
13337         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13338         output_sections and section_offsets.
13339         (Sized_relobj::write_local_symbols): Likewise.
13340         (map_to_kept_section): Compute output address directly.
13341         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13342         output_sections and section_offsets.
13343         (Sized_relobj::write_sections): Likewise.
13344         (Sized_relobj::relocate_sections): Likewise.
13345         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13346         * output.h (class Output_reloc): Update declarations.  Change
13347         u2_.relobj to Sized_relobj*.
13348         (class Output_data_reloc): Change add functions to use
13349         Sized_relobj*.
13350         * output.cc (Output_reloc::Output_reloc): Change relobj to
13351         Sized_relobj*.
13352         (Output_reloc::local_section_offset): Change return type to
13353         Elf_Addr.  Use get_output_section_offset.
13354         (Output_reloc::get_address): Likewise.
13355         (Output_section::is_input_address_mapped): Don't call
13356         is_section_specially_mapped.
13357         (Output_section::output_offset): Likewise.
13358         (Output_section::output_address): Likewise.
13359         (Output_section::starting_output_address): Likewise.
13360         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13361         parameter to Sized_relobj*.
13362         (Copy_relocs::need_copy_reloc): Likewise.
13363         (Copy_relocs::save): Likewise.
13364         * copy-relocs.h (class Copy_relocs): Update declarations.
13365         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13366         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13367         * target-reloc.h (relocate_for_relocatable): Change
13368         offset_in_output_section type to Elf_Addr.  Change code that uses
13369         it as well.
13370         * layout.cc (Layout::layout): Always set *off.
13371         * mapfile.cc (Mapfile::print_input_section): Use
13372         output_section_offset.
13373         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13374         Sized_relobj*.
13375         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13376         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13377         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13378
13379 2008-07-03  Ian Lance Taylor  <iant@google.com>
13380
13381         * layout.cc (Layout::include_section): Do not discard unrecognized
13382         SHT_STRTAB sections.
13383
13384 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13385
13386         * script.cc (Lex::can_continue_name): Make '?' allowable in
13387         version-script names.
13388         * testsuite/version_script.map: Change glob pattern to use '?'
13389
13390 2008-06-30  Manish Singh  <yosh@gimp.org>
13391
13392         PR 6585
13393         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13394         Correct typo.
13395
13396 2008-06-30  Ian Lance Taylor  <iant@google.com>
13397
13398         PR 6660
13399         PR 6682
13400         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13401         versions]: Don't try to read the value in the contents, since we
13402         don't use it.  Use the template endianness when writing.
13403
13404 2008-06-25  Cary Coutant  <ccoutant@google.com>
13405
13406         * fileread.cc (File_read::make_view): Assert on zero-length view.
13407         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13408         symbol table when there are no symbols to read.
13409
13410 2008-06-23  Craig Silverstein  <csilvers@google.com>
13411
13412         * version.cc (version_string): Bump to 1.7
13413
13414 2008-06-18  Craig Silverstein  <csilvers@google.com>
13415
13416         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13417         constant 0xFFFF to type Valtype.
13418         (Powerpc_relocate_functions::rel16_ha): Likewise.
13419
13420 2008-06-17  Ian Lance Taylor  <iant@google.com>
13421
13422         * output.h (Output_section::Input_section): Initialize p2align_ to
13423         zero for Output_section_data constructors.
13424         (Output_section::Input_section::addralign): If not an input
13425         section, return the alignment of the Output_section_data.
13426         * testsuite/copy_test.cc: New file.
13427         * testsuite/copy_test_1.cc: New file.
13428         * testsuite/copy_test_2.cc: New file.
13429         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13430         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13431         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13432         (copy_test_1_pic.o, copy_test_1.so): New targets.
13433         (copy_test_2_pic.o, copy_test_2.so): New targets.
13434         * testsuite/Makefile.in: Rebuild.
13435
13436         * script-sections.cc (Script_sections::place_orphan): Initialize
13437         local variable exact.
13438
13439 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13440
13441         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13442
13443 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13444             David S. Miller  <davem@davemloft.net>
13445
13446         * powerpc.cc: New file.
13447         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13448         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13449         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13450         * Makefile.in: Rebuild.
13451
13452 2008-06-09  Ian Lance Taylor  <iant@google.com>
13453
13454         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13455         <exception>.
13456         (throwing, orig_terminate): New static variables.
13457         (terminate_handler): New static function.
13458         (t2): Set terminate handler.
13459
13460 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13461
13462         PR 6584
13463         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13464         alignment.
13465
13466 2008-05-30  Cary Coutant  <ccoutant@google.com>
13467
13468         * archive.cc (Archive::include_all_members) Correct to step
13469         over symbol table and extended name table in thin archives.
13470
13471 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13472
13473         PR 6407
13474         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13475         calculation.
13476
13477 2008-05-28  Caleb Howe  <cshowe@google.com>
13478
13479         * reduced_debug_output.cc: New file.
13480         * reduced_debug_output.h: New file.
13481         * options.h (class General_options): Add --strip-debug-non-line.
13482         * options.cc (General_options::finalize): Add strip_debug_non_line
13483         to the strip heirarchy.
13484         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13485         fields.
13486         * layout.cc: Include "reduced_debug_output.h".
13487         (Layout::Layout): Initialize new fields.
13488         (line_only_debug_sections): New static array.
13489         (is_lines_only_debug_sections): New static inline function.
13490         (Layout::include_section): Handle --strip-debug-non-line.
13491         (Layout::make_output_section): If --strip-debug-non-line, build
13492         new output sections for .debug_abbrev and .debug_info.
13493         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13494         gold.  Warn about possible overflow.
13495         (read_signed_LEB_128): Likewise.
13496         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13497         (read_signed_LEB_128): Declare.
13498         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13499         (HFILES): Add reduced_debug_output.h.
13500         * Makefile.in: Rebuild.
13501
13502 2008-05-21  Ian Lance Taylor  <iant@google.com>
13503
13504         * mapfile.cc: New file.
13505         * mapfile.h: New file.
13506         * options.h (class General_options): Add -M/--print-map and -Map.
13507         * options.cc (General_options::finalize): Make -M equivalent to
13508         -Map -.
13509         * main.cc: Include <cstdio> and "mapfile.h".
13510         (main): Open mapfile if requested.
13511         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13512         constructor.  Change caller.
13513         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13514         (queue_middle_tasks): Likewise.
13515         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13516         declarations.
13517         * archive.cc: Include "mapfile.h".
13518         (Archive::add_symbols): Add mapfile parameter.  Change all
13519         callers.  Pass mapfile, symbol, and reason to include_member.
13520         (Archive::include_all_members): Add mapfile parameter.  Change all
13521         callers.
13522         (Archive::include_member): Add mapfile, sym, and why parameters.
13523         Change all callers.  Report inclusion to map file.
13524         * archive.h: Include "fileread.h".
13525         (class Archive): Update declarations.
13526         (Archive::file): New const method.
13527         (class Add_archive_symbols): Add mapfile_ field.  Update
13528         constructor.  Change all callers.
13529         * readsyms.h (class Read_symbols): Likewise.
13530         (class Finish_group): Likewise.
13531         (class Read_script): Likewise.
13532         * common.cc: Include "mapfile.h".
13533         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13534         all callers.
13535         (Symbol_table::do_allocate_commons): Likewise.
13536         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13537         symbol allocation to mapfile.
13538         * common.h (class Allocate_commons_task): Add mapfile_ field.
13539         Update constructor.  Change all callers.
13540         * symtab.h (class Symbol_table): Update declarations.
13541         * layout.cc: Include "mapfile.h".
13542         (Layout_task_runner::run): Print information to mapfile.
13543         (Layout::create_gold_note): Change Output_data_fixed_space to
13544         Output_data_zero_fill.
13545         (Layout::create_build_id): Likewise.
13546         (Layout::print_to_mapfile): New function.
13547         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13548         constructor.  Change caller.
13549         (class Layout): Declare print_to_mapfile.
13550         * output.cc (Output_section::Input_section::print_to_mapfile): New
13551         function.
13552         (Output_section::add_input_section): If producing a map, always
13553         add to input_sections_ list.
13554         (Output_section::do_print_to_mapfile): New function.
13555         (Output_segment::print_sections_to_mapfile): New function.
13556         (Output_segment::print_section_list_to_mapfile): New function.
13557         * output.h: Include "mapfile.h".
13558         (Output_data::print_to_mapfile): New function.
13559         (Output_data::do_print_to_mapfile): New virtual function.
13560         (Output_segment_headers::do_print_to_mapfile): New function.
13561         (Output_file_header::do_print_to_mapfile): New function.
13562         (Output_data_const::do_print_to_mapfile): New function.
13563         (class Output_data_const_buffer): Add map_name_ field.  Update
13564         constructor.  Change all callers.  Add do_print_to_mapfile
13565         function.
13566         (class Output_data_fixed_space): Likewise.
13567         (class Output_data_space): Likewise.
13568         (class Output_data_zero_fill): New class.
13569         (Output_data_strtab::do_print_to_mapfile): New function.
13570         (Output_data_reloc_base::do_print_to_mapfile): New function.
13571         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13572         (Output_data_group::do_print_to_mapfile): New function.
13573         (Output_data_got::do_print_to_mapfile): New function.
13574         (Output_data_dynamic::do_print_to_mapfile): New function.
13575         (Output_symtab_xindex::do_print_to_mapfile): New function.
13576         (class Output_section): Declare do_print_to_mapflie.  Declare
13577         print_to_mapfile in Input_section.
13578         (class Output_segment): Declare new functions.
13579         * object.h (Sized_relobj::symbol_count): New function.
13580         * script-sections.cc
13581         (Output_section_element_dot_assignment::set_section_addresses):
13582         Change Output_data_fixed_space to Output_data_zero_fill.
13583         (Output_data_expression::do_print_to_mapfile): New function.
13584         * script.cc (read_input_script): Add mapfile parameter.  Change
13585         all callers.
13586         * script.h (read_input_script): Update declaration.
13587         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13588         (Eh_frame::do_print_to_mapfile): New function.
13589         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13590         (Output_merge_string::do_print_to_mapfile): New function.
13591         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13592         function.
13593         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13594         function.
13595         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13596         function.
13597         * Makefile.am (CCFILES): Add mapfile.cc.
13598         (HFILES): Add mapfile.h.
13599         * Makefile.in: Rebuild.
13600
13601 2008-05-19  Ian Lance Taylor  <iant@google.com>
13602
13603         * options.h (class General_options): Add -z relro.
13604         * layout.cc (Layout::Layout): Initialize relro_segment_.
13605         (Layout::add_output_section_data): Return the output section.
13606         (Layout::make_output_section): Rcognize relro sections and mark
13607         them appropriately.
13608         (Layout::attach_allocated_section_to_segment): Put relro sections
13609         in a PT_GNU_RELRO segment.
13610         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13611         section as relro.
13612         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13613         PT_TLS segments.
13614         (Layout::linkonce_mapping): Map d.rel.ro.local to
13615         .data.rel.ro.local.
13616         (Layout::output_section_name): Us .data.rel.ro.local for any
13617         section which begins with that.
13618         * layout.h (class Layout): Update add_output_section_data
13619         declaration.  Add relro_segment_ field.
13620         * output.cc (Output_section::Output_section): Initialize is_relro_
13621         and is_relro_local_ fields.
13622         (Output_segment::add_output_section): Group relro sections.
13623         (Output_segment::is_first_section_relro): New function.
13624         (Output_segment::maximum_alignment): If there is a relro section,
13625         align the segment to the common page size.
13626         (Output_segment::set_section_addresses): Track whether we are
13627         looking at relro sections.  If the last section is a relro
13628         section, align to the common page size.
13629         (Output_segment::set_section_list_addresses): Add in_relro
13630         parameter.  Change all callers.  Align to the page size when
13631         moving from relro to non-relro section.
13632         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13633         segment.
13634         * output.h (class Output_section): Add is_relro_ and
13635         is_relro_local_ fields.
13636         (Output_section::is_relro): New function.
13637         (Output_section::set_is_relro): New function.
13638         (Output_section::is_relro_local): New function.
13639         (Output_section::set_is_relro_local): New function.
13640         (class Output_segment): Update declarations.
13641         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13642         * sparc.cc (Target_sparc::got_section): Likewise.
13643         * x86_64.cc (Target_x86_64::got_section): Likewise.
13644         * testsuite/relro_test_main.cc: New file.
13645         * testsuite/relro_test.cc: New file.
13646         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13647         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13648         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13649         (relro_test.so, relro_test_pic.o): New targets.
13650         * testsuite/Makefile.in: Rebuild.
13651
13652 2008-05-16  Ian Lance Taylor  <iant@google.com>
13653
13654         * output.cc (Output_segment::add_output_section): Remove front
13655         parameter.
13656         * output.h (class Output_segment): Remove
13657         add_initial_output_section and overloaded add_output_section.
13658         Update declaration of remaining add_output_section.
13659         * layout.cc (Layout::create_interp): Call add_output_section
13660         rather than add_initial_output_section.
13661         (Layout::finish_dynamic_section): Likewise.
13662
13663         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13664         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13665         know the dynamic type.
13666         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13667         field.  Initialize it in constructor.
13668         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13669         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13670         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13671         reloc.
13672
13673         * output.cc (Output_reloc::get_address): Change return type to
13674         Elf_Addr.
13675         * output.h (class Output_reloc): Update get_address declaration.
13676         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13677         for section addresses.
13678
13679 2008-05-09  Ian Lance Taylor  <iant@google.com>
13680
13681         PR 6493
13682         * gold.cc (gold_nomem): Use return value of write.
13683
13684 2008-05-08  Ian Lance Taylor  <iant@google.com>
13685
13686         * symtab.c (Symbol::init_base_output_data): Add version
13687         parameter.  Change all callers.
13688         (Symbol::init_base_output_segment): Likewise.
13689         (Symbol::init_base_constant): Likewise.
13690         (Symbol::init_base_undefined): Likewise.
13691         (Sized_symbol::init_output_data): Likewise.
13692         (Sized_symbol::init_output_segment): Likewise.
13693         (Sized_symbol::init_constant): Likewise.
13694         (Sized_symbol::init_undefined): Likewise.
13695         (Symbol_table::do_define_in_output_data): If the new symbol has a
13696         version, mark it as the default.
13697         (Symbol_table::do_define_in_output_segment): Likewise.
13698         (Symbol_table::do_define_as_constant): Likewise.
13699         * symtab.h (class Symbol): Update declarations.
13700         (class Sized_symbol): Likewise.
13701         * resolve.cc (Symbol::override_version): New function.
13702         (Symbol::override_base): Call override_version.
13703         (Symbol::override_base_with_special): Likewise.
13704         * testsuite/ver_script_8.script: New file.
13705         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13706         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13707         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13708         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13709
13710 2008-05-06  Ian Lance Taylor  <iant@google.com>
13711
13712         PR 6049
13713         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13714         functions.
13715         (class General_options): Remove existing --undefined, and add
13716         --no-undefined instead.  Add new --undefined as synonym for -u.
13717         * archive.cc (Archive::add_symbols): Check whether symbol was
13718         named with -u.
13719         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13720         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13721         all uses.  Add IS_UNDEFINED.  Update declarations to split
13722         different versions of init_base.  Declare init_base_undefined.
13723         (Symbol::is_defined): Handle IS_UNDEFINED.
13724         (Symbol::is_undefined): Likewise.
13725         (Symbol::is_weak_undefined): Call is_undefined.
13726         (Symbol::is_absolute): Handle IS_CONSTANT.
13727         (class Sized_symbol): Update declarations to split different
13728         versions of init.  Declare init_undefined.
13729         (class Symbol_table): Declare new functions.
13730         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13731         Change all callers.
13732         (Symbol::init_base_output_data): Likewise.
13733         (Symbol::init_base_output_segment): Likewise.
13734         (Symbol::init_base_constant): Likewise.
13735         (Symbol::init_base_undefined): New function.
13736         (Sized_symbol::init_object): Rename from init.  Change all
13737         callers.
13738         (Sized_symbol::init_output_data): Likewise.
13739         (Sized_symbol::init_output_segment): Likewise.
13740         (Sized_symbol::init_constant): Likewise.
13741         (Sized_symbol::init_undefined): New function.
13742         (Symbol_table::add_undefined_symbols_from_command_line): New
13743         function.
13744         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13745         function.
13746         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13747         (Symbol::output_section): Likewise.
13748         (Symbol::set_output_section): Likewise.
13749         (Symbol_table::sized_finalize_symbol): Likewise.
13750         (Symbol_table::sized_write_globals): Likewise.
13751         * resolve.cc (Symbol_table::should_override): Likewise.
13752         (Symbol::override_base_with_special): Likewise.
13753
13754         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13755         symbol, change it to have default visibility.
13756         * testsuite/protected_1.cc: New file.
13757         * testsuite/protected_2.cc: New file.
13758         * testsuite/protected_3.cc: New file.
13759         * testsuite/protected_main_1.cc: New file.
13760         * testsuite/protected_main_2.cc: New file.
13761         * testsuite/protected_main_3.cc: New file.
13762         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13763         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13764         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13765         (protected_1.so): New target.
13766         (protected_1_pic.o, protected_2_pic.o): New targets.
13767         (protected_3_pic.o): New target.
13768         (check_PROGRAMS): Add protected_2.
13769         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13770         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13771         * testsuite/Makefile.in: Rebuild.
13772
13773         * options.h (DEFINE_var): Add set_user_set_##varname__.
13774         (DEFINE_bool_alias): New macro.
13775         (class General_options): Define -Bstatic using DEFINE_bool_alias
13776         rather than DEFINE_special.  Add --undefined as an alias for -z
13777         defs.
13778         * options.cc (General_options::parse_Bstatic): Remove.
13779
13780         * options.h (class General_options): Add --fatal-warnings.
13781         * main.cc (main): Implement --fatal-warnings.
13782         * errors.h (Errors::warning_count): New function.
13783
13784         * options.h (class General_options): Add -Bsymbolic-functions.
13785         * symtab.h (Symbol::is_preemptible): Check for
13786         -Bsymbolic-functions.
13787
13788 2008-05-05  Ian Lance Taylor  <iant@google.com>
13789
13790         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13791         as noVARNAME rather than no-VARNAME.
13792         (class General_options): Add option -z combreloc.
13793         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13794         get_address.
13795         (Output_reloc::sort_before) [SHT_REL]: New function.
13796         (Output_reloc::sort_before) [SHT_RELA]: New function.
13797         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13798         Sort_relocs_comparison.
13799         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13800         parameter.  Change all callers.
13801         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13802         sort_relocs parameter.  Change all callers.
13803         * output.cc (Output_reloc::get_address): New function, broken out
13804         of write_rel.
13805         (Output_reloc::write_rel): Call it.
13806         (Output_reloc::compare): New function.
13807         (Output_data_reloc_base::do_write): Optionally sort relocs.
13808
13809         * configure.ac: If targ_extra_obj is set, link it in.
13810         * configure.tgt: Initialize all variables.
13811         (x86_64*): Set targ_extra_obj and targ_extra_size.
13812         * configure: Rebuild.
13813
13814         * object.cc (Sized_relobj::include_section_group): Adjust section
13815         indexes read from group data.  Build vector to pass to
13816         layout_group.
13817         * layout.cc (Layout::layout_group): Add flags and shndxes
13818         parameters.  Remove contents parameter.  Change caller.  Update
13819         explicit instantiations.
13820         * layout.h (class Layout): Update layout_group declaration.
13821         * output.cc (Output_data_group::Output_data_group): Add flags and
13822         input_shndxes parameters.  Remove contents parameter.  Change
13823         caller.
13824         (Output_data_group::do_write): Change input_sections_ to
13825         input_shndxes_.
13826         * output.h (class Output_data_group): Update constructor
13827         declaration.  Rename input_sections_ to input_shndxes_.
13828         * testsuite/many_sections_test.cc: Add template.
13829
13830 2008-04-30  Cary Coutant  <ccoutant@google.com>
13831
13832         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13833
13834         * layout.cc (Layout::include_section): Refactored check for debug
13835         info section.
13836         (Layout::add_comdat): Add new parameters.  Change type
13837         of signature parameter.  Add object and shndx to signatures table.
13838         (Layout::find_kept_object): New function.
13839         * layout.h: Include <cstring>.
13840         (Layout::is_debug_info_section): New function.
13841         (Layout::add_comdat): Add new parameters.
13842         (Layout::find_kept_object): New function.
13843         (Layout::Kept_section): New struct.
13844         (Layout::Signatures): Change type of map range.
13845         * object.cc (Relobj::output_section_address): New function.
13846         (Sized_relobj::include_section_group): Add new parameters.  Change
13847         calls to Layout::add_comdat.  Change to build table of kept comdat
13848         groups and table mapping discarded sections to kept sections.
13849         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13850         (Sized_relobj::do_layout): Change calls to include_section_group and
13851         include_linkonce_section.
13852         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13853         value to zero when section is discarded.
13854         (Sized_relobj::map_to_kept_section): New function.
13855         * object.h (Relobj::output_section_address): New function.
13856         (Relobj::Comdat_group): New type.
13857         (Relobj::find_comdat_group): New function.
13858         (Relobj::Comdat_group_table): New type.
13859         (Relobj::Kept_comdat_section): New type.
13860         (Relobj::Kept_comdat_section_table): New type.
13861         (Relobj::add_comdat_group): New function.
13862         (Relobj::set_kept_comdat_section): New function.
13863         (Relobj::get_kept_comdat_section): New function.
13864         (Relobj::comdat_groups_): New field.
13865         (Relobj::kept_comdat_sections_): New field.
13866         (Symbol_value::input_value): Update comment.
13867         (Sized_relobj::map_to_kept_section) New function.
13868         (Sized_relobj::include_linkonce_section): Add new parameter.
13869         * target-reloc.h (Comdat_behavior): New type.
13870         (get_comdat_behavior): New function.
13871         (relocate_section): Add code to map a discarded section to the
13872         corresponding kept section when applying a relocation.
13873
13874 2008-04-30  Craig Silverstein  <csilvers@google.com>
13875
13876         * dwarf_reader.cc (next_generation_count): New static var.
13877         (Addr2line_cache_entry): New struct.
13878         (addr2line_cache): New static var.
13879         (Dwarf_line_info::one_addr2line): Added caching.
13880         (Dwarf_line_info::clear_addr2line_cache): New function.
13881         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13882         cache-size parameter.
13883         (Dwarf_line_info::one_addr2line_cache): New function.
13884         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13885         new cache-size argument to one_addr2line(), and clear cache.
13886
13887 2008-04-28  Cary Coutant  <ccoutant@google.com>
13888
13889         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13890         R_386_PC8 relocations.
13891
13892 2008-04-23  Ian Lance Taylor  <iant@google.com>
13893
13894         * object.cc (Sized_relobj::include_section_group): Check for
13895         invalid section group.
13896
13897         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13898         header size.
13899
13900         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13901         than read for file header.
13902         * archive.cc (Archive::include_member): Likewise.
13903
13904 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13905
13906         * aclocal.m4: Regenerate.
13907         * configure: Regenerate.
13908
13909 2008-04-19  Ian Lance Taylor  <iant@google.com>
13910
13911         * version.cc (version_string): Bump to 1.6.
13912
13913         * testsuite/Makefile.am (many_sections_r_test): New target.
13914         (many_sections_r_test_SOURCES): Remove.
13915         (many_sections_r_test_DEPENDENCIES): Remove.
13916         (many_sections_r_test_LDFLAGS): Remove.
13917         (many_sections_r_test_LDADD): Remove.
13918
13919         * object.cc (Sized_relobj::do_add_symbols): Always pass
13920         local_symbol_count_ to add_from_relobj.
13921
13922         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13923         every thousand variables.
13924         * testsuite/Makefile.in: Rebuild.
13925
13926         * object.cc (Xindex::initialize_symtab_xindex): New function.
13927         (Xindex::read_symtab_xindex): New function.
13928         (Xindex::sym_xindex_to_shndx): New function.
13929         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13930         available.
13931         (Sized_relobj::do_initialize_xindex): New function.
13932         (Sized_relobj::do_read_symbols): Adjust section links.
13933         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13934         parameter.  Change all callers.
13935         (Sized_relobj::include_section_group): Adjust section links and
13936         symbol section indexes.
13937         (Sized_relobj::do_layout): Adjust section links.
13938         (Sized_relobj::do_count_local_symbols): Adjust section links and
13939         symbol section indexes.
13940         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13941         ordinary and special symbols.
13942         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13943         dynsym_xindex parameters.  Change all callers.  Adjust section
13944         links.  Use SHN_XINDEX when needed.
13945         (Sized_relobj::get_symbol_location_info): Adjust section links.
13946         Don't get fooled by special symbols.
13947         * object.h (class Xindex): Define.
13948         (class Object): Add xindex_ parameter.  Declare virtual functoin
13949         do_initialize_xindex.
13950         (Object::adjust_sym_shndx): New function.
13951         (Object::set_xindex): New protected function.
13952         (class Symbol_value): Add is_ordinary_shndx_ field.
13953         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13954         (Symbol_value::value): Assert ordinary section.
13955         (Symbol_value::initialize_input_to_output_map): Likewise.
13956         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13957         Change all callers.
13958         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13959         all callers.
13960         (class Sized_relobj): Update declarations.
13961         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13962         parameter.  Change all callers.
13963         (Sized_relobj::adjust_shndx): New function.
13964         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13965         field.
13966         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13967         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13968         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13969         (Sized_dynobj::read_dynsym_section): Adjust section links.
13970         (Sized_dynobj::read_dynamic): Likewise.
13971         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13972         section links.
13973         (Sized_dynobj::do_initialize_xindex): New function.
13974         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13975         do_initialize_xindex.
13976         (Sized_dynobj::adjust_shndx): New function.
13977         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13978         dynsym_xindex_ fields.
13979         (Layout::finalize): Add a call to set_section_indexes before
13980         creating the symtab sections.
13981         (Layout::set_section_indexes): Don't do anything if the section
13982         already has a section index.
13983         (Layout::create_symtab_sections): Add shnum parameter.  Change
13984         caller.  Create .symtab_shndx section if needed.
13985         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13986         caller.
13987         (Layout::allocated_output_section_count): New function.
13988         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13989         needed.
13990         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13991         fields.  Update declarations.
13992         (Layout::symtab_xindex): New function.
13993         (Layout::dynsym_xindex): New function.
13994         (class Write_symbols_task): Add layout_ field.
13995         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13996         Change caller.
13997         * output.cc (Output_section_headers::Output_section_headers): Add
13998         shstrtab_section parameter.  Change all callers.
13999         (Output_section_headers::do_sized_write): Store overflow values
14000         for section count and section string table section index in
14001         section header zero.
14002         (Output_file_header::do_sized_write): Check for overflow of
14003         section count and section string table section index.
14004         (Output_symtab_xindex::do_write): New function.
14005         (Output_symtab_xindex::endian_do_write): New function.
14006         * output.h (class Output_section_headers): Add shstrtab_section_.
14007         Update declarations.
14008         (class Output_symtab_xindex): Define.
14009         (Output_section::has_out_shndx): New function.
14010         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14011         field.
14012         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14013         Change all callers.
14014         (Sized_symbol::init): Likewise.
14015         (Symbol::output_section): Check for ordinary symbol.
14016         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14017         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14018         callers.
14019         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14020         Change all callers.  Simplify handling of symbols from sections
14021         not included in the link.
14022         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14023         distinction.
14024         (Weak_alias_sorter::operator()): Assert that symbols are
14025         ordinary.
14026         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14027         distinction.
14028         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14029         parameters.  Change all callers.
14030         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14031         symbol distinction.  Use SHN_XINDEX when needed.
14032         (Symbol_table::write_section_symbol): Add symtab_xindex
14033         parameter.  Change all callers.
14034         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14035         SHN_XINDEX when needed.
14036         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14037         declarations.
14038         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14039         (Symbol::is_defined): Check is_ordinary.
14040         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14041         (Symbol::is_absolute, Symbol::is_common): Likewise.
14042         (class Sized_symbol): Update declarations.
14043         (class Symbol_table): Update declarations.
14044         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14045         parameters.  Change all callers.
14046         (Sized_symbol::override): Likewise.
14047         (Symbol_table::override): Likewise.
14048         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14049         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14050         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14051         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14052         to be in an ordinary section.
14053         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14054         object and is_ordinary parameters.  Change all callers.
14055         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14056         Change all callers.  Don't add undefined or non-ordinary symbols
14057         to reloc_map_.
14058         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14059         Change all callers.
14060         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14061         declarations.
14062         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14063         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14064         (Sized_relobj::relocate_sections): Likewise.
14065         * target-reloc.h (scan_relocs): Adjust section symbol index.
14066         (scan_relocatable_relocs): Likewise.
14067         * i386.cc (Scan::local): Check for ordinary symbols.
14068         * sparc.cc (Scan::local): Likewise.
14069         * x86_64.cc (Scan::local): Likewise.
14070         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14071         to symbol_section_and_value.
14072         * testsuite/many_sections_test.cc: New file.
14073         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14074         (check_PROGRAMS): Add many_sections_test.
14075         (many_sections_test_SOURCES): Define.
14076         (many_sections_test_DEPENDENCIES): Define.
14077         (many_sections_test_LDFLAGS): Define.
14078         (BUILT_SOURCES): Add many_sections_define.h.
14079         (many_sections_define.h): New target.
14080         (BUILT_SOURCES): Add many_sections_check.h.
14081         (many_sections_check.h): New target.
14082         (check_PROGRAMS): Add many_sections_r_test.
14083         (many_sections_r_test_SOURCES): Define.
14084         (many_sections_r_test_DEPENDENCIES): Define.
14085         (many_sections_r_test_LDFLAGS): Define.
14086         (many_sections_r_test_LDADD): Define.
14087         (many_sections_r_test.o): New target.
14088         * testsuite/Makefile.in: Rebuild.
14089
14090 2008-04-17  Cary Coutant  <ccoutant@google.com>
14091
14092         * errors.cc (Errors::info): New function.
14093         (gold_info): New function.
14094         * errors.h (Errors::info): New function.
14095         * gold.h (gold_info): New function.
14096         * object.cc (Input_objects::add_object): Print trace output.
14097         * options.cc (options::parse_set): New function.
14098         (General_options::parse_wrap): Deleted.
14099         (General_options::General_options): Deleted initializer.
14100         * options.h (options::String_set): New typedef.
14101         (options::parse_set): New function.
14102         (DEFINE_set): New macro.
14103         (General_options::wrap): Changed to use DEFINE_set. Changed
14104         callers of any_wrap_symbols and is_wrap_symbol.
14105         (General_options::trace, General_options::trace_symbol):
14106         New options.
14107         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14108         (General_options::wrap_symbols_): Deleted.
14109         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14110
14111 2008-04-17  David S. Miller  <davem@davemloft.net>
14112
14113         * options.cc (General_options::parse_V): New function.
14114         * options.h: Add entries for -V and -Qy.
14115
14116 2008-04-17  Ian Lance Taylor  <iant@google.com>
14117
14118         * common.cc (Symbol_table::allocate_commons): Remove options
14119         parameter.  Change caller.
14120         (Symbol_table::do_allocate_commons): Remove options parameter.
14121         Change caller.  Just call do_allocate_commons_list twice.
14122         (Symbol_table::do_allocate_commons_list): New function, broken out
14123         of do_allocate_commons.
14124         * common.h (class Allocate_commons_task): Remove options_ field.
14125         Update constructor.
14126         * symtab.cc (Symbol_table::Symbol_table): Initialize
14127         tls_commons_.
14128         (Symbol_table::add_from_object): Put TLS common symbols on
14129         tls_commons_ list.
14130         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14131         which are IN_OUTPUT_DATA.
14132         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14133         allocate_commons and do_allocate_commons declarations.  Declare
14134         do_allocate_commons_list.
14135         * gold.cc (queue_middle_tasks): Update creation of
14136         Allocate_commons_task to not pass options.
14137         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14138         (TLS_TEST_C_FLAGS): New variable.
14139         (tls_test_c_pic.o): New target.
14140         (tls_test_shared.so): Link in tls_test_c_pic.o.
14141         (tls_test_c_pic_ie.o): New target.
14142         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14143         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14144         (tls_test_c.o): New target.
14145         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14146         (tls_pic_test_LDADD): Likewise.
14147         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14148         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14149         (tls_test_c_gnu2.o): New target.
14150         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14151         tls_test_c_gnu2.o.
14152         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14153         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14154         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14155         * testsuite/tls_test.cc: Include "config.h".
14156         (t_last): Call t11_last.
14157         * testsuite/tls_test.h (t11, t11_last): Declare.
14158         * testsuite/tls_test_c.c: New file.
14159         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14160         * configure.ac: Check for OpenMP support.
14161         * configure, config.in, Makefile.in: Rebuild.
14162         * testsuite/Makefile.in: Rebuild.
14163
14164 2008-04-16  Cary Coutant  <ccoutant@google.com>
14165
14166         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14167         (Target_i386::tls_base_symbol_defined_): New field.
14168         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14169         (Target_i386::Scan::global): Likewise.
14170         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14171         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14172         (Target_x86_64::tls_base_symbol_defined_): New field.
14173         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14174         (Target_x86_64::Scan::global): Likewise.
14175
14176 2008-04-16  Cary Coutant  <ccoutant@google.com>
14177
14178         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14179         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14180         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14181         building shared libraries.
14182         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14183         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14184         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14185         * testsuite/Makefile.in: Rebuild.
14186         * testsuite/weak_undef.h: New file.
14187         * testsuite/weak_undef_file1.cc: Add extra test cases.
14188         * testsuite/weak_undef_file2.cc: Likewise.
14189         * testsuite/weak_undef_test.cc: Likewise.
14190
14191 2008-04-16  David S. Miller  <davem@davemloft.net>
14192
14193         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14194         Add issued_non_pic_error_ field.  Declare check_non_pic.
14195         (Target_sparc::Scan::check_non_pic): New function.
14196         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14197         (Target_sparc::Scan::global): Likewise.
14198
14199         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14200         * configure: Rebuild.
14201
14202         * options.h (DEFINE_enable): New macro.
14203         (new_dtags): New enable option.
14204         (initfirst, interpose, loadfltr, nodefaultlib,
14205         nodelete, nodlopen, nodump): New -z options.
14206         * layout.cc (Layout:finish_dynamic_section): If new
14207         dtags enabled, emit DT_RUNPATH.  Also, emit a
14208         DT_FLAGS_1 containing any specified -z flags.
14209
14210 2008-04-16  Ian Lance Taylor  <iant@google.com>
14211
14212         * copy-relocs.cc: New file.
14213         * copy-relocs.h: New file.
14214         * reloc.cc: Remove Copy_relocs code.
14215         * reloc.h: Likewise.
14216         * reloc-types.h (struct Reloc_types) [both versions]: Add
14217         get_reloc_addend_noerror.
14218         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14219         variants of add_global which take an addend which must be zero.
14220         * i386.cc: Include "copy-relocs.h".
14221         (class Target_i386): Change type of copy_relocs_ to variable,
14222         update initializer.
14223         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14224         Change all callers.
14225         (Target_i386::do_finalize_sections): Change handling of
14226         copy_relocs_.
14227         * sparc.cc: Include "copy-relocs.h".
14228         (class Target_sparc): Change type of copy_relocs_ to variable,
14229         update initializer.
14230         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14231         Change all callers.
14232         (Target_sparc::do_finalize_sections): Change handling of
14233         copy_relocs_.
14234         * x86_64.cc: Include "copy-relocs.h".
14235         (class Target_x86_64): Change type of copy_relocs_ to variable,
14236         update initializer.
14237         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14238         class.  Change all callers.
14239         (Target_x86_64::do_finalize_sections): Change handling of
14240         copy_relocs_.
14241         * Makefile.am (CCFILES): Add copy-relocs.cc.
14242         (HFILES): Add copy-relocs.h.
14243
14244         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14245
14246         * testsuite/script_test_4.sh: Permit leading zeroes.
14247
14248 2008-04-15  Ian Lance Taylor  <iant@google.com>
14249
14250         * script-sections.cc (Script_sections::create_segments): Use
14251         header_size_adjustment even when there is enough room for the
14252         headers.
14253         * testsuite/script_test_4.sh: New file.
14254         * testsuite/script_test_4.t: New file.
14255         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14256         (check_DATA): Add script_test_4.stdout.
14257         (MOSTLYCLEANFILES): Likewise.
14258         (script_test_4): New target.
14259         (script_test_4.stdout): New target.
14260         * testsuite/Makefile.in: Rebuild.
14261
14262         * sparc.cc: Add definitions for Output_data_plt_sparc class
14263         constants.
14264
14265 2008-04-14  David S. Miller  <davem@davemloft.net>
14266
14267         * sparc.cc: New file.
14268         * Makefile.am (TARGETSOURCES): Add sparc.cc
14269         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14270         * configure.tgt: Document targ_extra_size and
14271         targ_extra_big_endian.  Add entries for sparc-* and
14272         sparc64-*.
14273         * configure.ac: Handle targ_extra_size and
14274         targ_extra_big_endian.
14275         * Makefile.in: Rebuild.
14276         * configure: Likewise.
14277         * po/POTFILES.in: Likewise.
14278         * po/gold.pot: Likewise.
14279
14280 2008-04-14  Ian Lance Taylor  <iant@google.com>
14281
14282         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14283         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14284         in the name/type/flags to section mapping.  Don't call
14285         allocate_output_section.
14286         (Layout::choose_output_section): Change parameter from adjust_name
14287         to is_input_section.  Don't permit input sections after sections
14288         are attached to segments.  Don't call allocate_output_section.
14289         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14290         not write_enable_output_section.
14291         (Layout::make_output_section): Don't push to
14292         unattached_section_list_ nor call attach_to_segment.  Call
14293         attach_section_to_segment if sections are attached.
14294         (Layout::attach_sections_to_segments): New function.
14295         (Layout::attach_section_to_segment): New function.
14296         (Layout::attach_allocated_section_to_segment): Rename from
14297         attach_to_segment.  Remove flags parameter.
14298         (Layout::allocate_output_section): Remove function.
14299         (Layout::write_enable_output_section): Remove function.
14300         * layout.h (class Layout): Update for above changes.  Add new
14301         field sections_are_attached_.
14302         * output.h (Output_section::update_flags_for_input_section): New
14303         function.
14304         * output.cc (Output_section::add_input_section): Call
14305         update_flags_for_input_section.
14306         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14307
14308 2008-04-11  Cary Coutant  <ccoutant@google.com>
14309
14310         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14311         thought unnecessary.
14312         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14313
14314 2008-04-11  Ian Lance Taylor  <iant@google.com>
14315
14316         * output.h (class Output_section_data): Remove inline definition
14317         of set_addralign.
14318         * output.cc (Output_section_data::set_addralign): New function.
14319
14320 2008-04-11  Cary Coutant  <ccoutant@google.com>
14321
14322         Add support for TLS descriptors for i386 and x86_64.
14323         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14324         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14325         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14326         GOT_TYPE_TLS_DESC.
14327         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14328         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14329         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14330         relocations.
14331         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14332         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14333         Fix problem with initial-exec relocations.
14334         (Target_i386::Relocate::relocate_tls): Likewise.
14335         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14336         relaxation.
14337         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14338         support for section-plus-offset dynamic table entries.
14339         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14340         (Output_data_dynamic::Dynamic_entry): Add support for
14341         section-plus-offset dynamic table entries.
14342         (Output_data_dynamic::Classification): Likewise.
14343         (Output_data_dynamic::classification_): Renamed offset_.
14344         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14345         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14346         (Target_x86_64::make_plt_section): New function.
14347         (Target_x86_64::reserve_tlsdesc_entries): New function.
14348         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14349         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14350         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14351         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14352         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14353         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14354         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14355         add extra PLT entry for TLS descriptors.
14356         (Output_data_plt_x86_64::got_): New field.
14357         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14358         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14359         fields.
14360         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14361         descriptors.
14362         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14363         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14364         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14365         R_386_TLS_DESC_CALL relocations.
14366         (Target_x86_64::Scan::global): Likewise.
14367         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14368         for TLS descriptors.
14369         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14370         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14371         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14372         GD-to-IE relaxation.
14373         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14374         and TLS_DESCRIPTORS.
14375         * Makefile.in: Rebuild.
14376         * configure: Rebuild.
14377         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14378         (tls_test_shared2.so): New target.
14379         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14380         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14381         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14382         (tls_shared_gd_to_ie_test_LDADD): New variable.
14383         (tls_shared_gnu2_gd_to_ie_test): New target.
14384         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14385         New targets.
14386         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14387         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14388         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14389         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14390         (tls_shared_gnu2_test): New target.
14391         (tls_test_gnu2_shared.so): New target.
14392         (tls_shared_gnu2_test_SOURCES): New variable.
14393         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14394         (tls_shared_gnu2_test_LDFLAGS): New variable.
14395         (tls_shared_gnu2_test_LDADD): New variable.
14396         * testsuite/Makefile.in: Rebuild.
14397         * testsuite/Makefile.
14398
14399 2008-04-11  Ian Lance Taylor  <iant@google.com>
14400
14401         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14402         justsyms.t.
14403         * testsuite/Makefile.in: Rebuild.
14404
14405         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14406         long.
14407         * testsuite/script_test_2.cc (main): Adjust test.
14408
14409 2008-04-11  David S. Miller  <davem@davemloft.net>
14410             Ian Lance Taylor  <iant@google.com>
14411
14412         * options.h (General_options): Add entries for '-Y' and
14413         '-relax'.
14414         * options.cc (General_options:finalize): If -Y was used, add those
14415         entries to the library path instead of the default "/lib" and
14416         "/usr/lib".
14417
14418 2008-04-11  David S. Miller  <davem@davemloft.net>
14419
14420         * testsuite/justsyms.t: Start at 0x100.
14421         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14422         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14423         long.
14424         * testsuite/script_test_2.cc: Adjust string and section length
14425         checks.
14426
14427 2008-04-09  Ian Lance Taylor  <iant@google.com>
14428
14429         PR gold/5996
14430         * script-sections.cc (Sections_element::allocate_to_segment): Add
14431         orphan parameter.
14432         (Output_section_definition::allocate_to_segment): Likewise.
14433         (Orphan_output_section::allocate_to_segment): Likewise.
14434         (Script_sections::attach_sections_using_phdrs_clause): Don't
14435         propagate non-PT_LOAD segments to orphan sections.
14436         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14437         readelf rather than objdump.
14438         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14439         .interp section and PT_INTERP segment are the same size.
14440         * testsuite/Makefile.in: Rebuild.
14441
14442         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14443         aliases for symbols defined in the same object.
14444         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14445         (weak_alias_test_SOURCES): New variable.
14446         (weak_alias_test_DEPENDENCIES): New variable.
14447         (weak_alias_test_LDFLAGS): New variable.
14448         (weak_alias_test_LDADD): New variable.
14449         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14450         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14451         (weak_alias_test_3.o): New target.
14452         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14453         * testsuite/weak_alias_test_main.cc: New file.
14454         * testsuite/weak_alias_test_1.cc: New file.
14455         * testsuite/weak_alias_test_2.cc: New file.
14456         * testsuite/weak_alias_test_3.cc: New file.
14457
14458 2008-04-08  Ian Lance Taylor  <iant@google.com>
14459
14460         * options.h (class General_options): Add --noinhibit-exec option.
14461         * main.cc (main): Check --noinhibit-exec.
14462
14463         * options.h (class General_options): Define --wrap as a special
14464         option.  Add wrap_symbols_ field.
14465         (General_options::any_wrap_symbols): New function.
14466         (General_options::is_wrap_symbol): New function.
14467         * options.cc (General_options::parse_wrap): New function.
14468         (General_options::General_options): Initialize wrap_symbols_.
14469         * symtab.cc (Symbol_table::wrap_symbol): New function.
14470         (Symbol_table::add_from_object): Handle --wrap.
14471         * symtab.h (class Symbol_table): Declare wrap_symbol.
14472         * target.h (Target::wrap_char): New function.
14473         (Target::Target_info): Add wrap_char field.
14474         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14475         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14476         * testsuite/testfile.cc (Target_test::test_target_info):
14477         Likewise.
14478
14479         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14480         there is one.
14481
14482         * layout.h (class Layout): Add added_eh_frame_data_ field.
14483         * layout.cc (Layout::Layout): Initialize new field.
14484         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14485         output section until we find a section we merged successfully.
14486         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14487         that the size be non-zero.
14488
14489         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14490         qualifier.
14491
14492 2008-04-08  Craig Silverstein  <csilvers@google.com>
14493
14494         * configure.ac: Export new conditional variable HAVE_ZLIB.
14495         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14496         on HAVE_ZLIB.
14497         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14498         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14499
14500 2008-04-07  Ian Lance Taylor  <iant@google.com>
14501
14502         * version.cc (version_string): Set to "1.5".
14503
14504         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14505         Add issued_non_pic_error_ field.  Declare check_non_pic.
14506         (Target_x86_64::Scan::check_non_pic): New function.
14507         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14508         (Target_x86_64::Scan::global): Likewise.
14509
14510         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14511         addend parameter.  Change caller.  Handle merge sections.
14512         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14513         Address to Addend.  Don't add in the result of
14514         local_section_offset, pass down the addend and use the returned
14515         value.
14516         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14517         Update declarations of local_section_offset and symbol_value.
14518         * testsuite/two_file_test_1.cc (t18): New function.
14519         * testsuite/two_file_test_2.cc (f18): New function.
14520         * testsuite/two_file_test_main.cc (main): Call t18.
14521         * testsuite/two_file_test.h (t18, f18): Declare.
14522
14523         * configure.ac: Don't test for objdump, c++filt, or readelf.
14524         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14525         conditionals.
14526         (TEST_READELF): New variable.
14527         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14528         (check_PROGRAMS): Add two_file_strip_test.
14529         (two_file_strip_test): New target.
14530         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14531         (two_file_same_shared_strip_test_SOURCES): New variable.
14532         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14533         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14534         (two_file_same_shared_strip_test_LDADD): New variable.
14535         (two_file_shared_strip.so): New target.
14536         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14537         (ver_test_5.syms, ver_test_7.syms): Likewise.
14538         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14539         (strip_test_3.stdout): Use TEST_OBJDUMP.
14540         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14541
14542 2008-04-04  Cary Coutant  <ccoutant@google.com>
14543
14544         * symtab.h (Symbol::is_weak_undefined): New function.
14545         (Symbol::is_strong_undefined): New function.
14546         (Symbol::is_absolute): New function.
14547         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14548         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14549         absolute symbols.
14550         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14551         (weak_undef_test): New target.
14552         * testsuite/Makefile.in: Rebuild.
14553         * testsuite/weak_undef_file1.cc: New file.
14554         * testsuite/weak_undef_file2.cc: New file.
14555         * testsuite/weak_undef_test.cc: New file.
14556
14557 2008-04-03  Craig Silverstein  <csilvers@google.com>
14558
14559         * compressed_output.h (class Output_compressed_section): Use
14560         unsigned buffer.
14561         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14562         add zlib header.
14563         (zlib_compressed_suffix): Removed.
14564         (Output_compressed_section::set_final_data_size): Use unsigned
14565         buffers.
14566         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14567         Fix linker invocation.
14568         (flagstest_o_specialfile_and_compress_debug_sections):
14569         Likewise.
14570         * testsuite/Makefile.in: Regenerated.
14571
14572 2008-04-02  David S. Miller  <davem@davemloft.net>
14573
14574         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14575         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14576
14577 2008-04-02  Craig Silverstein  <csilvers@google.com>
14578
14579         * TODO: New file.
14580
14581 2008-04-02  Ian Lance Taylor  <iant@google.com>
14582
14583         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14584         parameters.  Update for new key type to views_.  Change all
14585         callers.
14586         (File_read::read): Adjust for byteshift in returned view.
14587         (File_read::add_view): New function, broken out of
14588         find_and_make_view.
14589         (File_read::make_view): New function, broken out of
14590         find_and_make_view.
14591         (File_read::find_or_make_view): Add offset and aligned
14592         parameters.  Rewrite accordingly.  Change all callers.
14593         (File_read::get_view): Add offset and aligned parameters.  Adjust
14594         for byteshift in return value.
14595         (File_read::get_lasting_view): Likewise.
14596         * fileread.h (class File_read): Update declarations.
14597         (class File_read::View): Add byteshift_ field.  Add byteshift to
14598         constructor.  Add byteshift method.
14599         * archive.h (Archive::clear_uncached_views): New function.
14600         (Archive::get_view): Add aligned parameter.  Change all callers.
14601         * object.h (Object::get_view): Add aligned parameter.  Change all
14602         callers.
14603         (Object::get_lasting_view): Likewise.
14604
14605         * fileread.cc (File_read::release): Don't call clear_views if
14606         there are multiple objects.
14607         * fileread.h (File_read::clear_uncached_views): New function.
14608         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14609         on the archive.
14610
14611 2008-03-31  Cary Coutant  <ccoutant@google.com>
14612
14613         Add thin archive support.
14614         * archive.cc (Archive::armagt): New const.
14615         (Archive::setup): Remove task parameter and calls to unlock.
14616         (Archive::unlock_nested_archives): New function.
14617         (Archive::read_header): Add nested_off parameter. Change
14618         all callers.
14619         (Archive::interpret_header): Likewise.
14620         (Archive::include_all_members): Change to handle thin
14621         archives.
14622         (Archive::include_member): Likewise.
14623         * archive.h (Archive::Archive): Add new parameters and
14624         initializers.
14625         (Archive::armagt): New const.
14626         (Archive::setup): Remove task parameter.
14627         (Archive::unlock_nested_archives): New function.
14628         (Archive::read_header): Add nested_off parameter.
14629         (Archive::interpret_header): Likewise.
14630         (Archive::Nested_archive_table): New typedef.
14631         (Archive::is_thin_archive_): New field.
14632         (Archive::nested_archives_): New field.
14633         (Archive::options_): New field.
14634         (Archive::dirpath_): New field.
14635         (Archive::task_): New field.
14636         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14637         for thin archives.  Pass additional parameters to
14638         Archive::Archive.  Unlock the archive file after calling
14639         Archive::setup.
14640
14641 2008-03-29  Ian Lance Taylor  <iant@google.com>
14642
14643         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14644         version symbol to be local.
14645         * testsuite/ver_test_4.sh: New file.
14646         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14647         (check_DATA): Add ver_test_4.syms.
14648         (ver_test_4.syms): New target.
14649         * testsuite/Makefile.in: Rebuild.
14650
14651         * output.cc
14652         (Output_section::Input_section_sort_entry::has_priority): New
14653         function.
14654         (Output_section::Input_section_sort_entry::match_file_name): New
14655         function.
14656         (Output_section::Input_section_sort_entry::match_section_name):
14657         Remove.
14658         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14659         Remove.
14660         (Output_section::Input_section_sort_entry::match_section_file):
14661         Remove.
14662         (Output_section::Input_section_sort_compare::operator()): Rewrite
14663         using new Input_section_sort_entry functions.  Sort crtbegin and
14664         crtend first.  Sort sections with no priority before sections with
14665         a priority.
14666         * testsuite/initpri1.c (d3): Check j != 4.
14667         (cd5): New constructor/destructor function.
14668         (main): Check j != 2.
14669
14670         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14671         new symbol when resolving, don't call set_is_default.
14672         * testsuite/ver_test_7.cc: New file.
14673         * testsuite/ver_test_7.sh: New file.
14674         * testsuite/Makefile.am (ver_test_7.so): New target.
14675         (ver_test_7.o): New target.
14676         (check_SCRIPTS): Add ver_test_7.sh.
14677         (check_DATA): Add ver_test_7.syms.
14678         (ver_test_7.syms): New target.
14679
14680 2008-03-28  Ian Lance Taylor  <iant@google.com>
14681
14682         * layout.cc (Layout::layout): If we see an input section with a
14683         name that needs sorting, set the must_sort flag for the output
14684         section.
14685         (Layout::make_output_section): If the name of the output section
14686         indicates that it might require sorting, set the may_sort flag.
14687         * output.h (Output_section::may_sort_attached_input_sections): New
14688         function.
14689         (Output_section::set_may_sort_attached_input_sections): New
14690         function.
14691         (Output_section::must_sort_attached_input_sections): New
14692         function.
14693         (Output_section::set_must_sort_attached_input_sections): New
14694         function.
14695         (class Output_section): Declare Input_section_sort_entry.  Define
14696         Input_section_sort_compare.  Declare
14697         sort_attached_input_sections.  Add new fields:
14698         may_sort_attached_input_sections_,
14699         must_sort_attached_input_sections_,
14700         attached_input_sections_are_sorted_.
14701         * output.cc (Output_section::Output_section): Initialize new
14702         fields.
14703         (Output_section::add_input_section): Add an entry to
14704         input_sections_ if may_sort or must_sort are true.
14705         (Output_section::set_final_data_size): Call
14706         sort_attached_input_sections if necessary.
14707         (Output_section::Input_section_sort_entry): Define new class.
14708         (Output_section::Input_section_sort_compare::operator()): New
14709         function.
14710         (Output_section::sort_attached_input_sections): New function.
14711         * configure.ac: Check whether the compiler supports constructor
14712         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14713         * testsuite/initpri1.c: New file.
14714         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14715         CONSTRUCTOR_PRIORITY.
14716         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14717         (initpri1_LDFLAGS): New variable.
14718         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14719
14720 2008-03-27  Ian Lance Taylor  <iant@google.com>
14721
14722         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14723         * testsuite/common_test_1.c: New file.
14724         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14725         (common_test_1_SOURCES): New variable.
14726         (common_test_1_DEPENDENCIES): New variable.
14727         (common_test_1_LDFLAGS): New variable.
14728
14729         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14730         and commons_ correctly when NAME/VERSION does not override
14731         NAME/NULL.
14732         * testsuite/ver_test_6.c: New file.
14733         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14734         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14735         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14736
14737 2008-03-26  Ian Lance Taylor  <iant@google.com>
14738
14739         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14740         of an undefined symbol from a version script.
14741         * testsuite/Makefile.am (ver_test_5.so): New target.
14742         (ver_test_5.o): New target.
14743         (check_SCRIPTS): Add ver_test_5.sh.
14744         (check_DATA): Add ver_test_5.syms.
14745         (ver_test_5.syms): New target.
14746         * testsuite/ver_test_5.cc: New file.
14747         * testsuite/ver_test_5.script: New file.
14748         * testsuite/ver_test_5.sh: New file.
14749         * Makefile.in, testsuite/Makefile.in: Rebuild.
14750
14751         PR gold/5986
14752         Fix problems building gold with gcc 4.3.0.
14753         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14754         (gold_error_at_location, gold_warning_at_location): Use it.
14755         * configure.ac: Check whether we can compile and use a template
14756         function with a printf attribute.
14757         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14758         when jumping over bytes.
14759         * object.cc: Instantiate Object::read_section_data.
14760         * debug.h: Include <cstring>
14761         * dwarf_reader.cc: Include <algorithm>
14762         * main.cc: Include <cstring>.
14763         * options.cc: Include <cstring>.
14764         * output.cc: Include <cstring>.
14765         * script.cc: Include <cstring>.
14766         * script.h: Include <string>.
14767         * symtab.cc: Include <cstring> and <algorithm>.
14768         * target-select.cc: Include <cstring>.
14769         * version.cc: Include <string>.
14770         * testsuite/testmain.cc: Include <cstdlib>.
14771         * configure, config.in: Rebuild.
14772
14773 2008-03-25  Ian Lance Taylor  <iant@google.com>
14774
14775         * options.cc: Include "../bfd/bfdver.h".
14776         (options::help): Print bug reporting address.
14777
14778         * version.cc (print_version): Adjust output for current value of
14779         BFD_VERSION_STRING.
14780
14781         * NEWS: New file.
14782
14783         * options.cc (options::help): Print list of supported targets.
14784         * target-select.h: Include <vector>.
14785         (class Target_selector): Make machine_, size_, and is_big_endian_
14786         fields const.  Add bfd_name_ and instantiated_target_ fields.
14787         (Target_selector::Target_selector): Add bfd_name parameter.
14788         (Target_selector::recognize): Make non-virtual, call
14789         do_recognize.
14790         (Target_selector::recognize_by_name): Make non-virtual, call
14791         do_recognize_by_name.
14792         (Target_selector::supported_names): New function.
14793         (Target_selector::bfd_name): New function.
14794         (Target_selector::do_instantiate_target): New pure virtual
14795         function.
14796         (Target_selector::do_recognize): New virtual function.
14797         (Target_selector::do_recognize_by_name): New virtual function.
14798         (Target_selector::instantiate_target): New private function.
14799         (supported_target_names): Declare.
14800         * target-select.cc (Target_selector::Target_selector): Update for
14801         new parameter and fields.
14802         (select_target_by_name): Check that the name matches before
14803         calling recognize_by_name.
14804         (supported_target_names): New function.
14805         * i386.cc (class Target_selector_i386): Update Target_selector
14806         constructor call.  Remove recognize and recognize_by_name.  Add
14807         do_instantiate_target.
14808         * x86_64.cc (class Target_selector_x86_64): Likewise.
14809         * testsuite/testfile.cc (class Target_selector_test): Update for
14810         changes to Target_selector.
14811
14812         * README: Rewrite, with some notes on unsupported features.
14813
14814 2008-03-24  Cary Coutant  <ccoutant@google.com>
14815
14816         * i386.cc (Target_i386::Got_type): New enum declaration.
14817         (Target_i386::Scan::local): Updated callers of Output_data_got
14818         member functions.
14819         (Target_i386::Scan::global): Likewise.
14820         (Target_i386::Relocate::relocate): Likewise.
14821         (Target_i386::Relocate::relocate_tls): Likewise.
14822         * object.h (Got_offset_list): New class.
14823         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14824         (Sized_relobj::local_got_offset): Likewise.
14825         (Sized_relobj::set_local_got_offset): Likewise.
14826         (Sized_relobj::local_has_tls_got_offset): Removed.
14827         (Sized_relobj::local_tls_got_offset): Removed.
14828         (Sized_relobj::set_local_tls_got_offset): Removed.
14829         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14830         * output.cc (Output_data_got::add_global): Added got_type parameter.
14831         (Output_data_got::add_global_with_rel): Likewise.
14832         (Output_data_got::add_global_with_rela): Likewise.
14833         (Output_data_got::add_global_pair_with_rel): New function.
14834         (Output_data_got::add_global_pair_with_rela): New function.
14835         (Output_data_got::add_local): Added got_type parameter.
14836         (Output_data_got::add_local_with_rel): Likewise.
14837         (Output_data_got::add_local_with_rela): Likewise.
14838         (Output_data_got::add_local_pair_with_rel): New function.
14839         (Output_data_got::add_local_pair_with_rela): New function.
14840         (Output_data_got::add_global_tls): Removed.
14841         (Output_data_got::add_global_tls_with_rel): Removed.
14842         (Output_data_got::add_global_tls_with_rela): Removed.
14843         (Output_data_got::add_local_tls): Removed.
14844         (Output_data_got::add_local_tls_with_rel): Removed.
14845         (Output_data_got::add_local_tls_with_rela): Removed.
14846         * output.h (Output_data_got::add_global): Added got_type parameter.
14847         (Output_data_got::add_global_with_rel): Likewise.
14848         (Output_data_got::add_global_with_rela): Likewise.
14849         (Output_data_got::add_global_pair_with_rel): New function.
14850         (Output_data_got::add_global_pair_with_rela): New function.
14851         (Output_data_got::add_local): Added got_type parameter.
14852         (Output_data_got::add_local_with_rel): Likewise.
14853         (Output_data_got::add_local_with_rela): Likewise.
14854         (Output_data_got::add_local_pair_with_rel): New function.
14855         (Output_data_got::add_local_pair_with_rela): New function.
14856         (Output_data_got::add_global_tls): Removed.
14857         (Output_data_got::add_global_tls_with_rel): Removed.
14858         (Output_data_got::add_global_tls_with_rela): Removed.
14859         (Output_data_got::add_local_tls): Removed.
14860         (Output_data_got::add_local_tls_with_rel): Removed.
14861         (Output_data_got::add_local_tls_with_rela): Removed.
14862         * resolve.cc (Symbol::override_base_with_special): Removed
14863         reference to has_got_offset_ field.
14864         * symtab.cc (Symbol::init_fields): Replaced initialization
14865         of got_offset_ with got_offsets_.  Removed initialization
14866         of has_got_offset_
14867         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14868         (Symbol::got_offset): Likewise.
14869         (Symbol::set_got_offset): Likewise.
14870         (Symbol::has_tls_got_offset): Removed.
14871         (Symbol::tls_got_offset): Removed.
14872         (Symbol::set_tls_got_offset): Removed.
14873         (Symbol::got_offset_): Removed.
14874         (Symbol::tls_mod_got_offset_): Removed.
14875         (Symbol::tls_pair_got_offset_): Removed.
14876         (Symbol::got_offsets_): New field.
14877         (Symbol::has_got_offset): Removed.
14878         (Symbol::has_tls_mod_got_offset): Removed.
14879         (Symbol::has_tls_pair_got_offset): Removed.
14880         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14881         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14882         member functions.
14883         (Target_x86_64::Scan::global): Likewise.
14884         (Target_x86_64::Relocate::relocate): Likewise.
14885         (Target_x86_64::Relocate::relocate_tls): Likewise.
14886
14887 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14888
14889         * yyscript.y: Fix spelling error in comment.
14890
14891 2008-03-24  Ian Lance Taylor  <iant@google.com>
14892
14893         * options.h (class General_options): Define build_id option.
14894         * layout.h (class Layout): Declare write_build_id, create_note,
14895         create_build_id.  Add build_id_note_ member.
14896         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14897         "libiberty.h", "md5.h", "sha1.h".
14898         (Layout::Layout): Initialize eh_frame_data_,
14899         eh_frame_hdr_section_, and build_id_note_.
14900         (Layout::finalize): Call create_build_id.
14901         (Layout::create_note): New function, broken out of
14902         Layout::create_gold_note.
14903         (Layout::create_gold_note): Call create_note.
14904         (Layout::create_build_id): New function.
14905         (Layout::write_build_id): New function.
14906         (Close_task_runner::run): Call write_build_id.
14907
14908         * x86_64.cc: Correct license to GPLv3.
14909
14910 2008-03-23  Ian Lance Taylor  <iant@google.com>
14911
14912         * options.cc: Include "demangle.h".
14913         (parse_optional_string): New function.
14914         (parse_long_option): Handle takes_optional_argument.
14915         (parse_short_option): Update dash_z initializer.  Handle
14916         takes_optional_argument.
14917         (General_options::General_options): Initialize do_demangle_.
14918         (General_options::finalize): Set do_demangle_.  Handle demangling
14919         style.
14920         * options.h (parse_optional_string): Declare.
14921         (struct One_option): Add optional_arg field.  Update constructor.
14922         Update call constructor calls.  Add takes_optional_argument
14923         function.
14924         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14925         (DEFINE_optional_string): Define.
14926         (General_options::demangle): Change from DEFINE_bool to
14927         DEFINE_optional_string.
14928         (General_options::no_demangle): New function.
14929         (General_options::do_demangle): New function.
14930         (General_options::set_do_demangle): New function.
14931         (General_options::execstack_status_): Move definition to end of
14932         class definition.
14933         (General_options::static_): Likewise.
14934         (General_options::do_demangle_): New field.
14935         * object.cc (big_endian>::get_symbol_location_info): Call
14936         Options::do_demangle, not Options::demangle.
14937         * symtab.cc (demangle): Likewise.
14938
14939 2008-03-22  Ian Lance Taylor  <iant@google.com>
14940
14941         * gold.h: Include <cstddef> and <sys/types.h>
14942         * options.h: Include <cstring>.
14943
14944 2008-03-21  Ian Lance Taylor  <iant@google.com>
14945
14946         * Added source code to GNU binutils.
14947 \f
14948 Copyright (C) 2008-2013 Free Software Foundation, Inc.
14949
14950 Copying and distribution of this file, with or without modification,
14951 are permitted in any medium without royalty provided the copyright
14952 notice and this notice are preserved.
14953
14954 Local Variables:
14955 mode: change-log
14956 left-margin: 8
14957 fill-column: 74
14958 version-control: never
14959 End: