* powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
[platform/upstream/binutils.git] / gold / ChangeLog
1 2013-06-27  Cary Coutant  <ccoutant@google.com>
2
3         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
4         on garbage collected .opd section.
5
6 2013-06-27  Alan Modra  <amodra@gmail.com>
7
8         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
9         is non-zero.
10         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
11         (Target_powerpc::do_function_location): Likewise for loc->shndx.
12
13 2013-06-14  Cary Coutant  <ccoutant@google.com>
14
15         * resolve.cc (Symbol::override_base): Don't override st_type
16         from plugin placeholder symbols.
17         (Symbol_table::resolve): Likewise.
18         (Symbol_table::should_override): Don't complain about TLS mismatch
19         if the TO symbol is a plugin placeholder.
20         * testsuite/Makefile.am (plugin_test_tls): New test.
21         * testsuite/Makefile.in: Regenerate.
22         * testsuite/plugin_test_tls.sh: New test script.
23         * testsuite/two_file_test_2_tls.cc: New test source.
24         * testsuite/two_file_test_tls.cc: New test source.
25
26 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
27
28         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
29         the maximum segment alignment is larger than the page size.
30         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
31         correctly aligns the symbols with large alignemnt.
32         * testsuite/Makefile.in: Regenerate.
33         * testsuite/large_symbol_alignment.cc: New file.
34
35 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
36             Sriraman Tallam  <tmsriram@google.com>
37
38         * options.h (sort_section): New option.
39         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
40         Rename from Input_section_sort_section_name_special_ordering_compare.
41         (Input_section_sort_section_name_compare): New struct.
42         * output.cc (Output_section::Input_section_sort_section_name_compare::
43         operator()): New function.
44         (Output_section::sort_attached_input_sections): Use new sort function
45         for .text if --sort-section=name is specified.
46         * layout.cc (Layout::make_output_section):
47         Add sorting by name when --sort-section=name is specified.
48         * testsuite/Makefile.am (text_section_grouping): Test option
49         --sort-section=name.
50         * testsuite/Makefile.in: Regenerate.
51         * testsuite/section_sorting_name.cc: New file.
52         * testsuite/section_sorting_name.sh: New file.
53
54 2013-05-21  Cary Coutant  <ccoutant@google.com>
55
56         * symtab.h (Symbol::is_cxx_vtable): New function.
57         * target-reloc.h (relocate_section): Check for vtable symbol.
58         * testsuite/Makefile.am (missing_key_func.sh): New test case.
59         * testsuite/Makefile.in: Regenerate.
60         * testsuite/missing_key_func.cc: New test source.
61         * testsuite/missing_key_func.sh: New test script.
62
63 2013-05-21  Cary Coutant  <ccoutant@google.com>
64
65         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
66         type of enclosing symbol.
67         (Relocate_info::location): Check symbol type when describing symbol.
68         * object.h (Symbol_location_info): Remove unused line_number;
69         add enclosing_symbol_type.
70         * testsuite/debug_msg.sh: Adjust expected output.
71
72 2013-05-13  Cary Coutant  <ccoutant@google.com>
73
74         * configure.ac: Export DEFAULT_TARGET.
75         * configure: Regenerate.
76         * Makefile.in: Regenerate.
77         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
78         * testsuite/Makefile.in: Regenerate.
79         * testsuite/debug_msg.sh: Delete duplicate tests.
80         Don't check undef_int error message match for powerpc where the
81         source file and line number aren't available.
82
83 2013-05-10  Roland McGrath  <mcgrathr@google.com>
84
85         * options.h (General_options): Add --rosegment-gap option.
86         * options.cc (finalize): --rosegment-gap implies --rosegment.
87         * layout.cc (set_segment_offsets): Let user option override
88         target->rosegment_gap().
89
90 2013-05-10  Roland McGrath  <mcgrathr@google.com>
91
92         * options.h (General_options): Remove leading space from help
93         messages for -nostdlib and --rosegment.
94
95 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
96
97         PR ld/15365
98         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
99
100 2013-05-03  Alan Modra  <amodra@gmail.com>
101
102         * merge.cc (Output_merge_string::do_add_input_section): Correct
103         scan for number of strings.  Rename vars to avoid shadowing.
104         Include missing terminator in input_size_.
105
106 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
107
108         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
109         Restore empty string handling.
110
111 2013-05-01  Cary Coutant  <ccoutant@google.com>
112
113         * stringpool.cc (Stringpool_template::new_key_offset): Fix
114         uninitialized warning.
115
116 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
117
118         * output.cc (Output_section::add_merge_input_section): Allow
119         to merge sections if the alignment is more than character size.
120         * merge.h (Output_merge_string::Output_merge_string): Remove
121         assert.
122         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
123         only not-null strings. Check the alignment of strings.
124         * stringpool.h
125         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
126         alignment as the argument.
127         (Stringpool_template<Stringpool_char>::addralign_): New class member.
128         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
129         Align non-zero length strings according to the addralign_.
130         (Stringpool_template<Stringpool_char>::set_string_offsets):
131         Updating offsets according to the given alignment.
132         * testsuite/Makefile.am (text_section_grouping): Test if string
133         literals are getting merged.
134         * testsuite/Makefile.in: Regenerate.
135         * testsuite/merge_string_literals_1.c: New file.
136         * testsuite/merge_string_literals_2.c: Ditto.
137         * testsuite/merge_string_literals.sh: Ditto.
138
139 2013-04-26  Ian Lance Taylor  <iant@google.com>
140
141         * target-reloc.h (relocate_section): If the reloc offset is out of
142         range, pass VIEW as NULL to relocate.relocate.
143         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
144         * i386.cc (Target_i386::Relocate::relocate): Likewise.
145         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
146         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
147         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
148         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
149
150 2013-04-26  Geoff Pike  <gpike@chromium.org>
151
152         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
153         * layout.cc (Hash_task): New class.
154         (Layout::queue_build_id_tasks): New function.
155         (Layout::write_build_id): Handle single-thread portion of build ID
156         computation.  (In some cases, all of it is single-threaded.)  Replace
157         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
158         functionality in fewer lines of code.
159         * layout.h (Layout::queue_build_id_tasks): New function declaration.
160         * options.h (General_options): make "--build-id" default to tree
161         rather than sha1.  Add two new options related to --build-id=tree:
162         --build-id-chunk-size-for-treehash and
163         --build-id-min-file-size-for-treehash.
164         * Makefile.am: add testing of --build-id=tree and related new options
165         (these tests will be invoked by "make check").
166         * Makefile.in: Regenerate.
167
168 2013-04-25  Alan Modra  <amodra@gmail.com>
169
170         * configure.tgt: Add powerpcle and powerpc64le.
171
172 2013-04-22  Alan Modra  <amodra@gmail.com>
173
174         PR gold/15355
175         * layout.cc (Layout::segment_precedes): Allow more than one
176         segment with the same type and flags.
177
178 2013-04-15  Cary Coutant  <ccoutant@google.com>
179
180         * layout.cc (Layout::set_relocatable_section_offsets): Don't
181         allocate space in file for BSS sections.
182
183 2013-04-15  Cary Coutant  <ccoutant@google.com>
184
185         * script-sections.cc (Orphan_output_section): Reset address
186         to zero after each orphaned section for relocatable links.
187
188 2013-04-15  Cary Coutant  <ccoutant@google.com>
189
190         * symtab.cc (Symbol_table::sized_write_globals): Subtract
191         section starting address for relocatable link.
192         * testsuite/Makefile.am (script_test_11): New test.
193         * testsuite/Makefile.in: Regenerate.
194         * testsuite/script_test_11.c: New source file.
195         * testsuite/script_test_11.t: New linker script.
196
197 2013-04-13  Alan Modra  <amodra@gmail.com>
198
199         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
200         owner when sections are not adjacent and exceed group size.
201         (Target_powerpc::group_sections): Handle corner case.
202         (Target_powerpc::Branch_info::make_stub): Handle case where
203         stub table doesn't exist due to branches in non-exec sections.
204         (Target_powerpc::Relocate::relocate): Likewise.
205
206 2013-04-11  Alan Modra  <amodra@gmail.com>
207
208         PR gold/15354
209         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
210         .branch_lt to match bfd ld.  Adjust comments throughout file.
211
212 2013-04-04  Ian Lance Taylor  <iant@google.com>
213
214         GCC PR c++/56840
215         * object.cc (do_layout_deferred_sections): Handle .eh_frame
216         sections before checking whether they are included in the link.
217
218 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
219
220         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
221         object before calling the plugin claim_file handler.  Pass the elf
222         object of the archive to the plugin. Delete the elf object if the
223         plugin claims the file.
224
225 2013-03-21  Alan Modra  <amodra@gmail.com>
226
227         * layout.cc (Layout::set_segment_offsets): Accept writable .text
228         segment when omagic.
229
230 2013-03-21  Alan Modra  <amodra@gmail.com>
231
232         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
233         comparison warning.
234         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
235         uninitialized" warning.
236
237 2013-03-20  Alan Modra  <amodra@gmail.com>
238
239         * symtab.h (Symbol::clear_version): New function.
240         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
241         is_needed by weak references.  Clear version for symbols defined
242         in as-needed objects that are not needed.
243
244 2013-03-15  Alan Modra  <amodra@gmail.com>
245
246         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
247         static and public.  Add report_err param.  Return false for data refs.
248         (Target_powerpc::rela_dyn_section): New overloaded function.
249         (Target_powerpc::plt_, iplt_): Elucidate.
250         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
251         (Output_data_plt_powerpc::do_write): Don't write .iplt.
252         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
253         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
254         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
255         push_branch and make_plt_entry for ifunc syms when
256         reloc_needs_plt_for_ifunc.
257         (Target_powerpc::Relocate::relocate): Don't use plt entry value
258         for ifunc unless reloc_needs_plt_for_ifunc.
259
260 2013-03-15  Alan Modra  <amodra@gmail.com>
261
262         * gc.h (gc_process_relocs): Don't look through function descriptors.
263         * icf.cc (get_section_contents): Do so here instead.
264
265 2013-03-13  Alan Modra  <amodra@gmail.com>
266
267         * powerpc.cc (is_branch_reloc): Forward declare.
268         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
269         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
270         false for 64-bit, true for 32-bit non-branch relocs.
271         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
272         * testsuite/Makefile.am (icf_test): Use linker map file instead of
273         nm output.
274         (icf_safe_test): Generate linker map file as well as nm output.
275         (icf_safe_so_test): Likewise.
276         * testsuite/Makefile.in: Regenerate.
277         * testsuite/icf_test.sh: Parse linker map file to determine
278         section folding.
279         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
280         * testsuite/icf_safe_so_test.sh: Likewise.
281         (X86_32_or_ARM_specific_safe_fold): Merge into..
282         (arch_specific_safe_fold): ..this.
283         (X86_64_specific_safe_fold): Delete unused function.
284
285 2013-03-12  Alan Modra  <amodra@gmail.com>
286
287         * gc.h (gc_process_relocs): Look through function descriptors
288         to determine shndx, symvalue and addend used by ICF.  Tidy
289         variable duplication.
290
291 2013-03-11  Alan Modra  <amodra@gmail.com>
292
293         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
294         * layout.cc (Layout_task_runner::run): ..to here.
295         * symtab.h (struct Symbol_location): Extract from..
296         (class Symbol_table): ..here.
297         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
298         * target.h (class Target): Add function_location and
299         do_function_location functions.
300         (class Sized_target): Add do_function_location.
301         * object.h (class Sized_relobj_file): Move find_shdr..
302         (class Object): ..to here.
303         * object.cc: Likewise.  Update to suit.  Instantiate.
304         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
305         * powerpc.cc (class Powerpc_dynobj): New.
306         (Target_powerpc::do_function_location): New function.
307         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
308         (Powerpc_dynobj::do_read_symbols): New function.
309         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
310
311 2013-03-08  Ian Lance Taylor  <iant@google.com>
312
313         * options.cc (General_options::string_to_object_format): Accept
314         "default".
315
316 2013-03-08  Alan Modra  <amodra@gmail.com>
317
318         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
319         pointer to Post_fde.
320         (struct Post_fde): Move definition to here..
321         * ehframe.cc (struct Post_fde): ..from here.
322         (Cie::write): Don't alloc Post_fde.
323         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
324
325 2013-03-07  Alan Modra  <amodra@gmail.com>
326
327         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
328         relocation referencing .LC0.
329         * testsuite/discard_locals_test.sh: Remove FIXMEs.
330
331 2013-03-07  Alan Modra  <amodra@gmail.com>
332
333         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
334         always_inline.  Add assembly for powerpc to avoid GOT.
335
336 2013-03-07  Alan Modra  <amodra@gmail.com>
337
338         * testsuite/script_test_10.sh: Don't test .bss section
339         header number.
340
341 2013-03-06  Alan Modra  <amodra@gmail.com>
342
343         * powerpc.cc (class Powerpc_relobj): Move some member functions.
344         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
345         all callers.  Handle folded sections.
346         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
347         to Powerpc_relobj.
348         (Global_symbol_visitor_opd::operator()): Likewise.
349
350 2013-03-04  Alan Modra  <amodra@gmail.com>
351
352         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
353         * testsuite/Makefile.in: Regenerate.
354
355 2013-03-01  Cary Coutant  <ccoutant@google.com>
356
357         Add dwp support for v2 DWARF package file format.
358         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
359         tu_length parameter.  Adjust all callers.
360         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
361         * dwp.cc: Include dwarf.h.
362         (Section_bounds): New struct type.
363         (Unit_set): New struct type.
364         (Dwo_file::Dwo_file): Initialize new data member.
365         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
366         Combine and rename to...
367         (Dwo_file::read_unit_index): ...this.
368         (Dwo_file::sized_read_compunit_index)
369         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
370         (Dwo_file::sized_read_unit_index): ...this.
371         (Dwo_file::copy_section): Remove section_name, is_str_offsets
372         parameters; add section_id parameter.
373         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
374         (Dwo_file::add_unit_set): ...this.
375         (Dwo_file::shndx_map_): Remove.
376         (Dwo_file::sect_offsets_): New data member.
377         (Dwp_output_file::Dwp_output_file): Initialize new data members.
378         (Dwp_output_file::add_section): Rename to...
379         (Dwp_output_file::add_contribution): ...this.
380         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
381         (Dwp_output_file::add_tu_set): Likewise.
382         (Dwp_output_file::Contribution): New type.
383         (Dwp_output_file::Section::contributions): New data member.
384         (Dwp_output_file::Cu_or_tu_set): Remove.
385         (Dwp_output_file::Section::Section): New ctor.
386         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
387         (Dwp_output_file::Dwp_index::Section_table): New type.
388         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
389         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
390         parameter.
391         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
392         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
393         (Dwp_output_file::Dwp_index::section_table): New member function.
394         (Dwp_output_file::Dwp_index::section_table_end): New member function.
395         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
396         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
397         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
398         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
399         (Dwp_output_file::Dwp_index::section_table_): New data member.
400         (Dwp_output_file::Dwp_index::section_mask_): New data member.
401         (Dwp_output_file::add_output_section): New member function.
402         (Dwp_output_file::write_new_section): New member function.
403         (Dwp_output_file::write_contributions): New member function.
404         (Dwp_output_file::section_id_map_): New data member.
405         (class Dwo_id_info_reader): Remove.
406         (class Unit_reader): New class.
407         (get_dwarf_section_name): New function.
408         (Dwo_file::read_executable): Adjust initializations of class data.
409         (Dwo_file::read): Add support for v2 package file format.
410         (Dwo_file::read_unit_index): Likewise.
411         (Dwo_file::sized_read_unit_index): Likewise.
412         (Dwo_file::copy_section): Likewise.
413         (Dwo_file::add_unit_set): Likewise.
414         (Dwp_output_file::add_output_section): Likewise.
415         (Dwp_output_file::add_contribution): Likewise.
416         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
417         for empty slot.
418         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
419         file format.
420         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
421         slot.
422         (Dwp_output_file::initialize): Remove unused function.
423         (Dwp_output_file::finalize): Add support for v2 package file format.
424         (Dwp_output_file::write_index): Likewise.
425         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
426         function prototype.
427
428 2013-03-01  Cary Coutant  <ccoutant@google.com>
429
430         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
431         function into class definition in header file.
432         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
433         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
434         New function.
435         (Dwarf_info_reader::check_buffer): Move here from .cc file.
436
437 2013-02-28  Alan Modra  <amodra@gmail.com>
438
439         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
440         * target.cc (Target::do_plt_fde_location): New function.
441         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
442         accessor function, and constructor param.
443         (struct Post_fde, Post_fdes): Declare.
444         (Cie::write): Add post_fdes param.
445         * ehframe.cc (Fde::write): Use plt_fde_location.
446         (struct Post_fde): Define.
447         (Cie::write): Stash FDEs added post merge mapping.
448         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
449         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
450         (Eh_frame::do_sized_write): Arrange to write post map FDES after
451         other FDEs.
452         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
453         (Target_powerpc::has_glink): New function.
454         (Target_powerpc::do_relax): Add eh_frame info for stubs.
455         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
456         glink_eh_frame_fde_32, default_fde): New data.
457         (Stub_table::eh_frame_added_): New var.
458         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
459         Make const.
460         (Stub_table::add_eh_frame): New function.
461         (Output_data_glink::add_eh_frame): New function.
462         (Target_powerpc::make_glink_section): Call add_eh_frame.
463
464 2013-02-15  Ian Lance Taylor  <iant@google.com>
465
466         * options.h (DEFINE_uint64_alias): Define.
467         (class General_options): Add -Ttext-segment as an alias for
468         -Ttext.
469
470 2013-02-15  Alan Modra  <amodra@gmail.com>
471
472         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
473         (Stub_table::do_write): ..here, two places.
474         (Stub_table::plt_call_size): Use it here too.
475
476 2013-02-11  Ian Lance Taylor  <iant@google.com>
477
478         * descriptors.cc (Descriptors::close_all): New function.
479         * descriptors.h (class Descriptors): Declare close_all.
480         (close_all_descriptors): New inline function.
481         * plugin.cc: Include "descriptors.h".
482         (Plugin_manager::cleanup): Call close_all_descriptors.
483
484 2013-02-06  Alan Modra  <amodra@gmail.com>
485
486         * README: Update coding style link.
487
488 2013-01-28  Cary Coutant  <ccoutant@google.com>
489
490         * dwp.cc (File_list): New typedef.
491         (Dwo_name_info_reader): New class.
492         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
493         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
494         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
495         (Dwo_file::read_executable): New function.
496         (Dwo_file::read): Move common setup code to ...
497         (Dwo_file::make_object): ... here.
498         (dwp_options): Add --exec/-e.
499         (usage): Likewise.
500         (main): Likewise.
501
502 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
503
504         * layout.cc (Layout::layout): Check for option text_reorder.
505         (Layout::make_output_section): Ditto.
506         * options.h (text_reorder): New option.
507         * output.cc (Input_section_sort_compare): Remove special ordering
508         of section names.
509         (Output_section::
510          Input_section_sort_section_name_special_ordering_compare::
511          operator()): New function.
512         (Output_section::sort_attached_input_sections): Use new sort function
513         for .text.
514         * output.h (Input_section_sort_section_name_special_ordering_compare):
515         New struct.
516         * testsuite/Makefile.am (text_section_grouping): Test option
517         --no-text-reorder
518         * testsuite/Makefile.in: Regenerate.
519         * testsuite/text_section_grouping.sh: Check order of functions without
520         default text reordering.
521
522 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
523
524         * options.h (General_options): Change default to true for new_dtags.
525
526 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
527
528         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
529         when enable_new_dtags is false.  Only add DT_RUNPATH when
530         enable_new_dtags is true.
531
532 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
533
534         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
535         used in declaration and definition consistent.
536         (Target_powerpc::symval_for_branch): Ditto.
537
538 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
539
540         * testsuite/plugin_final_layout.cc: Fix comment.
541
542 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
543
544         * layout.cc (Layout::layout): Do not do default sorting for
545         text sections when section ordering is specified.
546         (make_output_section): Ditto.
547         * testsuite/plugin_final_layout.cc: Name the function sections
548         to catch reordering issues.
549
550 2013-01-15  Alan Modra  <amodra@gmail.com>
551
552         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
553         plt-thread-safe.
554
555 2013-01-15  Alan Modra  <amodra@gmail.com>
556
557         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
558         * testsuite/Makefile.in: Regenerate.
559
560 2013-01-14  Alan Modra  <amodra@gmail.com>
561
562         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
563         * testsuite/Makefile.in: Regenerate.
564
565 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
566
567         PR bfd/14430
568         Fix mingw gold build with plugins enabled
569         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
570         * configure.ac: Export DLOPEN_LIBS and add headers check.
571         * plugin.cc: Handle non-dlfcn case.
572         * Makefile.in: Regenerate.
573         * config.in: Regenerate.
574         * configure: Regenerate.
575         * testsuite/Makefile.in: Regenerate.
576
577 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
578
579         * output.h (sort_attached_input_sections): Change to be public.
580         * script-sections.cc
581         (Output_section_definition::set_section_addresses): Sort
582         attached input sections according to section order before linker
583         script assigns section addresses.
584         (Orphan_output_section::set_section_addresses): Sort
585         attached input sections according to section order before linker
586         script assigns section addresses.
587         * Makefile.am (final_layout.sh): Use a simple linker script to
588         check if section ordering still works.
589         * Makefile.in: Regenerate.
590
591 2013-01-09  Ben Cheng  <bccheng@google.com>
592
593         * arm.cc (Target_arm::attributes_accept_div): New function.
594         (Target_arm::attributes_forbid_div): New function.
595         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
596         attribute using the same new functions as what bfd/elf32_arm.c
597         does.
598
599 2013-01-07  Cary Coutant  <ccoutant@google.com>
600
601         PR gold/14993
602         * output.cc (Output_section::add_input_section): For incremental
603         updates, don't track input sections that are allocated from patch
604         space.
605
606 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
607             Ian Lance Taylor  <iant@google.com>
608
609         PR gold/14897
610         * configure.ac (--enable-ld): Removed.
611         (install_as_default): Set to yes only for --enable-gold=default
612         or --disable-ld.
613         * configure: Regenerated.
614
615 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
616
617         * options.h (General_options): Add -fuse-ld= for GCC linker
618         option compatibility.
619
620 2013-01-04  Cary Coutant  <ccoutant@google.com>
621
622         * configure.ac: Fix typo restoring CXXFLAGS.
623         * configure: Regenerate.
624
625 2013-01-04  Cary Coutant  <ccoutant@google.com>
626
627         * testsuite/Makefile.am (CXXLINK_S): New macro.
628         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
629         * testsuite/Makefile.in: Regenerate.
630
631 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
632
633         * version.cc (print_version): Update copyright year to 2013.
634
635 2012-12-20  Ian Lance Taylor  <iant@google.com>
636
637         * layout.cc (Layout::special_ordering_of_input_section): New
638         function.
639         (Layout::layout): If input section requires special ordering, must
640         sort input sections.
641         (Layout::make_output_section): May sort .text input sections.
642         (Layout::is_section_name_prefix_grouped): Remove.
643         * layout.h (class Layout): Declare
644         special_ordering_of_input_section.  Don't declare
645         is_section_name_prefix_grouped.
646         * output.cc (Output_section::add_input_section): Revert last
647         change.
648         (Output_section::Input_section_sort::match_file_name): Don't crash
649         if called on output section data.
650         (Output_section::Input_section_sort_compare): Sort based on
651         special ordering.
652         (Output_section::Input_section_sort_section_order_index_compare):
653         Revert last patch.
654         (Output_section::sort_attached_input_sections): Likewise.
655
656 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
657
658         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
659         * layout.h (Layout::is_section_name_prefix_grouped): New function.
660         * output.cc (Output_section::add_input_section): Check if section
661         name contains special prefix.  Keep input sections to sort such
662         sections.
663         (Output_section::Input_section_sort_section_order_index_compare
664          ::operator()): Group sections according to prefixes.
665         (Output_section::sort_attached_input_sections): Add condition to
666         Input_section_entry constructor call.
667         * testsuite/Makefile.am (text_section_grouping): New test.
668         * testsuite/Makefile.in: Regenerate.
669         * testsuite/text_section_grouping.cc: New file.
670         * testsuite/text_section_grouping.sh: New file.
671
672 2012-12-17  Nick Clifton  <nickc@redhat.com>
673
674         * Makefile.am: Add copyright notice.
675         * NEWS: Likewise.
676         * README: Likewise.
677         * configure.ac: Likewise.
678         * ftruncate.c: Likewise.
679         * Makefile.in: Regenerate.
680
681 2012-12-14  Cary Coutant  <ccoutant@google.com>
682
683         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
684         --no-as-needed flag.
685         (exception_separate_shared_12_test): Likewise.
686         (incremental_copy_test): Likewise.
687         * testsuite/Makefile.in: Regenerate.
688
689 2012-12-14  Cary Coutant  <ccoutant@google.com>
690
691         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
692         (Dwp_output_file::Dwp_index::enter_set): Add assert.
693
694 2012-12-12  Alan Modra  <amodra@gmail.com>
695
696         * powerpc.cc (class Track_tls): New.
697         (class Relocate, class Scan): Inherit Track_tls.
698         (Target_powerpc::Scan::local, global): Track tls optimization
699         and avoid creating plt entry for __tls_get_addr if all uses
700         are optimized away.
701         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
702
703 2012-12-12  Alan Modra  <amodra@gmail.com>
704
705         * options.h (General_options): Add --toc-sort/--no-toc-sort.
706         Replace no_toc_optimize with toc_optimize.
707         * output.h (Output_section::input_sections): Provide non-const variant.
708         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
709         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
710         accessors.
711         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
712         (class Sort_toc_sections): New.
713         (Target_powerpc::do_finalize_sections): Sort toc sections.
714         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
715
716 2012-12-10  Roland McGrath  <mcgrathr@google.com>
717
718         * testsuite/binary_unittest.cc (read_all): New function.
719         (Sized_binary_test): Use it instead of ::read.
720         * fileread.cc (do_read): Don't assume pread always reads the whole
721         amount in a single call.
722
723 2012-12-10  Alan Modra  <amodra@gmail.com>
724
725         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
726         Set EM_PPC64 or EM_PPC here.
727         (Target_selector_powerpc::do_recognize): Delete.
728
729 2012-12-10  Alan Modra  <amodra@gmail.com>
730
731         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
732         stub_table_.
733         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
734
735 2012-12-07  Roland McGrath  <mcgrathr@google.com>
736
737         * testsuite/binary_unittest.cc (Sized_binary_test):
738         Use open_descriptor rather than ::open.
739
740 2012-12-07  Alan Modra  <amodra@gmail.com>
741
742         * powerpc.cc (Stub_table::do_write): Delete redundant Address
743         typedef and invalid_address constant.
744         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
745         instantiate constants.
746
747 2012-12-06  Roland McGrath  <mcgrathr@google.com>
748
749         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
750         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
751         * aclocal.m4: Regenerate.
752         * configure: Regenerate.
753         * Makefile.in: Regenerate.
754         * testsuite/Makefile.in: Regenerate.
755
756 2012-12-07  Alan Modra  <amodra@gmail.com>
757
758         * options.h (General_options): Add no_toc_optimize.
759         * powerpc.cc (ok_lo_toc_insn): New function.
760         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
761
762 2012-12-06  Alan Modra  <amodra@gmail.com>
763
764         * options.h (General_options): Add plt_align, plt_static_chain,
765         plt_thread_safe.  Update stub_group_size help text.
766         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
767         for new plt_thread_safe_ var.
768         (use_plt_offset): Correct comments.
769         (Target_powerpc::do_relax): Look for thread creation symbols to
770         determine default plt_thread_safe value.  Clear plt call stubs
771         as well as branch stubs each iteration.
772         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
773         insn constants.
774         (l, hi, ha, write_insn): Move earlier.
775         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
776         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
777         plt stubs too.
778         (Stub_table::update_size): Adjust.
779         (Stub_table::prev_size, set_prev_size): Delete.
780         (Stub_table::stub_align): Let --plt-align affect result.
781         (Stub_table::plt_call_size): Calculate sizes for various stubs.
782         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
783         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
784         (Stub_table::do_write): Support more stub variants.
785
786 2012-12-04  Alan Modra  <amodra@gmail.com>
787
788         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
789         (Target_powerpc::do_define_standard_symbols): New function.
790
791 2012-12-03  Alan Modra  <amodra@gmail.com>
792
793         * output.h: Formatting, whitespace.
794
795 2012-12-03  Alan Modra  <amodra@gmail.com>
796
797         * layout.h (Layout::get_executable_sections): Declare.
798         * layout.cc (Layout::get_executable_sections): New function.
799         * arm.cc (Target_arm::group_sections): Use it.
800         (Arm_output_section::group_sections): Delete now redundant test.
801         * output.cc (Output_reloc::Output_reloc): Add is_relative.
802         param to handle relative relocs.
803         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
804         (Output_data_reloc::add_absolute): Adjust.
805         (Output_data_reloc::add_relative): New function.
806         (Output_data::reset_data_size): New function.
807         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
808         (Output_section::set_addralign): New function.
809         (Output_section::checkpoint_set_addralign): New function.
810         (Output_section::clear_section_offsets_need_adjustment): New function.
811         (Output_section::input_sections): Make public.
812         * powerpc.cc (class Output_data_brlt_powerpc): New.
813         (class Stub_table, class Stub_control): New.
814         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
815         stub_table_, set_stub_table, stub_table): New vectors and accessor
816         functions.
817         (Target_powerpc::do_may_relax, do_relax, push_branch,
818         new_stub_table, stub_tables, brlt_section, group_sections,
819         add_branch_lookup_table, find_branch_lookup_table,
820         write_branch_lookup_table, make_brlt_section): New functions.
821         (Target_powerpc::struct Sort_sections, class Branch_info): New.
822         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
823         branch_info_): New vars.
824         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
825         make call stubs here.
826         (Output_data_glink): Remove all call stub handling from this class.
827         (Target_powerpc::Scan::local, global): Save interesting branch
828         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
829         (Target_powerpc::do_finalize_sections): Only make reg save/restore
830         functions on final link.
831         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
832         Handle long branch destinations too.
833         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
834         do_plt_address_for_local): Adjust lookup of plt call stubs.
835
836 2012-11-30  Alan Modra  <amodra@gmail.com>
837
838         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
839         relocs against protected symbols when building 32-bit shared libs.
840
841 2012-11-30  Alan Modra  <amodra@gmail.com>
842
843         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
844         param.  Call got_section() to make .got.  Update all callers
845         and their callers and so on.
846
847 2012-11-30  Alan Modra  <amodra@gmail.com>
848
849         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
850         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
851         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
852         value if it already exists.
853
854 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
855
856         PR gold/14858
857         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
858
859 2012-11-14  Roland McGrath  <mcgrathr@google.com>
860
861         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
862         than bfc instruction for data sandboxing.
863
864 2012-11-08  Alan Modra  <amodra@gmail.com>
865
866         * po/POTFILES.in: Regenerate.
867
868 2012-11-05  Alan Modra  <amodra@gmail.com>
869
870         * configure.ac: Apply 2012-09-10 change to config.in here.
871         * configure: Regenerate.
872
873 2012-11-05  Alan Modra  <amodra@gmail.com>
874
875         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
876         (struct Opd_ent): Use "Address" rather than "Offset".
877         (Output_data_got_powerpc::got_base_offset): Return Valtype.
878         (Target_powerpc::got_section): Make public.
879         (Target_powerpc::scan_relocs): Move code setting symbols..
880         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
881         Create _SDA_BASE_ only when referenced.
882
883 2012-11-02  Roland McGrath  <mcgrathr@google.com>
884
885         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
886         from last change.
887
888 2012-11-01  Roland McGrath  <mcgrathr@google.com>
889
890         * target.h (Sized_target::relocate_relocs): Use Elf_Off
891         for offset_in_output_section parameter.
892         (Sized_target::relocate_special_relocatable): Likewise.
893         * arm.cc (Target_arm::relocate_relocs): Likewise.
894         (Target_arm::relocate_special_relocatable): Likewise.
895         * i386.cc (Target_i386::relocate_relocs): Likewise.
896         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
897         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
898         * target-reloc.h (relocate_relocs): Likewise.
899         * testsuite/testfile.cc (Target_test): Likewise.
900         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
901         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
902
903         * system.h: Move inclusion of <clocale> to after <libintl.h> in
904         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
905
906         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
907         parameter, which is unused in the [!F_SETFD] case.
908
909         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
910         SYMNDX to off_t before comparing it to this->data_size().
911         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
912         * incremental.cc (Output_section_incremental_inputs::do_write):
913         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
914
915         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
916
917 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
918
919         * gold.cc (Target_arm::do_adjust_elf_header): Add the
920         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
921         in EABI_VER5.
922
923 2012-10-29  Cary Coutant  <ccoutant@google.com>
924
925         * dwp.cc (usage): Add file and exit status parameters;
926         add --help and --version options.
927         (print_version): New function.
928         (main): Add --help and --version options.
929
930 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
931
932         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
933         final_layout_sequence.txt.
934         * testsuite/Makefile.in: Regenerated.
935
936 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
937
938         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
939         COMPILE generated by automake.
940         (LINK1): Likewise.
941         (CXXCOMPILE1): Likewise.
942         (CXXLINK1): Likewise.
943         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
944         (LINK): Likewise.
945         (CXXCOMPILE): Likewise.
946         (CXXLINK): Likewise.
947         * testsuite/Makefile.in: Regenerated.
948
949 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
950
951         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
952         on bad fwrite return.
953
954 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
955
956         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
957         on val.
958
959 2012-10-23  Cary Coutant  <ccoutant@google.com>
960
961         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
962         * testsuite/Makefile.in: Regenerate.
963         * testsuite/dwp_test.h: New source file.
964         * testsuite/dwp_test_1.cc: New source file.
965         * testsuite/dwp_test_1.s: New source file.
966         * testsuite/dwp_test_1.sh: New source file.
967         * testsuite/dwp_test_1b.cc: New source file.
968         * testsuite/dwp_test_1b.s: New source file.
969         * testsuite/dwp_test_2.cc: New source file.
970         * testsuite/dwp_test_2.s: New source file.
971         * testsuite/dwp_test_2.sh: New source file.
972         * testsuite/dwp_test_main.cc: New source file.
973         * testsuite/dwp_test_main.s: New source file.
974
975 2012-10-23  Cary Coutant  <ccoutant@google.com>
976
977         * dwp.h: New header file.
978         * dwp.cc: New source file.
979         * gold.h: Move shared declarations to system.h.
980         * system.h: New header file.
981         * Makefile.am: Add dwp.
982         * Makefile.in: Regenerate.
983
984 2012-10-23  Cary Coutant  <ccoutant@google.com>
985
986         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
987         Dwarf_info_reader::read_from_pointer.
988         (Dwarf_pubnames_table::read_header): Likewise.
989         (Dwarf_pubnames_table::next_name): Likewise.
990         (Dwarf_die::read_attributes): Likewise.
991         (Dwarf_die::skip_attributes): Likewise.
992         (Dwarf_info_reader::read_from_pointer): New function template.
993         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
994         (Dwarf_pubnames_table): Likewise.
995         (Dwarf_info_reader::read_from_pointer): New function template.
996         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
997         Dwarf_pubnames_table ctor.
998
999 2012-10-23  Cary Coutant  <ccoutant@google.com>
1000
1001         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1002         abbrev_shndx.
1003         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1004         abbrev_shndx_.
1005         (Dwarf_info_reader::set_abbrev_shndx): New method.
1006         (Dwarf_info_reader::abbrev_shndx_): New data member.
1007
1008 2012-10-23  Cary Coutant  <ccoutant@google.com>
1009
1010         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1011         from object, not parameters.
1012         (Dwarf_info_reader::parse): Likewise.
1013         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1014         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1015         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1016         methods.
1017
1018 2012-10-23  Cary Coutant  <ccoutant@google.com>
1019
1020         * fileread.cc (Input_file::Input_file): New constructor.
1021         * fileread.h (class Input_file): Add new constructor.
1022
1023 2012-10-18  Alan Modra  <amodra@gmail.com>
1024
1025         PR gold/14727
1026         * object.cc (Relobj::is_section_name_included): Also match
1027         .sdata personality section.
1028
1029 2012-10-18  Alan Modra  <amodra@gmail.com>
1030
1031         * target-reloc.h (class Default_comdat_behavior): New, package up..
1032         (get_comdat_behaviour): ..this.
1033         (relocate_section): Add Relocate_comdat_behavior template arg,
1034         adjust code to suit.
1035         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1036         (Target_arm::scan_reloc_section): Likewise.
1037         * i386.cc (Target_i386::relocate_section): Likewise.
1038         * sparc.cc (Target_sparc::relocate_section): Likewise.
1039         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1040         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1041         * powerpc.cc (class Relocate_comdat_behavior): New.
1042         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1043         gold::relocate_section with new template arg.
1044
1045 2012-10-18  Alan Modra  <amodra@gmail.com>
1046
1047         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1048         dynamic relocs for GOT_TPREL got entries, without symbol if
1049         resolving locally.
1050         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1051         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1052         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1053
1054 2012-10-17  Alan Modra  <amodra@gmail.com>
1055
1056         PR gold/14726
1057         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1058
1059 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1060
1061         * layout.cc (Layout::include_section): Keep sections marked
1062         SHF_EXCLUDE when doing relocatable links.
1063
1064 2012-10-16  Alan Modra  <amodra@gmail.com>
1065
1066         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1067         (Target_powerpc::do_finalize_sections): Call it.
1068         (Output_data_save_res): New class and supporting functions.
1069         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1070         normal symbols defined in object files.
1071
1072 2012-10-12  Alan Modra  <amodra@gmail.com>
1073
1074         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1075         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1076         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1077         section if scan_opd_relocs not yet called.
1078         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1079
1080 2012-10-12  Alan Modra  <amodra@gmail.com>
1081
1082         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1083         add_local_ifunc_entry): Revert last change.
1084         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1085
1086 2012-10-05  Alan Modra  <amodra@gmail.com>
1087
1088         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1089         do_plt_address_for_global): New functions.
1090         (Output_data_got_powerpc::do_write): Don't segfault when linking
1091         statically.
1092         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1093         add_local_ifunc_entry): Return true on adding entry..
1094         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1095         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1096         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1097         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1098         set up symbols here.
1099         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1100         syms here.  Do so even when no .iplt.  Don't segfault when linking
1101         statically.
1102         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1103         new variants without reloc param.
1104         (Glink_sym_ent::Glink_sym_ent): Likewise.
1105         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1106         reloc when refs will resolve to plt call stub.
1107         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1108         R_PPC_PLTREL24 to resolve locally.
1109         (Target_powerpc::Scan::global): Correct ifunc handling.
1110         (Target_powerpc::Relocate::relocate): Correct local sym glink
1111         lookup.  Don't destroy "value" when we have a plt call stub,
1112         and when checking plt call validity.
1113         (Target_powerpc::do_dynsym_value): Simplify.
1114
1115 2012-10-05  Alan Modra  <amodra@gmail.com>
1116
1117         * i386.cc (Output_data_plt_i386::address_for_global,
1118         address_for_local): Add plt offset to returned value.  Adjust uses.
1119         * sparc.cc (Output_data_plt_sparc::address_for_global,
1120         address_for_local): Likewise.
1121         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1122         address_for_local): Likewise.
1123         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1124         address_for_local): Likewise.
1125         * target.h (Target::plt_address_for_global, plt_address_for_local):
1126         Update comment.
1127         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1128         (Output_data_got::Got_entry::write): Nor here.
1129         * output.h: Comment fix.
1130
1131 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1132
1133         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1134         global_offset_table_ value for larget got.
1135         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1136
1137 2012-09-29  Alan Modra  <amodra@gmail.com>
1138
1139         * powerpc.cc (Target_powerpc::iplt_): New output section.
1140         (Target_powerpc::iplt_section, make_iplt_section,
1141         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1142         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1143         Target_powerpc::plt_entry_count): Count iplt entries too.
1144         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1145         reloc section in constructor.  New params.
1146         (Target_powerpc::make_plt_section): Create reloc section here instead.
1147         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1148         functions.
1149         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1150         (Output_data_glink::add_entry, find_entry): New functions to
1151         deal with local syms.
1152         (Glink_sym_ent): Add support for local syms.
1153         (Output_data_glink::do_write): Handle ifunc plt entries.
1154         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1155         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1156         (Target_powerpc::Relocate::relocate): Likewise.
1157         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1158
1159 2012-09-25  Alan Modra  <amodra@gmail.com>
1160
1161         * object.h (Sized_relobj_file::adjust_local_symbol,
1162         do_adjust_local_symbol): New functions.
1163         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1164         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1165         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1166         and irregular opd entry spacing.
1167         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1168         (Global_symbol_visitor_opd): New functor.
1169         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1170         on deleted opd entries.
1171
1172 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1173
1174         * tilegx.cc: New file.
1175         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1176         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1177         * configure.tgt: Add entries for tilegx*.
1178         * configure.ac: Likewise.
1179         * Makefile.in: Rebuild.
1180         * configure: Likewise.
1181         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1182         tilegx.
1183
1184 2012-09-13  Alan Modra  <amodra@gmail.com>
1185
1186         * target-reloc.h (scan_relocs): Call scan.local for relocs
1187         against symbols in discarded sections.  Pass is_discarded
1188         param.
1189         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1190         Add is_discarded param.
1191         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1192         is_discarded to flag opd entry as discarded.  Don't emit dyn
1193         relocs on such entries.
1194         (Target_powerpc::Scan::global): Similarly detect and handle
1195         such opd entries.
1196         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1197         opd_ent_.  Update all uses.
1198         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1199         (Target_powerpc::relocate_section): Zero out discarded opd
1200         entry relocs.
1201
1202 2012-09-12  Ian Lance Taylor  <iant@google.com>
1203
1204         PR gold/14570
1205         * output.cc: Rename Output_data_got template parameter from size
1206         to got_size for all functions.  Compile all variants of
1207         Output_data_got.
1208         (Output_data_got::Got_entry::write): Correct use of size for
1209         symbol value.  Use local_is_tls rather than casting to
1210         Sized_relobj_file.
1211         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1212         (class Sized_relobj_file): Add do_local_is_tls.
1213         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1214
1215 2012-09-11  Alan Modra  <amodra@gmail.com>
1216
1217         PR gold/14566
1218         * layout.cc (Layout::set_segment_offsets): When using
1219         common-page-size alignment, ensure we are on a new max-page-size
1220         page.
1221         * output.cc (Output_segment::set_section_addresses): Use
1222         abi_pagesize, not common_pagesize for relro boundary.
1223         (Output_segment::set_offset): Likewise.
1224
1225 2012-09-11  Alan Modra  <amodra@gmail.com>
1226
1227         * output.h (Output_data_got::add_global_tls, add_local_tls,
1228         add_local_tls_pair): New functions.
1229         (Output_data_got::add_local_pair_with_rel): Remove second
1230         reloc param.  Expand comment.
1231         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1232         use_plt_or_tls_offset_, similarly for constructor param.
1233         (Output_data_got::Got_entry::write): Add got_index param.
1234         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1235         add_local_tls_pair): New functions.
1236         (Output_data_got::Got_entry::write): Handle tls symbols
1237         with use_plt_or_tls_offset_ set specially.
1238         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1239         (Output_data_got::do_write): Replace iterator with index, pass
1240         index to entry write function.
1241         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1242         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1243         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1244         call.
1245         * i386.cc (Target_i386::Scan::local): Likewise.
1246         * sparc.cc (Target_sparc::Scan::local): Likewise.
1247         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1248         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1249         do_tls_offset_for_global): New functions.
1250         (Target_powerpc::Scan::local): Correct TLS relocations and got
1251         entry values.
1252         (Target_powerpc::Scan::global): Don't emit unnecessary
1253         dynamic relocations on TLS GOT entries.
1254
1255 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1256
1257         * config.in: Disable sanity check for kfreebsd.
1258
1259 2012-09-10  Sterling Augustine  <saugustine@google.com>
1260
1261         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1262         (Gdb_index::pubtypes_read): New parameter.
1263         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1264         to calls.
1265         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1266         pubtypes_object_.
1267
1268 2012-09-09  Alan Modra  <amodra@gmail.com>
1269
1270         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1271         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1272         * gc.h (gc_process_relocs): Call target gc_add_reference.
1273         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1274         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1275         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1276         unnecessary cast.
1277         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1278         to cater for when we don't need code offset.  Update use.
1279         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1280         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1281         set_opd_valid): New functions.
1282         (Target_powerpc::do_gc_add_reference): New function.
1283         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1284         stashed refs.
1285         (Target_powerpc::do_gc_mark_symbol): New function.
1286
1287 2012-09-06  Cary Coutant  <ccoutant@google.com>
1288
1289         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1290         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1291         (Dwarf_die::skip_attributes): Likewise.
1292         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1293         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1294         (main): Call it.
1295         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1296
1297 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1298
1299         * testsuite/script_test_3.t: Add .got.plt output section
1300         statement.
1301         * testsuite/script_test_4.t: Likewise.
1302
1303 2012-09-05  Alan Modra  <amodra@gmail.com>
1304
1305         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1306         update all uses and lose "enum" when using type.
1307
1308 2012-09-05  Alan Modra  <amodra@gmail.com>
1309
1310         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1311         * configure: Regenerate.
1312         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1313         (plugin_final_layout.stdout): Likewise.
1314         (memory_test): Set page sizes to 0x1000.
1315         * testsuite/Makefile.in: Regenerate.
1316         * testsuite/discard_locals_test.sh: Add FIXME comment.
1317         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1318         * testsuite/pr14265.t: Add .got output section statement.
1319         * testsuite/script_test_2.t: Likewise.
1320         * testsuite/script_test_3.t: Likewise.
1321         * testsuite/script_test_4.t: Likewise.
1322         * testsuite/script_test_5.t: Likewise.
1323         * testsuite/script_test_6.t: Likewise.
1324         * testsuite/script_test_7.t: Likewise.
1325         * testsuite/script_test_9.t: Likewise.
1326
1327 2012-09-05  Alan Modra  <amodra@gmail.com>
1328
1329         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1330         (Powerpc_relocate_functions::Status): New typedef.
1331         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1332         (Target_powerpc::Scan::local): Handle REL64.
1333         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1334         for REL32 and REL64.
1335         (Target_powerpc::symval_for_branch): New function, extracted from..
1336         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1337         checks.  Report overflow errors.
1338
1339 2012-09-05  Alan Modra  <amodra@gmail.com>
1340
1341         * object.h (Sized_relobj_file::emit_relocs): Delete.
1342         (Sized_relobj_file::emit_relocs_reltype): Delete.
1343         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1344         relocate_relocs for --emit-relocs.
1345         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1346         * output.h: Update comment.
1347         (Output_segment::first_section): New function.
1348         (Output_segment::first_section_load_address): Use first_section.
1349         * output.cc (Output_segment::first_section): New function extracted..
1350         (Output_segment::first_section_load_address): ..from here.  Delete.
1351         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1352         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1353         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1354         adjust call to target.h function.
1355         * i386.cc (Target_i386): Likewise.
1356         * sparc.cc (Target_sparc): Likewise.
1357         * x86_64.cc (Target_x86_64): Likewise.
1358         * powerpc.cc (Target_powerpc): Likewise.
1359         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1360         first tls section has section symbol for optimised local dynamic
1361         output relocs.
1362         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1363         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1364         optimised tls code.
1365         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1366         Rename to relocate_relocs.  Update error message.
1367
1368 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1369
1370         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1371         --just-symbols.
1372
1373 2012-08-31  Alan Modra  <amodra@gmail.com>
1374
1375         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1376         (Powerpc_relobj::toc_base_offset): New stub function.
1377         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1378         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1379         (Target_powerpc::Relocate::enum skip_tls): New.
1380         (Target_powerpc::call_tls_get_addr_): New var.
1381         (Target_powerpc::is_branch_reloc): Move to file scope.
1382         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1383         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1384         New functions.
1385         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1386         (powerpc_info): Correct common_pagesize for ppc64.
1387         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1388         (Powerpc_relocate_functions): Add overflow check enums and functions.
1389         Add non-shift version of rela, rela_ua.  Delete all rel public
1390         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1391         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1392         addr16_ha3, addr14 functions.
1393         (Output_data_got_powerpc::add_constant_pair): New function.
1394         (Output_data_got_powerpc::got_base_offset): Likewise.
1395         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1396         (instruction constants): Sort, add some more.
1397         (Output_data_glink::do_write): Add and use Address typedef.  Use
1398         object->toc_base_offset() stub for 64-bit.
1399         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1400         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1401         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1402         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1403         Always treat .opd relocs as against locally defined symbol.
1404         Correct condition for RELATIVE relocs.
1405         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1406         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1407         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1408         calculations.  Handle TLS relocs, and more.  Add overflow
1409         checking and adjust for Powerpc_relocate_functions changes.
1410         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1411         Reinstate --emit-relocs code with FIXME.
1412
1413 2012-08-30  Alan Modra  <amodra@gmail.com>
1414
1415         * layout.cc (Layout::set_segment_offsets): Set p_align to
1416         abi_pagesize, not common_pagesize.
1417         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1418         to determine whether file header can go in segment.
1419
1420 2012-08-30  Alan Modra  <amodra@gmail.com>
1421
1422         * output.h (Output_reloc::Output_reloc <output section>): Add
1423         is_relative param.  Adjust calls.
1424         (Output_reloc::add_output_section_relative): New functions.
1425         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1426         is_relative.
1427         (Output_reloc::symbol_value): Handle SECTION_CODE.
1428
1429 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1430
1431         * gold.cc (queue_middle_tasks): Call layout again when unique
1432         segments for sections is desired.
1433         * layout.cc (Layout::Layout): Initialize new members.
1434         (Layout::get_output_section_flags): New function.
1435         (Layout::choose_output_section): Call get_output_section_flags.
1436         (Layout::layout): Make output section for mapping to a unique segment.
1437         (Layout::insert_section_segment_map): New function.
1438         (Layout::attach_allocated_section_to_segment): Make unique segment for
1439         output sections marked so.
1440         (Layout::segment_precedes): Check for unique segments when sorting.
1441         * layout.h (Layout::Unique_segment_info): New struct.
1442         (Layout::Section_segment_map): New typedef.
1443         (Layout::insert_section_segment_map): New function.
1444         (Layout::get_output_section_flags): New function.
1445         (Layout::is_unique_segment_for_sections_specified): New function.
1446         (Layout::set_unique_segment_for_sections_specified): New function.
1447         (Layout::unique_segment_for_sections_specified_): New member.
1448         (Layout::section_segment_map_): New member.
1449         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1450         Rename is_gc_pass_one to is_pass_one.
1451         Rename is_gc_pass_two to is_pass_two.
1452         Rename is_gc_or_icf to is_two_pass.
1453         Check for which pass based on whether symbols data is present.
1454         Make it two pass when unique segments for sections is desired.
1455         * output.cc (Output_section::Output_section): Initialize new
1456         members.
1457         * output.h (Output_section::is_unique_segment): New function.
1458         (Output_section::set_is_unique_segment): New function.
1459         (Output_section::is_unique_segment_): New member.
1460         (Output_section::extra_segment_flags): New function.
1461         (Output_section::set_extra_segment_flags): New function.
1462         (Output_section::extra_segment_flags_): New member.
1463         (Output_section::segment_alignment): New function.
1464         (Output_section::set_segment_alignment): New function.
1465         (Output_section::segment_alignment_): New member.
1466         (Output_segment::Output_segment): Initialize is_unique_segment_.
1467         (Output_segment::is_unique_segment): New function.
1468         (Output_segment::set_is_unique_segment): New function.
1469         (Output_segment::is_unique_segment_): New member.
1470         * plugin.cc (allow_unique_segment_for_sections): New function.
1471         (unique_segment_for_sections): New function.
1472         (Plugin::load): Add new functions to transfer vector.
1473         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1474         * Makefile.in: Regenerate.
1475         * testsuite/plugin_final_layout.sh: Check if unique segment
1476         functionality works.
1477         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1478         are available.
1479         (allow_unique_segment_for_sections): New global.
1480         (unique_segment_for_sections): New global.
1481         (claim_file_hook): Call allow_unique_segment_for_sections.
1482         (all_symbols_read_hook): Call unique_segment_for_sections.
1483
1484 2012-08-22  Cary Coutant  <ccoutant@google.com>
1485
1486         * layout.cc (Layout::include_section): Don't assert on GROUP
1487         sections with --emit-relocs.
1488
1489 2012-08-21  Cary Coutant  <ccoutant@google.com>
1490
1491         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1492         if --export-dynamic-symbol names an undef symbol.
1493
1494 2012-08-18  Alan Modra  <amodra@gmail.com>
1495
1496         * powerpc.cc: Formatting and white space.
1497         (Powerpc_relobj): Rename got2_section_ to special_.
1498         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1499         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1500         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1501         (Target_powerpc): Add Address typedef and invalid_address.  Use
1502         throughout.
1503         (Target_powerpc::is_branch_reloc): New function.
1504         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1505         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1506         for dst_mask, value and addend.
1507         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1508         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1509         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1510         uint16_t for 24-bit offset.  Use get_output_section_offset and
1511         check return.
1512         (Target_powerpc::Scan::local): Handle more relocs.
1513         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1514         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1515         Plug in toc restoring insn after plt calls.  Translate branches
1516         to function descriptor symbols to corresponding entry point.
1517         (Target_powerpc::relocate_for_relocatable): Check return from
1518         get_output_section_offset.
1519         * symtab.h: Comment typo.
1520
1521 2012-08-14  Ian Lance Taylor  <iant@google.com>
1522
1523         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1524         unsupported_relocal_local to call unsupported_reloc_global.
1525
1526 2012-08-14  Nick Clifton  <nickc@redhat.com>
1527
1528         PR ld/14265
1529         * script-sections.cc (Sections_element::output_section_name): Add
1530         keep return parameter.
1531         (Output_section_element::match_name): Add keep return parameter.
1532         Return the value of the keep_ member.
1533         * script-sections.h (class Output_section): Update
1534         output_section_name prototype.
1535         * layout.cc (Layout::keep_input_section): New public member
1536         function.
1537         (Layout::choose_output_section): Pass keep parameter to
1538         output_section_name.
1539         * layout.h (class Layout): Add keep_input_section.
1540         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1541         sections.
1542         * testsuite/Makefile.am: Add a test.
1543         * testsuite/Makefile.in: Regenerate.
1544         * testsuite/pr14265.c: Source file for the test.
1545         * testsuite/pr14265.t: Linker script for the test.
1546         * testsuite/pr14265.sh: Shell script for the test.
1547
1548 2012-08-14  Alan Modra  <amodra@gmail.com>
1549
1550         * target.h (Target::output_section_name): New function.
1551         (Target::do_output_section_name): New function.
1552         * layout.cc (Layout::choose_output_section): Call the above.
1553         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1554
1555 2012-08-14  Alan Modra  <amodra@gmail.com>
1556
1557         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1558         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1559         for replace_constant call.
1560         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1561         (Output_data_glink::do_print_to_mapfile): New function.
1562         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1563         (Target_powerpc::Relocate::relocate): Likewise.
1564
1565 2012-08-14  Alan Modra  <amodra@gmail.com>
1566
1567         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1568         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1569         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1570         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1571         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1572         here.
1573         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1574         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1575         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1576         here.
1577         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1578         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1579
1580 2012-08-12  Alan Modra  <amodra@gmail.com>
1581
1582         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1583         (glink insn constants): Use uint32_t.
1584         (Output_data_glink::add_entry): Use insert, not [] operator.
1585
1586 2012-08-11  Alan Modra  <amodra@gmail.com>
1587
1588         * object.h (Sized_relobj_file::find_shdr): New function.
1589         (Sized_relobj_file::find_special_sections): New function.
1590         * object.cc (Sized_relobj_file::find_shdr): New function.
1591         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1592         (Sized_relobj_file::find_special_sections): New function, split out..
1593         (Sized_relobj_file::do_read_symbols): ..from here.
1594         * output.h (Output_data_got::replace_constant): New function.
1595         (Output_data_got::num_entries): New function.
1596         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1597         (Output_data_got::got_offset): Protected rather than private.
1598         (Output_data_got::replace_got_entry): New function.
1599         * output.cc (Output_data_got::replace_got_entry): New function.
1600         * powerpc.cc (class Powerpc_relobj): New.
1601         (class Powerpc_relocate_functions): Delete all psymval variants or
1602         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1603         Implement _ha functions using corresponding _hi function.
1604         (Powerpc_relobj::find_special_sections): New function.
1605         (Target_powerpc::do_make_elf_object): New function.
1606         (class Output_data_got_powerpc): New.
1607         (class Output_data_glink): New.
1608         (class Powerpc_scan_relocatable_reloc): New.
1609         Many more changes througout file.
1610
1611 2012-08-09  Nick Clifton  <nickc@redhat.com>
1612
1613         * po/vi.po: Updated Vietnamese translation.
1614
1615 2012-08-07  Ian Lance Taylor  <iant@google.com>
1616
1617         * layout.cc (Layout::add_target_dynamic_tags): If
1618         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1619         plt_rel.
1620
1621 2012-07-30  Nick Clifton  <nickc@redhat.com>
1622
1623         * po/gold.pot: Updated template.
1624         * po/es.po: Updated Spanish translation.
1625
1626 2012-07-18  Cary Coutant  <ccoutant@google.com>
1627
1628         PR gold/14344
1629         * configure.ac: Add check for -gpubnames support.
1630         * configure: Regenerate.
1631         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1632         support; force -gno-pubnames.
1633         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1634         support.
1635         (gdb_index_test_4): New test.
1636         * testsuite/Makefile.in: Regenerate.
1637         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1638         * testsuite/gdb_index_test_2.sh: Likewise.
1639         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1640         * testsuite/gdb_index_test_4.sh: New script.
1641         * testsuite/gdb_index_test_comm.sh: New script with common code;
1642         don't look for space after colon.
1643
1644 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1645
1646         * gold.cc (queue_middle_tasks): Update function order only after
1647         deferred objects due to plugins are processed.
1648
1649 2012-07-11  Ian Lance Taylor  <iant@google.com>
1650
1651         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1652         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1653         (Target_arm::scan_reloc_for_stub): Likewise.
1654         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1655         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1656         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1657         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1658         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1659
1660 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1661             Ian Lance Taylor  <iant@google.com>
1662
1663         PR gold/14309
1664         * configure.ac: Test whether std::tr1::hash<off_t> works.
1665         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1666         needed.
1667         * output.h (class Output_fill): Add virtual destructor.
1668         * configure, config.in: Rebuild.
1669
1670 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1671
1672         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1673
1674 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1675
1676         * plugin.cc (Plugin::load): Handle position independent executables.
1677
1678 2012-06-06  Cary Coutant  <ccoutant@google.com>
1679
1680         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1681         add .debug_macro.
1682         (lines_only_debug_sections): Likewise.
1683         (gdb_fast_lookup_sections): New static array.
1684         (is_gdb_debug_section): Rename formal parameter.
1685         (is_lines_only_debug_section): Likewise.
1686         (is_gdb_fast_lookup_section): New function.
1687         (Layout::include_section): Check for ".zdebug_" prefix; pass
1688         section name suffix to is_gdb_debug_section, et al.; check for
1689         fast-lookup sections when building .gdb_index.
1690         * options.h (--strip-debug-gdb): Update GDB version number.
1691
1692 2012-06-06  Cary Coutant  <ccoutant@google.com>
1693
1694         * configure.ac: Add check for fallocate.
1695         * configure: Regenerate.
1696         * config.in: Regenerate.
1697
1698         * options.h (class General_options): Add --mmap-output-file and
1699         --posix-fallocate options.
1700         * output.cc: (posix_fallocate): Remove; replace with...
1701         (gold_fallocate): New function.
1702         (Output_file::map_no_anonymous): Call gold_fallocate.
1703         (Output_file::map): Check --mmap-output-file option.
1704
1705 2012-06-05  Jing Yu  <jingyu@google.com>
1706
1707         * gold.h (textdomain): Add do {} to empty while(0).
1708         (bindtextdomain): Likewise.
1709
1710 2012-06-04  Cary Coutant  <ccoutant@google.com>
1711
1712         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1713         has_dynsym_index.
1714
1715 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1716
1717         * symtab.cc (Symbol_table::define_special_symbol):
1718         Initialize *poldsym to prevent uninitialized variable errors.
1719
1720 2012-05-23  Cary Coutant  <ccoutant@google.com>
1721
1722         * layout.cc (Layout::section_name_mapping): Add rules to handle
1723         exact match on .data.rel.ro.local or .data.rel.ro.
1724         (Layout::output_section_name): Check for exact matches.
1725
1726 2012-05-23  Cary Coutant  <ccoutant@google.com>
1727
1728         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1729         more carefully.
1730
1731 2012-05-22  Cary Coutant  <ccoutant@google.com>
1732
1733         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1734         object before exporting symbol.
1735
1736 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1737
1738         * testsuite/tls_test.cc: Include "config.h" first.
1739         * testsuite/tls_test_c.c: Likewise.
1740
1741 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1742             Nick Clifton  <nickc@redhat.com>
1743
1744         PR 14072
1745         * configure.in: Add check that sysdep.h has been included before
1746         any system header files.
1747         * configure: Regenerate.
1748         * config.in: Regenerate.
1749
1750 2012-05-14  Cary Coutant  <ccoutant@google.com>
1751
1752         * layout.cc (Layout::make_output_section): Mark .tdata section
1753         as RELRO.
1754         * testsuite/relro_test.cc: Add a TLS variable.
1755
1756 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1757
1758         PR gold/14091
1759         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1760         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1761         R_X86_64_64.
1762
1763 2012-05-08  Cary Coutant  <ccoutant@google.com>
1764
1765         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1766         (lines_only_debug_sections): Likewise.
1767
1768 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1769
1770         * nacl.cc: New file.
1771         * nacl.h: New file.
1772         * Makefile.am (CCFILES, HFILES): Add them.
1773         * Makefile.in: Regenerate.
1774         * i386.cc (Output_data_plt_i386_nacl): New class.
1775         (Output_data_plt_i386_nacl_exec): New class.
1776         (Output_data_plt_i386_nacl_dyn): New class.
1777         (Target_i386_nacl): New class.
1778         (Target_selector_i386_nacl): New class.
1779         (target_selector_i386): Use it instead of Target_selector_i386.
1780         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1781         (Target_x86_64_nacl): New class.
1782         (Target_selector_x86_64_nacl): New class.
1783         (target_selector_x86_64, target_selector_x32): Use it instead of
1784         Target_selector_x86_64.
1785         * arm.cc (Output_data_plt_arm_nacl): New class.
1786         (Target_arm_nacl): New class.
1787         (Target_selector_arm_nacl): New class.
1788         (target_selector_arm, target_selector_armbe): Use it instead of
1789         Target_selector_arm.
1790
1791         * target-select.cc (select_target): Take new Input_file* and off_t
1792         arguments, pass them on to recognize method of selector.
1793         * object.cc (make_elf_sized_object): Update caller.
1794         * parameters.cc (parameters_force_valid_target): Likewise.
1795         * incremental.cc (make_sized_incremental_binary): Likewise.
1796         * target-select.h: Update decl.
1797         (Target_selector::recognize): Take new Input_file* argument,
1798         pass it on to do_recognize.
1799         (Target_selector::do_recognize): Take new Input_file* argument.
1800         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1801         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1802         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1803         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1804
1805         * target.h (Target::Target_info): New members isolate_execinstr
1806         and rosegment_gap.
1807         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1808         * arm.cc (Target_arm::arm_info): Update initializer.
1809         * i386.cc (Target_i386::i386_info): Likewise.
1810         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1811         * sparc.cc (Target_sparc::sparc_info): Likewise.
1812         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1813         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1814         * layout.cc (Layout::attach_allocated_section_to_segment):
1815         Take new const Target* argument.  If target->isolate_execinstr(), act
1816         like --rosegment.
1817         (Layout::find_first_load_seg): Take new const Target* argument;
1818         if target->isolate_execinstr(), reject PF_X segments.
1819         (Layout::relaxation_loop_body): Update caller.
1820         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1821         reset file offset to zero when we hit LOAD_SEG, and then do a second
1822         loop over the segments before LOAD_SEG to reassign offsets after
1823         addresses have been determined.  Handle target->rosegment_gap().
1824         (Layout::attach_section_to_segment): Take new const Target* argument;
1825         pass it to attach_allocated_section_to_segment.
1826         (Layout::make_output_section): Update caller.
1827         (Layout::attach_sections_to_segments): Take new const Target* argument;
1828         pass it to attach_section_to_segment.
1829         * gold.cc (queue_middle_tasks): Update caller.
1830         * layout.h (Layout): Update method decls with new arguments.
1831
1832         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1833         Target_info pointer to use.
1834         (Target_arm::do_make_data_plt): New virtual method.
1835         (Target_arm::make_data_plt): New method that calls it.
1836         (Target_arm::make_plt_entry): Use it.
1837         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1838         for the section alignment.
1839         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1840         method.
1841         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1842         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1843         method.
1844         (Output_data_plt_arm::get_plt_entry_size): Call it.
1845         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1846         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1847         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1848         method.
1849         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1850         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1851         method instead of sizeof(plt_entry).
1852         (Output_data_plt_arm::add_entry): Likewise.
1853         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1854         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1855         than static method.
1856         (Target_arm::plt_entry_size): Likewise.
1857         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1858         Move to ...
1859         (Output_data_plt_arm_standard): ... here, new class.
1860         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1861         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1862         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1863
1864         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1865         Take additional argument for the PLT entry size.
1866         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1867         Use get_plt_entry_size method rather than plt_entry_size variable.
1868         (Output_data_plt_x86_64::reserve_slot): Likewise.
1869         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1870         (Output_data_plt_x86_64::add_entry): Likewise.
1871         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1872         (Output_data_plt_x86_64::address_for_global): Likewise.
1873         (Output_data_plt_x86_64::address_for_local): Likewise.
1874         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1875         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1876         Make method non-static.
1877         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1878         method.
1879         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1880         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1881         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1882         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1883         virtual method.
1884         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1885         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1886         virtual method.
1887         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1888         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1889         virtual method.
1890         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1891         (Output_data_plt_x86_64::plt_entry_size)
1892         (Output_data_plt_x86_64::first_plt_entry)
1893         (Output_data_plt_x86_64::plt_entry)
1894         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1895         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1896         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1897         (Output_data_plt_x86_64_standard): ... here, new class.
1898         (Target_x86_64::Target_x86_64): Take optional argument for the
1899         Target_info pointer to use.
1900         (Target_x86_64::do_make_data_plt): New virtual method.
1901         (Target_x86_64::make_data_plt): New method to call it.
1902         (Target_x86_64::init_got_plt_for_update): Use that.
1903         Call this->plt_->add_eh_frame method here.
1904         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1905         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1906         rather than static method.
1907         (Target_x86_64::plt_entry_size): Likewise.
1908         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1909         rather than plt_entry_size variable.  Move guts of PLT filling to...
1910         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1911         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1912         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1913
1914         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1915         additional argument for the section alignment.
1916         Don't do add_eh_frame_for_plt here.
1917         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1918         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1919         variable.
1920         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1921         method.
1922         (Output_data_plt_i386::get_plt_entry_size): Call it.
1923         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1924         (Output_data_plt_i386::add_eh_frame): New method to call it.
1925         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1926         method.
1927         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1928         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1929         method.
1930         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1931         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1932         method instead of plt_entry_size.
1933         (Output_data_plt_i386::plt_entry_size)
1934         (Output_data_plt_i386::plt_eh_frame_fde_size)
1935         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1936         (Output_data_plt_i386_standard): ... here, new class.
1937         (Output_data_plt_i386_exec): New class.
1938         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1939         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1940         (Output_data_plt_i386::exec_plt_entry): Move to ...
1941         (Output_data_plt_i386_exec::plt_entry): ... here.
1942         (Output_data_plt_i386_dyn): New class.
1943         (Output_data_plt_i386::first_plt_entry): Move to ...
1944         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1945         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1946         (Output_data_plt_i386_dyn::plt_entry): ... here.
1947         (Target_i386::Target_i386): Take optional argument for the Target_info
1948         pointer to use.
1949         (Target_i386::do_make_data_plt): New virtual method.
1950         (Target_i386::make_data_plt): New method to call it.
1951         (Target_i386::make_plt_section): Use that.
1952         Call this->plt_->add_eh_frame method here.
1953         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1954         rather than plt_entry_size variable.
1955         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1956         (Output_data_plt_i386::address_for_local): Likewise.
1957         (Output_data_plt_i386::do_write): Likewise.
1958         Move guts of PLT filling to...
1959         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1960         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1961         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1962         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1963
1964 2012-05-01  Cary Coutant  <ccoutant@google.com>
1965
1966         * dwarf_reader.cc (Dwarf_die::read_attributes)
1967         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1968         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1969         * reduced_debug_output.cc
1970         (Output_reduced_debug_info_section::get_die_end): Remove
1971         DW_FORM_GNU_ref_index.  Add default case.
1972
1973 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1974
1975         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1976         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1977         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1978         DW_AT_high_pc as offset from DW_AT_low_pc.
1979
1980         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1981         * testsuite/Makefile.in: Regenerate.
1982         * testsuite/gdb_index_test_3.c: New test source file.
1983         * testsuite/gdb_index_test_3.sh: New test source file.
1984
1985 2012-04-25  Ian Lance Taylor  <iant@google.com>
1986
1987         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1988         pointer.
1989         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1990         as a class, not a struct.
1991         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1992         (Target_arm::apply_cortex_a8_workaround): Likewise.
1993         * gc.h: Declare Reloc_types as a struct, not a class.
1994         * object.h: Declare Symbols_data as a struct.
1995         * reloc.h: Declare Read_relocs_data as a struct.
1996         * target.h: Declare Relocate_info as a struct.
1997
1998 2012-04-24  David S. Miller  <davem@davemloft.net>
1999
2000         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2001         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2002         and R_SPARC_WPLT30.
2003
2004 2012-04-24  Cary Coutant  <ccoutant@google.com>
2005
2006         * incremental-dump.cc (find_input_containing_global): Replace
2007         magic number with symbolic constant.
2008         (dump_incremental_inputs): Update version number.
2009         * incremental.cc (Output_section_incremental_inputs): Update version
2010         number; import symbolic constants from Incremental_inputs_reader.
2011         (Incremental_inputs::create_data_sections): Align relocations
2012         section correctly for 64-bit targets.
2013         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2014         constants; add padding.
2015         (Output_section_incremental_inputs::write_header): Add assert for
2016         header_size.
2017         (Output_section_incremental_inputs::write_input_files): Add assert
2018         for input_entry_size.
2019         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2020         add assert for object_info_size, input_section_entry_size,
2021         global_sym_entry_size.
2022         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2023         for data structure sizes; use them.
2024         (Incremental_input_entry_reader): Import symbolic constants from
2025         Incremental_inputs_reader; use them.
2026
2027 2012-04-23  David S. Miller  <davem@davemloft.net>
2028
2029         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2030         and elf_flags_set_.
2031         (Target_sparc::Target_sparc): Initialize new fields.
2032         (Target_sparc::do_make_elf_object): New function.
2033         (Target_sparc::do_adjust_elf_header): New function.
2034
2035 2012-04-23  Cary Coutant  <ccoutant@google.com>
2036
2037         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2038         CU range table of gdb index.
2039
2040 2012-04-20  David S. Miller  <davem@davemloft.net>
2041
2042         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2043         instead of false.
2044
2045 2012-04-16  David S. Miller  <davem@davemloft.net>
2046
2047         * sparc.cc (Target_sparc::got_address): New function.
2048         (Sparc_relocate_functions::gdop_hix22): New function.
2049         (Sparc_relocate_functions::gdop_lox10): New function.
2050         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2051         relocs.
2052         (Target_sparc::Scan::local): Likewise if the global symbol is not
2053         preemptible and is not IFUNC.
2054         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2055         transformations for local and non-preemptible non-IFUNC global
2056         symbols.
2057
2058         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2059         writing out 64-bit part of ranges.
2060
2061         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2062         -fpic and -fpie respectively.
2063         * Makefile.in: Regenerate.
2064
2065         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2066         (Target_sparc::Target_sparc): Initialize new field.
2067         (Target_sparc::do_plt_section_for_global): New function.
2068         (Target_sparc::do_plt_section_for_local): New function.
2069         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2070         (Target_sparc::make_plt_section): New function, broken out of
2071         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2072         (Target_sparc::make_plt_entry): Call make_plt_section.
2073         (Target_sparc::make_local_ifunc_plt_entry): New function.
2074         (Target_sparc::rela_ifunc_section): New function.
2075         (Target_sparc::plt_section): Remove const.
2076         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2077         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2078         and ifunc_count_ fields.
2079         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2080         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2081         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2082         (Output_data_plt_sparc::rela_ifunc): New function.
2083         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2084         (Output_data_plt_sparc::has_ifunc_section): New function.
2085         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2086         (Output_data_plt_sparc::address_for_global): New function.
2087         (Output_data_plt_sparc::address_for_local): New function.
2088         (Output_data_plt_sparc::plt_index_to_offset): New function.
2089         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2090         and entry_count.
2091         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2092         entry_count.
2093         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2094         R_SPARC_JMP_IREL to switch.
2095         (Target_sparc::Scan::check_non_pic): Likewise.
2096         (Target_sparc::Scan::local): Handle IFUNC symbols.
2097         (Target_sparc::Scan::local): Likewise.
2098         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2099         and plt_address_for_local.
2100         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2101         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2102
2103         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2104         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2105         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2106         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2107         global relocs too.
2108         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2109         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2110         calls.
2111         * sparc.cc (Target_sparc::Scan::global): Likewise.
2112         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2113
2114 2012-04-16  Cary Coutant  <ccoutant@google.com>
2115
2116         * archive.cc (Library_base::should_include_member): Check for
2117         --export-dynamic-symbol.
2118         * options.h (class General_options): Add --export-dynamic-symbol.
2119         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2120         --export-dynamic-symbol.
2121         (Symbol_table::gc_mark_undef_symbols): Likewise.
2122         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2123
2124 2012-04-12  David S. Miller  <davem@davemloft.net>
2125
2126         * sparc.cc (Reloc::wdisp10): New relocation method.
2127         (Reloc::h34): Likewise.
2128         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2129         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2130         R_SPARC_WDISP10.
2131         (Target_sparc::Scan::local): Likewise.
2132         (Target_sparc::Scan::global): Likewise.
2133         (Target_sparc::Relocate::relocate): Likewise.
2134
2135 2012-04-09  Cary Coutant  <ccoutant@google.com>
2136
2137         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2138         low_pc == 0.
2139
2140 2012-04-06  Ian Lance Taylor  <iant@google.com>
2141
2142         * timer.cc: #include <unistd.h>.
2143
2144 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2145
2146         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2147         * config.in: Regenerate.
2148         * configure: Regenerate.
2149
2150 2012-04-05  Nick Clifton  <nickc@redhat.com>
2151
2152         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2153         (AM_LC_MESSAGES): Add.
2154         * aclocal.m4: Regenerate.
2155         * config.in: Regenerate.
2156         * configure: Regenerate.
2157
2158 2012-03-21  Cary Coutant  <ccoutant@google.com>
2159
2160         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2161         * Makefile.in: Regenerate.
2162         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2163         (Sized_elf_reloc_mapper::symbol_section): New function.
2164         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2165         (make_elf_reloc_mapper): New function.
2166         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2167         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2168         (Dwarf_abbrev_table::do_get_abbrev): New function.
2169         (Dwarf_ranges_table::read_ranges_table): New function.
2170         (Dwarf_ranges_table::read_range_list): New function.
2171         (Dwarf_pubnames_table::read_section): New function.
2172         (Dwarf_pubnames_table::read_header): New function.
2173         (Dwarf_pubnames_table::next_name): New function.
2174         (Dwarf_die::Dwarf_die): New function.
2175         (Dwarf_die::read_attributes): New function.
2176         (Dwarf_die::skip_attributes): New function.
2177         (Dwarf_die::set_name): New function.
2178         (Dwarf_die::set_linkage_name): New function.
2179         (Dwarf_die::attribute): New function.
2180         (Dwarf_die::string_attribute): New function.
2181         (Dwarf_die::int_attribute): New function.
2182         (Dwarf_die::uint_attribute): New function.
2183         (Dwarf_die::ref_attribute): New function.
2184         (Dwarf_die::child_offset): New function.
2185         (Dwarf_die::sibling_offset): New function.
2186         (Dwarf_info_reader::check_buffer): New function.
2187         (Dwarf_info_reader::parse): New function.
2188         (Dwarf_info_reader::do_parse): New function.
2189         (Dwarf_info_reader::do_read_string_table): New function.
2190         (Dwarf_info_reader::lookup_reloc): New function.
2191         (Dwarf_info_reader::get_string): New function.
2192         (Dwarf_info_reader::visit_compilation_unit): New function.
2193         (Dwarf_info_reader::visit_type_unit): New function.
2194         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2195         Sized_elf_reloc_mapper.
2196         (Sized_dwarf_line_info::symbol_section): Remove function.
2197         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2198         (Sized_dwarf_line_info::read_line_mappings): Remove object
2199         parameter, adjust callers.
2200         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2201         * dwarf_reader.h: Include <sys/types.h>.
2202         (class Track_relocs): Remove forward declaration.
2203         (class Elf_reloc_mapper): New class.
2204         (class Sized_elf_reloc_mapper): New class.
2205         (class Dwarf_abbrev_table): New class.
2206         (class Dwarf_range_list): New class.
2207         (class Dwarf_ranges_table): New class.
2208         (class Dwarf_pubnames_table): New class.
2209         (class Dwarf_die): New class.
2210         (class Dwarf_info_reader): New class.
2211         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2212         (Sized_dwarf_line_info::symbol_section): Remove member function.
2213         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2214         base class.
2215         * gdb-index.cc: New source file.
2216         * gdb-index.h: New source file.
2217         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2218         and .debug_types sections, call Layout::add_to_gdb_index.
2219         (Sized_relobj_incr::do_section_name): Implement.
2220         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2221         return type; Implement.
2222         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2223         return type.
2224         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2225         parameter list and return type.
2226         (Sized_incr_dynobj::do_section_contents): Likewise.
2227         * layout.cc: Include gdb-index.h.
2228         (Layout::Layout): Initialize gdb_index_data_.
2229         (Layout::init_fixed_output_section): Check for .gdb_index section.
2230         (Layout::add_to_gdb_index): New function. Instantiate.
2231         * layout.h: Add forward declaration for class Gdb_index.
2232         (Layout::add_to_gdb_index): New member function.
2233         (Layout::gdb_index_data_): New data member.
2234         * main.cc: Include gdb-index.h.
2235         (main): Print statistics for gdb index.
2236         * object.cc (Object::section_contents): Move code into
2237         do_section_contents.
2238         (need_decompressed_section): Check for sections needed when building
2239         gdb index.
2240         (build_compressed_section_map): Likewise.
2241         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2242         gdb index.
2243         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2244         sections; call Layout::add_to_gdb_index.
2245         (Sized_relobj_file::do_decompressed_section_contents): Call
2246         do_section_contents directly.
2247         * object.h (Object::do_section_contents): Adjust parameter list and
2248         return type.
2249         (Object::do_decompressed_section_contents): Call do_section_contents
2250         directly.
2251         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2252         return type.
2253         * options.h (class General_options): Add --gdb-index option.
2254         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2255         list and return type.
2256         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2257         * reloc.h (Track_relocs::checkpoint): New function.
2258         (Track_relocs::reset): New function.
2259
2260         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2261         New test cases.
2262         * testsuite/Makefile.in: Regenerate.
2263         * testsuite/gdb_index_test.cc: New test source file.
2264         * testsuite/gdb_index_test_1.sh: New test source file.
2265         * testsuite/gdb_index_test_2.sh: New test source file.
2266
2267 2012-03-19  Doug Kwan  <dougkwan@google.com>
2268
2269         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2270         (Target_arm::do_finalize_sections): Remove code which defines
2271         __exidx_start and __exidx_end.  Make symbol table parameter
2272         anonymous as it is not used.
2273         * gold.cc (queue_middle_tasks): Call target hook to define any
2274         target-specific symbols.
2275         * target.h (Target::define_standard_symbols): New method.
2276         (Target::do_define_standard_symbols): Same.
2277         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2278         * testsuite/Makefile.in: Regenerate.
2279         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2280         and __exidx_end.
2281         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2282         relocations are generated for __exidx_start and __exidx_end.
2283
2284 2012-03-16  Doug Kwan  <dougkwan@google.com>
2285
2286         * testsuite/Makefile.am: Disable test initpri3b.
2287         * testsuite/Makefile.in: Regenerate.
2288
2289 2012-03-15  Doug Kwan  <dougkwan@google.com>
2290
2291         * arm.cc (Target_arm::got_section): Make .got section read-only
2292         if -z now is given.
2293
2294 2012-03-15  Ian Lance Taylor  <iant@google.com>
2295
2296         PR gold/13850
2297         * layout.cc (Layout::make_output_section): Correctly mark
2298         SHT_INIT_ARRAY, et. al., as relro.
2299
2300 2012-03-14  Doug Kwan  <dougkwan@google.com>
2301
2302         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2303         dynamic relocations for protected symbols in shared objects.
2304
2305 2012-03-13  Ian Lance Taylor  <iant@google.com>
2306
2307         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2308         keep the larger alignment.
2309
2310 2012-03-12  Cary Coutant  <ccoutant@google.com>
2311
2312         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2313         handling of DW_LNE_define_file.
2314
2315 2012-03-12  Cary Coutant  <ccoutant@google.com>
2316
2317         * reduced_debug_output.cc
2318         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2319         codes to switch.
2320
2321 2012-02-29  Cary Coutant  <ccoutant@google.com>
2322
2323         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2324
2325 2012-02-29  Cary Coutant  <ccoutant@google.com>
2326
2327         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2328         Call Object::decompressed_section_contents.
2329         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2330         New dtor.
2331         (Sized_dwarf_line_info::buffer_start_): New data member.
2332         * merge.cc (Output_merge_data::do_add_input_section): Call
2333         Object::decompressed_section_contents.
2334         (Output_merge_string::do_add_input_section): Likewise.
2335         * object.cc (need_decompressed_section): New function.
2336         (build_compressed_section_map): Decompress sections needed later.
2337         (Sized_relobj_file::do_decompressed_section_contents): New function.
2338         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2339         * object.h (Object::decompressed_section_contents): New function.
2340         (Object::discard_decompressed_sections): New function.
2341         (Object::do_decompressed_section_contents): New function.
2342         (Object::do_discard_decompressed_sections): New function.
2343         (Compressed_section_info): New type.
2344         (Compressed_section_map): Include decompressed section contents.
2345         (Sized_relobj_file::do_decompressed_section_contents): New function.
2346         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2347
2348 2012-02-16  Cary Coutant  <ccoutant@google.com>
2349
2350         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2351         * testsuite/Makefile.in: Regenerate.
2352
2353 2012-02-14  Cary Coutant  <ccoutant@google.com>
2354
2355         * options.cc (General_options::finalize): Disallow -pie and -static.
2356
2357 2012-02-03  Doug Kwan  <dougkwan@google.com>
2358
2359         * arm.cc (Arm_relocate_functions::abs8,
2360         Arm_relocate_functions::abs16): Use
2361         Bits::has_signed_unsigned_overflow32.
2362         (Arm_relocate_functions::thm_abs8): Correct range of
2363         overflow check.
2364         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2365         in assertions.
2366
2367 2012-02-02  Doug Kwan  <dougkwan@google.com>
2368
2369         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2370         position independent outputs, not just shared objects.
2371
2372 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2373
2374         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2375         * configure: Regenerated.
2376
2377 2012-01-27  Ian Lance Taylor  <iant@google.com>
2378
2379         * reloc.h (Bits): New class with static functions, copied from
2380         namespace utils in arm.cc.
2381         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2382         instead.
2383
2384 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2385
2386         * incremental.cc (write_info_blocks): Correct relocation offset.
2387
2388 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2389
2390         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2391         (Relocate::tls_gd_to_le): Likewise.
2392
2393 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2394
2395         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2396
2397 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2398
2399         * configure.ac: Check if -mcmodel=medium works.
2400         * configure: Regenerated.
2401
2402 2012-01-24  Cary Coutant  <ccoutant@google.com>
2403
2404         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2405         definition and ...
2406         (read_unsigned_LEB_128_x): ... this new function.
2407         (read_signed_LEB_128): Replaced with inline definition and ...
2408         (read_signed_LEB_128_x): ... this new function.
2409         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2410         (read_unsigned_LEB_128): Add inline definition.
2411         (read_signed_LEB_128_x): New function.
2412         (read_signed_LEB_128): Add inline definition.
2413         * testsuite/Makefile.am (leb128_unittest): New unit test.
2414         * testsuite/Makefile.in: Regenerate.
2415         * testsuite/leb128_unittest.cc: New unit test.
2416
2417 2012-01-23  Ian Lance Taylor  <iant@google.com>
2418
2419         PR gold/13617
2420         * i386.cc (Target_i386::do_code_fill): When using a jmp
2421         instruction, pad with nop instructions.
2422         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2423
2424 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2425
2426         * x86_64.cc (gc_process_relocs): Add typename on types used in
2427         template.
2428         (scan_relocs): Likewise.
2429         (relocate_section): Likewise.
2430         (apply_relocation): Likewise.
2431
2432 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2433
2434         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2435         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2436         under x32.
2437
2438 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2439
2440         * x86_64.cc: Initial support for x32.
2441
2442 2012-01-03  Cary Coutant  <ccoutant@google.com>
2443
2444         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2445         Use abstract base class for GOT.
2446         * gold/output.h (class Output_data_got_base): New abstract base class.
2447         (class Output_data_got): Derive from new base class, adjust ctors.
2448         (Output_data_got::reserve_slot): Make virtual; rename to
2449         do_reserve_slot; Adjust callers.
2450         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2451         pointer to abstract base class.
2452         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2453
2454 2011-12-18  Ian Lance Taylor  <iant@google.com>
2455
2456         * object.h (Relobj::local_symbol_value): New function.
2457         (Relobj::local_plt_offset): New function.
2458         (Relobj::local_has_got_offset): New function.
2459         (Relobj::local_got_offset): New function.
2460         (Relobj::set_local_got_offset): New function.
2461         (Relobj::do_local_symbol_value): New pure virtual function.
2462         (Relobj::do_local_plt_offset): Likewise.
2463         (Relobj::do_local_has_got_offset): Likewise.
2464         (Relobj::do_local_got_offset): Likewise.
2465         (Relobj::do_set_local_got_offset): Likewise.
2466         (Sized_relobj::do_local_has_got_offset): Rename from
2467         local_has_got_offset.
2468         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2469         (Sized_relobj::do_set_local_got_offset): Rename from
2470         set_local_got_offset.
2471         (Sized_relobj_file::do_local_plt_offset): Rename from
2472         local_plt_offset.
2473         (Sized_relobj_file::do_local_symbol_value): New function.
2474         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2475         local_plt_offset.
2476         * output.cc (Output_data_got::Got_entry::write): Change object to
2477         Relobj.  Use local_symbol_value.
2478         (Output_data_got::add_global_with_rel): Change rel_dyn to
2479         Output_data_reloc_generic*.  Use add_global_generic.
2480         (Output_data_got::add_global_with_rela): Remove.  Change all
2481         callers to use add_global_with_rel.
2482         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2483         Output_data_reloc_generic*.  Use add_global_generic.
2484         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2485         callers to use add_global_pair_with_rel.
2486         (Output_data_got::add_local): Change object to Relobj*.
2487         (Output_data_got::add_local_plt): Likewise.
2488         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2489         change rel_dyn to Output_data_reloc_generic*.  Use
2490         add_local_generic.
2491         (Output_data_got::add_local_with_rela): Remove.  Change all
2492         callers to use all_local_with_rel.
2493         (Output_data_got::add_local_pair_with_rel): Change object to
2494         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2495         add_output_section_generic.
2496         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2497         callers to use add_local_pair_with_rel.
2498         (Output_data_got::reserve_local): Change object to Relobj*.
2499         * output.h: (class Output_data_reloc_generic): Add pure virtual
2500         declarations for add_global_generic, add_local_generic,
2501         add_output_section_generic.
2502         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2503         functions for Output_data_reloc_generic.  Update declarations for
2504         changes listed in output.cc.
2505         (class Output_data_got): Change template parameter to got_size.
2506         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2507         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2508         function.
2509         (Sized_relobj_incr::do_local_plt_offset): New function.
2510         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2511         add_global_generic.
2512
2513 2011-12-17  Cary Coutant  <ccoutant@google.com>
2514
2515         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2516         * resolve.cc (Symbol_table::resolve): Likewise.
2517         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2518         arrays.
2519         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2520
2521 2011-12-16  Ian Lance Taylor  <iant@google.com>
2522
2523         * output.h (Output_data_reloc_generic::add): Only call
2524         add_dynamic_reloc if this is a dynamic reloc section.
2525
2526 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2527
2528         PR gold/13505
2529         * target-reloc.h (apply_relocation): Replace <64, false> with
2530         <size, big_endian>.
2531
2532 2011-11-25  Nick Clifton  <nickc@redhat.com>
2533
2534         * po/it.po: New Italian translation.
2535
2536 2011-11-17  Sterling Augustine  <saugustine@google.com>
2537
2538         * script.cc (script_include_directive): Implement.
2539         (read_script_file): New local variables name and search_path. Update
2540         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2541         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2542         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2543
2544 2011-11-11  Sterling Augustine  <saugustine@google.com>
2545
2546         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2547         (file_or_sections_cmd): Likewise.
2548
2549 2011-11-11  Doug Kwan  <dougkwan@google.com>
2550
2551         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2552         if --just-symbols is given.
2553
2554 2011-11-10  Doug Kwan  <dougkwan@google.com>
2555
2556         PR gold/13362
2557         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2558         when processing data relocs.
2559         * reloc.h (Relocate_functions::rel_unaligned): New method.
2560         (Relocate_functions::pcrel_unaligned): Ditto.
2561         (Relocate_functions::rel32_unaligned): Ditto.
2562         (Relocate_functions::pcrel32_unaligned): Ditto.
2563
2564 2011-11-09  Doug Kwan  <dougkwan@google.com>
2565
2566         PR gold/13362
2567         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2568         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2569         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2570         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2571         (Relocate_functions::rel_unaligned): New.
2572         (Relocate_functions::rel32_unaligned): New.
2573         * target-reloc.h (relocate_for_relocatable): Add code to handle
2574         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2575         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2576         arm_unaligned_reloc_r): New targets.
2577         * testsuite/Makefile.in: Regenerate.
2578         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2579         linking.
2580
2581 2011-11-02  Ian Lance Taylor  <iant@google.com>
2582
2583         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2584         NATIVE_LINKER.
2585         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2586         * options.cc (General_options::finalize): Use library search path
2587         from configure script if specified.  If not native and no sysroot,
2588         only search TOOLLIBDIR.
2589         * options.h (Search_directory::Search_directory): Change name to
2590         const std::string&.
2591         (General_options::add_to_library_path_with_sysroot): Change arg to
2592         const std::string&.
2593         * configure, Makefile.in, config.in: Rebuild.
2594
2595 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2596
2597         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2598         we are working around the ARM1176 Erratum.
2599         * options.h (General_options::fix_arm1176): Add option.
2600         * testsuite/Makefile.am: Add testcases, and keep current ones
2601         working.
2602         * testsuite/Makefile.in: Regenerate.
2603         * testsuite/arm_fix_1176.s: New file.
2604         * testsuite/arm_fix_1176.sh: Likewise.
2605
2606 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2607
2608         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2609         may_use_blx_.
2610         (Target_arm::may_use_blx): Remove method.
2611         (Target_arm::set_may_use_blx): Likewise.
2612         (Target_arm::may_use_v4t_interworking): New method.
2613         (Target_arm::may_use_v5t_interworking): Likewise.
2614         (Target_arm::may_use_blx_): Remove member variable.
2615         (Arm_relocate_functions::arm_branch_common): Check for v5T
2616         interworking.
2617         (Arm_relocate_functions::thumb_branch_common): Likewise.
2618         (Reloc_stub::stub_type_for_reloc): Likewise.
2619         (Target_arm::do_finalize_sections): Correct interworking checks.
2620         * testsuite/Makefile.am: Add new tests.
2621         * testsuite/Makefile.in: Regenerate.
2622         * testsuite/arm_farcall_arm_arm.s: New test.
2623         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2624         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2625         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2626         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2627         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2628         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2629         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2630
2631 2011-10-31  Cary Coutant  <ccoutant@google.com>
2632
2633         PR gold/13023
2634         * expression.cc (Expression::eval_with_dot): Add
2635         is_section_dot_assignment parameter.
2636         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2637         absolute and assigning to dot within a section.
2638         * script-sections.cc
2639         (Output_section_element_assignment::set_section_addresses): Pass
2640         dot_section to set_if_absolute.
2641         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2642         as is_section_dot_assignment flag to eval_with_dot.
2643         (Output_section_element_dot_assignment::set_section_addresses):
2644         Likewise.
2645         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2646         parameter.  Also set value if relative to dot_section; set the
2647         symbol's output_section.
2648         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2649         parameter.  Adjust all callers.
2650         (Expression::eval_maybe_dot): Likewise.
2651         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2652         Adjust all callers.
2653         * testsuite/script_test_2.t: Test assignment of an absolute value
2654         to dot within an output section element.
2655
2656 2011-10-31  Cary Coutant  <ccoutant@google.com>
2657
2658         * options.h (class General_options): Add --[no-]gnu-unique options.
2659         * symtab.cc (Symbol_table::sized_write_globals): Convert
2660         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2661
2662 2011-10-31  Cary Coutant  <ccoutant@google.com>
2663
2664         PR gold/13359
2665         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2666         unnecessary assertion.
2667         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2668
2669 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2670
2671         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2672         gc_mark_symbol.
2673         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2674         gc_mark_symbol.
2675         Change to just keep the section associated with symbol.
2676         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2677         they are externally visible and --export-dynamic is turned on.
2678         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2679
2680 2011-10-19  Ian Lance Taylor  <iant@google.com>
2681
2682         PR gold/13163
2683         * script-sections.cc
2684         (Output_section_element_dot_assignment::needs_output_section): New
2685         function.
2686
2687 2011-10-19  Ian Lance Taylor  <iant@google.com>
2688
2689         PR gold/13204
2690         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2691         --section-start option was seen.
2692         * options.h (General_options::any_section_start): New function.
2693
2694 2011-10-18  David S. Miller  <davem@davemloft.net>
2695
2696         PR binutils/13301
2697         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2698         member to track relocation locations that have moved during TLS
2699         reloc optimizations.
2700         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2701         (Target_sparc::Relocate::relocate): Adjust view down by 4
2702         bytes if it matches reloc_adjust_addr_.
2703         (Target_sparc::Relocate::relocate_tls): Always move the
2704         __tls_get_addr call delay slot instruction forward 4 bytes when
2705         performing relaxation.
2706
2707 2011-10-18  Cary Coutant  <ccoutant@google.com>
2708
2709         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2710         (Output_file::map_no_anonymous): Check for non-zero
2711         return code from posix_fallocate.
2712
2713 2011-10-17  Cary Coutant  <ccoutant@google.com>
2714
2715         PR gold/13245
2716         * plugin.cc (is_visible_from_outside): Check for symbols
2717         referenced from dynamic objects.
2718         * resolve.cc (Symbol_table::resolve): Don't count references
2719         from dynamic objects as references from real ELF files.
2720         * testsuite/plugin_test_2.sh: Adjust expected result.
2721
2722 2011-10-17  Cary Coutant  <ccoutant@google.com>
2723
2724         * gold.cc: Include timer.h.
2725         (queue_middle_tasks): Stamp time.
2726         (queue_final_tasks): Likewise.
2727         * main.cc (main): Store timer in parameters.  Print timers
2728         for each pass.
2729         * parameters.cc (Parameters::Parameters): Initialize timer_.
2730         (Parameters::set_timer): New function.
2731         (set_parameters_timer): New function.
2732         * parameters.h (Parameters::set_timer): New function.
2733         (Parameters::timer): New function.
2734         (Parameters::timer_): New data member.
2735         (set_parameters_timer): New function.
2736         * timer.cc (Timer::stamp): New function.
2737         (Timer::get_pass_time): New function.
2738         * timer.h (Timer::stamp): New function.
2739         (Timer::get_pass_time): New function.
2740         (Timer::pass_times_): New data member.
2741
2742 2011-10-17  Cary Coutant  <ccoutant@google.com>
2743
2744         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2745         task for members of lib groups.
2746
2747 2011-10-17  Cary Coutant  <ccoutant@google.com>
2748
2749         PR gold/13288
2750         * fileread.cc (File_read::find_view): Add assert.
2751         (File_read::make_view): Move bounds check (replace with assert)...
2752         (File_read::find_or_make_view): ... to here.
2753
2754 2011-10-12  Cary Coutant  <ccoutant@google.com>
2755
2756         * output.cc (Output_file::open_base_file): Handle case where
2757         ::read returns less than requested size.
2758
2759 2011-10-10  Cary Coutant  <ccoutant@google.com>
2760
2761         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2762         Initialize defined_count_.
2763         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2764         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2765         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2766         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2767         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2768         * incremental.h (Sized_relobj_incr::defined_count_): New data
2769         member.
2770         (Sized_incr_dynobj::defined_count_): New data member.
2771         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2772         Return zeroes instead of internal error.
2773
2774 2011-10-10  Cary Coutant  <ccoutant@google.com>
2775
2776         PR gold/13249
2777         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2778         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2779         * output.h (class Output_reloc): Add use_plt_offset flag.
2780         (Output_reloc::type_): Adjust size of bit field.
2781         (Output_reloc::use_plt_offset_): New bit field.
2782         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2783         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2784         flag.  Adjust all callers.
2785         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2786         creating RELATIVE relocations.
2787
2788 2011-10-10  Nick Clifton  <nickc@redhat.com>
2789
2790         * po/es.po: Updated Spanish translation.
2791         * po/fi.po: Updated Finnish translation.
2792
2793 2011-10-03   Diego Novillo  <dnovillo@google.com>
2794
2795         * options.cc (parse_uint): Fix dereference of RETVAL.
2796
2797 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2798
2799         * layout.h (section_order_map_): New member.
2800         (get_section_order_map): New member function.
2801         * output.cc (Output_section::add_input_section): Check for patterns
2802         only when --section-ordering-file is specified.
2803         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2804         output_sections have been formed.
2805         * layout.cc (Layout_Layout): Initialize section_order_map_.
2806         * plugin.cc (update_section_order): Store order in order_map. Do not
2807         update the order.
2808         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2809         * testsuite/Makefile.in: Regenerate.
2810         * testsuite/plugin_section_order.c: New file.
2811         * testsuite/plugin_final_layout.cc: New file.
2812         * testsuite/plugin_final_layout.sh: New file.
2813
2814 2011-09-29  Cary Coutant  <ccoutant@google.com>
2815
2816         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2817         Check for NULL.
2818         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2819         symbols during incremental update.
2820         (Symbol_table::add_from_dynobj): Likewise.
2821
2822 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2823             Ian Lance Taylor  <iant@google.com>
2824
2825         * symtab.cc (Symbol_table::define_special_symbol): Always
2826         canonicalize version string.
2827
2828 2011-09-26  Cary Coutant  <ccoutant@google.com>
2829
2830         * gold.cc (queue_initial_tasks): Move option checks ...
2831         * options.cc (General_options::finalize): ... to here. Disable
2832         some options; make others fatal.
2833
2834 2011-09-26  Cary Coutant  <ccoutant@google.com>
2835
2836         gcc PR lto/47247
2837         * plugin.cc (get_symbols_v2): New function.
2838         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2839         (is_referenced_from_outside): New function.
2840         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2841         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2842         (get_symbols): Pass version parameter.
2843         (get_symbols_v2): New function.
2844         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2845         parameter.
2846         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2847         (onload): Add LDPT_GET_SYMBOLS_V2.
2848         (all_symbols_read_hook): Use get_symbols_v2; check for
2849         LDPR_PREVAILING_DEF_IRONLY_EXP.
2850         * testsuite/plugin_test_3.sh: Update expected results.
2851
2852 2011-09-23  Simon Baldwin  <simonb@google.com>
2853
2854         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2855         configuration options.
2856         * configure: Regenerate.
2857         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2858         * Makefile.in: Regenerate.
2859         * testsuite/Makefile.in: Regenerate.
2860
2861 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2862
2863         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2864
2865 2011-09-19  Cary Coutant  <ccoutant@google.com>
2866
2867         * incremental.cc (can_incremental_update): Fix typo in comment.
2868         * incremental.h (can_incremental_update): Likewise.
2869
2870 2011-09-18  Cary Coutant  <ccoutant@google.com>
2871
2872         * incremental.cc (can_incremental_update): New function.
2873         * incremental.h (can_incremental_update): New function.
2874         * layout.cc (Layout::init_fixed_output_section): Call it.
2875         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2876         * object.cc (Sized_relobj_file::do_layout): Call
2877         can_incremental_update.
2878
2879 2011-09-13  Cary Coutant  <ccoutant@google.com>
2880
2881         * configure.ac: Check for glibc support for gnu_indirect_function
2882         support with static linking, setting automake conditional
2883         IFUNC_STATIC.
2884         * Makefile.in: Regenerate.
2885         * configure: Regenerate.
2886
2887         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2888         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2889         for IFUNC_STATIC.
2890         * testsuite/Makefile.in: Regenerate.
2891
2892 2011-09-13  Cary Coutant  <ccoutant@google.com>
2893
2894         * incremental.cc (Sized_relobj_incr::do_layout): Call
2895         report_comdat_group for kept comdat sections.
2896         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2897         * testsuite/Makefile.in: Regenerate.
2898         * testsuite/incr_comdat_test_1.cc: New source file.
2899         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2900         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2901         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2902
2903 2011-09-13  Ian Lance Taylor  <iant@google.com>
2904
2905         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2906         variable external_symbols_offset.
2907
2908 2011-09-12  Ian Lance Taylor  <iant@google.com>
2909
2910         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2911         triggered if object has no symbols.
2912
2913 2011-09-09  David S. Miller  <davem@davemloft.net>
2914
2915         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2916         (Output_fill_debug_line::do_write): Likewise.
2917
2918 2011-08-29  Cary Coutant  <ccoutant@google.com>
2919
2920         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2921         casts to match formatting specs.
2922         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2923
2924 2011-08-26  Cary Coutant  <ccoutant@google.com>
2925
2926         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2927         remaining hole size when allocating.
2928         (Layout::make_output_section): Set fill methods for debug sections.
2929         * layout.h (Free_list::Free_list_node): Move from private to
2930         public.
2931         (Free_list::set_min_hole_size): New function.
2932         (Free_list::begin, Free_list::end): New functions.
2933         (Free_list::min_hole_): New data member.
2934         * output.cc: Include dwarf.h.
2935         (Output_fill_debug_info::do_minimum_hole_size): New function.
2936         (Output_fill_debug_info::do_write): New function.
2937         (Output_fill_debug_line::do_minimum_hole_size): New function.
2938         (Output_fill_debug_line::do_write): New function.
2939         (Output_section::Output_section): Initialize new data member.
2940         (Output_section::set_final_data_size): Ensure patch space is larger
2941         than minimum hole size.
2942         (Output_section::do_write): Fill holes in debug sections.
2943         * output.h (Output_fill): New class.
2944         (Output_fill_debug_info): New class.
2945         (Output_fill_debug_line): New class.
2946         (Output_section::set_free_space_fill): New function.
2947         (Output_section::free_space_fill_): New data member.
2948         * testsuite/Makefile.am (incremental_test_3): Add
2949         --incremental-patch option.
2950         (incremental_test_4): Likewise.
2951         (incremental_test_5): Likewise.
2952         (incremental_test_6): Likewise.
2953         (incremental_copy_test): Likewise.
2954         (incremental_common_test_1): Likewise.
2955         * testsuite/Makefile.in: Regenerate.
2956
2957 2011-08-26  Nick Clifton  <nickc@redhat.com>
2958
2959         * po/es.po: Updated Spanish translation.
2960
2961 2011-08-01  Cary Coutant  <ccoutant@google.com>
2962
2963         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2964         * gold/testsuite/Makefile.in: Regenerate.
2965         * gold/testsuite/justsyms_exec.c: New source file.
2966         * gold/testsuite/justsyms_lib.c: New source file.
2967
2968 2011-08-01  Cary Coutant  <ccoutant@google.com>
2969
2970         * layout.cc (Layout::set_segment_offsets): Don't realign text
2971         segment if -Ttext was specified.
2972         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2973         file type.
2974         * object.h (Sized_relobj_file::e_type): New function.
2975         (Sized_relobj_file::e_type_): New data member.
2976         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2977         base address for ET_EXEC files.
2978         * target.cc (Target::do_make_elf_object_implementation): Allow
2979         ET_EXEC files with --just-symbols option.
2980
2981 2011-07-28  Cary Coutant  <ccoutant@google.com>
2982
2983         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2984         Add thread_number parameter.
2985         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2986         * workqueue-threads.cc
2987         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2988         current thread if its thread number is greater than desired thread
2989         count.
2990         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2991         Add thread_number parameter.
2992         (Workqueue::should_cancel_thread): Likewise.
2993         (Workqueue::find_runnable_or_wait): Pass thread_number to
2994         should_cancel_thread.
2995         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2996         parameter.
2997
2998 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2999
3000         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3001         only after checking if it cannot be forced local.
3002         * symtab.h (is_externally_visible): Check if the symbol is not forced
3003         local.
3004
3005 2011-07-15  Ian Lance Taylor  <iant@google.com>
3006
3007         * options.h (class General_options): Add --print-output-format.
3008         Move -EL next to -EB, for  better --help output.
3009         * target-select.cc: Include <cstdio>, "options.h", and
3010         "parameters.h".
3011         (Target_selector::do_target_bfd_name): New function.
3012         (print_output_format): New function.
3013         * target-select.h (class Target_selector): Update declarations.
3014         (Target_selector::target_bfd_name): New function.
3015         (print_output_format): Declare.
3016         * main.cc: Include "target-select.h".
3017         (main): Handle --print-output-format.
3018         * gold.cc: Include "target-select.h".
3019         (queue_initial_tasks): Handle --print-output-format when there are
3020         no input files.
3021         * parameters.cc (parameters_force_valid_target): Give a better
3022         error message if -EB/-EL does not match target.
3023         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3024         function.
3025
3026 2011-07-15  Ian Lance Taylor  <iant@google.com>
3027
3028         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3029         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3030         (Output_data_plt_i386::do_write): Write address of .dynamic
3031         section to first entry in .got.plt section.
3032         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3033         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3034         Initialize layout_.
3035         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3036         section to first entry in .got.plt section.
3037         * layout.h (Layout::dynamic_section): New function.
3038
3039 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3040
3041         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3042         to claim_file call.
3043         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3044         input_section_position_, and input_section_glob_.
3045         (read_layout_from_file): Call function section_ordering_specified.
3046         * layout.h (is_section_ordering_specified): New function.
3047         (section_ordering_specified): New function.
3048         (section_ordering_specified_): New boolean member.
3049         * main.cc(main): Call load_plugins after layout object is defined.
3050         * output.cc (Output_section::add_input_section): Use
3051         function section_ordering_specified to check if section ordering is
3052         needed.
3053         * output.cc (Output_section::add_relaxed_input_section): Use
3054         function section_ordering_specified to check if section ordering is
3055         needed.
3056         (Output_section::update_section_layout): New function.
3057         (Output_section::sort_attached_input_sections): Check if input section
3058         must be reordered.
3059         * output.h (Output_section::update_section_layout): New function.
3060         * plugin.cc (get_section_count): New function.
3061         (get_section_type): New function.
3062         (get_section_name): New function.
3063         (get_section_contents): New function.
3064         (update_section_order): New function.
3065         (allow_section_ordering): New function.
3066         (Plugin::load): Add the new interfaces to the transfer vector.
3067         (Plugin_manager::load_plugins): New parameter.
3068         (Plugin_manager::all_symbols_read): New parameter.
3069         (Plugin_manager::claim_file): New parameter. Save the elf object for
3070         unclaimed objects.
3071         (Plugin_manager::get_elf_object): New function.
3072         (Plugin_manager::get_view): Change to directly use the bool to check
3073         if get_view is called from claim_file_hook.
3074         * plugin.h (input_objects): New function
3075         (Plugin__manager::load_plugins): New parameter.
3076         (Plugin_manager::claim_file): New parameter.
3077         (Plugin_manager::get_elf_object): New function.
3078         (Plugin_manager::in_claim_file_handler): New function.
3079         (Plugin_manager::in_claim_file_handler_): New member.
3080         (layout): New function.
3081         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3082         handler with an extra parameter. Make the elf object before calling
3083         claim_file handler.
3084         * testsuite/plugin_test.c (get_section_count): New function pointer.
3085         (get_section_type): New function pointer.
3086         (get_section_name): New function pointer.
3087         (get_section_contents): New function pointer.
3088         (update_section_order): New function pointer.
3089         (allow_section_ordering): New function pointer.
3090         (onload): Check if the new interfaces exist.
3091
3092 2011-07-13  Ian Lance Taylor  <iant@google.com>
3093
3094         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3095         relro section.
3096         * x86_64.cc (Target_x86_64::got_section): Likewise.
3097         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3098         (relro_now_test_SOURCES): New variable.
3099         (relro_now_test_DEPENDENCIES): New variable.
3100         (relro_now_test_LDFLAGS): New variable.
3101         (relro_now_test_LDADD): New variable.
3102         (relro_now_test.so): New target.
3103         * testsuite/Makefile.in: Rebuild.
3104
3105 2011-07-12  Ian Lance Taylor  <iant@google.com>
3106
3107         PR gold/12980
3108         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3109         GLOB_DAT relocation rather than a RELATIVE relocation for a
3110         protected symbol when creating a shared library.
3111         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3112         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3113         * testsuite/protected_main_1.cc (main): Test that protected
3114         function has same address.
3115
3116 2011-07-11  Ian Lance Taylor  <iant@google.com>
3117
3118         PR gold/12979
3119         * options.h (class General_options): Add -Bgroup.
3120         * options.cc (General_options::finalize): If -Bgroup is set,
3121         default to --unresolved-symbols=report-all.
3122         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3123         * target-reloc.h (issue_undefined_symbol_error): Handle
3124         --unresolved-symbols=report-all.
3125
3126 2011-07-08  Ian Lance Taylor  <iant@google.com>
3127
3128         PR gold/11985
3129         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3130         if linker script discards key sections.
3131         (Layout::create_dynamic_symtab): Likewise.
3132         (Layout::assign_local_dynsym_offsets): Likewise.
3133         (Layout::sized_create_version_sections): Likewise.
3134         (Layout::create_interp): Likewise.
3135         (Layout::finish_dynamic_section): Likewise.
3136         (Layout::set_dynamic_symbol_size): Likewise.
3137
3138 2011-07-08  Ian Lance Taylor  <iant@google.com>
3139
3140         PR gold/12386
3141         * options.h (class General_options): Add --unresolved-symbols.
3142         * target-reloc.h (issue_undefined_symbol_error): Check
3143         --unresolved-symbols.  Add comments.
3144
3145 2011-07-08  Ian Lance Taylor  <iant@google.com>
3146
3147         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3148         expression more complex.
3149
3150 2011-07-08  Ian Lance Taylor  <iant@google.com>
3151
3152         PR gold/11317
3153         * target-reloc.h (issue_undefined_symbol_error): New inline
3154         function, broken out of relocate_section.
3155         (relocate_section): Call issue_undefined_symbol_error.
3156         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3157         there is no TLS segment if we are about to issue an undefined
3158         symbol error.
3159         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3160
3161 2011-07-08  Ian Lance Taylor  <iant@google.com>
3162
3163         PR gold/12279
3164         * resolve.cc (Symbol_table::should_override): Add fromtype
3165         parameter.  Change all callers.  Give error when linking together
3166         TLS and non-TLS symbol.
3167         (Symbol_table::should_override_with_special): Add fromtype
3168         parameter.  Change all callers.
3169         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3170         there is no TLS segment if we have reported some errors.
3171         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3172
3173 2011-07-08  Ian Lance Taylor  <iant@google.com>
3174
3175         PR gold/12372
3176         * target.h (Target::plt_address_for_global): New function.
3177         (Target::plt_address_for_local): New function.
3178         (Target::plt_section_for_global): Remove.
3179         (Target::plt_section_for_local): Remove.
3180         (Target::do_plt_address_for_global): New virtual function.
3181         (Target::do_plt_address_for_local): New virtual function.
3182         (Target::do_plt_section_for_global): Remove.
3183         (Target::do_plt_section_for_local): Remove.
3184         (Target::register_global_plt_entry): Add Symbol_table and Layout
3185         parameters.
3186         * output.cc (Output_data_got::Got_entry::write): Use
3187         plt_address_for_global and plt_address_for_local.
3188         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3189         address of output section.
3190         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3191         got_irelative_, and irelative_count_ fields.  Update
3192         declarations.
3193         (Output_data_plt_i386::has_irelative_section): New function.
3194         (Output_data_plt_i386::entry_count): Add irelative_count_.
3195         (Output_data_plt_i386::set_final_data_size): Likewise.
3196         (class Target_i386): Add got_irelative_ and rel_irelative_
3197         fields.  Update declarations.
3198         (Target_i386::Target_i386): Initialize new fields.
3199         (Target_i386::do_plt_address_for_global): New function replacing
3200         do_plt_section_for_global.
3201         (Target_i386::do_plt_address_for_local): New function replacing
3202         do_plt_section_for_local.
3203         (Target_i386::got_section): Create got_irelative_.
3204         (Target_i386::rel_irelative_section): New function.
3205         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3206         fields.  Don't define __rel_iplt_{start,end}.
3207         (Output_data_plt_i386::add_entry): Add symtab and layout
3208         parameters.  Change all callers.  Use different PLT and GOT for
3209         IFUNC symbols.
3210         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3211         layout parameters.  Change all callers.  Use different PLT and
3212         GOT.
3213         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3214         (Output_data_plt_i386::rel_irelative): New function.
3215         (Output_data_plt_i386::address_for_global): New function.
3216         (Output_data_plt_i386::address_for_local): New function.
3217         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3218         IRELATIVE GOT when changing IFUNC GOT entries.
3219         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3220         reloc.
3221         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3222         if we didn't create an IRELATIVE GOT.
3223         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3224         plt_address_for_local.
3225         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3226         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3227         got_irelative_, and irelative_count_ fields.  Update
3228         declarations.
3229         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3230         Initialize new fields.  Remove symtab parameter.  Change all
3231         callers.
3232         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3233         irelative_count_.
3234         (Output_data_plt_x86_64::has_irelative_section): New function.
3235         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3236         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3237         fields.  Update declarations.
3238         (Target_x86_64::Target_x86_64): Initialize new fields.
3239         (Target_x86_64::do_plt_address_for_global): New function replacing
3240         do_plt_section_for_global.
3241         (Target_x86_64::do_plt_address_for_local): New function replacing
3242         do_plt_section_for_local.
3243         (Target_x86_64::got_section): Create got_irelative_.
3244         (Target_x86_64::rela_irelative_section): New function.
3245         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3246         all callers.  Don't create __rel_iplt_{start,end}.
3247         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3248         parameters.  Change all callers.  Use different PLT and GOT for
3249         IFUNC symbols.
3250         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3251         layout parameters.  Change all callers.  Use different PLT and
3252         GOT.
3253         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3254         parameters.  Change all callers.  Use different PLT and GOT for
3255         IFUNC symbols.
3256         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3257         (Output_data_plt_x86_64::rela_irelative): New function.
3258         (Output_data_plt_x86_64::address_for_global): New function.
3259         (Output_data_plt_x86_64::address_for_local): New function.
3260         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3261         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3262         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3263         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3264         parameters.
3265         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3266         reloc.
3267         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3268         symbols if we didn't create an IRELATIVE GOT.
3269         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3270         plt_address_for_local.
3271         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3272         * testsuite/ifuncvar1.c: New test file.
3273         * testsuite/ifuncvar2.c: New test file.
3274         * testsuite/ifuncvar3.c: New test file.
3275         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3276         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3277         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3278         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3279         * testsuite/Makefile.in: Rebuild.
3280
3281 2011-07-07  Cary Coutant  <ccoutant@google.com>
3282
3283         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3284         (two_file_test_1_ndebug.o): Likewise.
3285         (two_file_test_1b_ndebug.o): Likewise.
3286         (two_file_test_2_ndebug.o): Likewise.
3287         (two_file_test_main_ndebug.o): Likewise.
3288         (incremental_test_2): Link with no-debug versions.
3289
3290 2011-07-06  Cary Coutant  <ccoutant@google.com>
3291
3292         * gold/incremental.cc
3293         (Output_section_incremental_inputs::write_info_blocks): Check for
3294         hidden and internal symbols.
3295
3296 2011-07-06  Cary Coutant  <ccoutant@google.com>
3297
3298         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3299         Check disposition for startup file.
3300         (Incremental_inputs::report_command_line): Ignore
3301         --incremental-startup-unchanged option.
3302         * options.cc (General_options::parse_incremental_startup_unchanged):
3303         New function.
3304         (General_options::General_options): Initialize new data member.
3305         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3306         (General_options): Add --incremental-startup-unchanged option.
3307         (General_options::incremental_startup_disposition): New function.
3308         (General_options::incremental_startup_disposition_): New data member.
3309
3310 2011-07-06  Cary Coutant  <ccoutant@google.com>
3311
3312         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3313         input file index to Script_info ctor.
3314         (Sized_incremental_binary::do_file_has_changed): Find the
3315         command-line argument for files named in scripts.
3316         * incremental.h (Script_info::Script_info): New ctor
3317         with input file index.
3318         (Script_info::input_file_index): New function.
3319         (Script_info::input_file_index_): New data member.
3320         (Incremental_binary::get_library): Add const.
3321         (Incremental_binary::get_script_info): Add const.
3322         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3323         * testsuite/Makefile.am (incremental_test_5): New test case.
3324         (incremental_test_6): New test case.
3325         * testsuite/Makefile.in: Regenerate.
3326
3327 2011-07-06  Cary Coutant  <ccoutant@google.com>
3328
3329         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3330         debug output when command lines differ.
3331
3332 2011-07-06  Cary Coutant  <ccoutant@google.com>
3333
3334         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3335         --incremental-patch option.
3336         * layout.cc (Free_list::allocate): Extend allocation beyond original
3337         end if enabled.
3338         (Layout::make_output_section): Mark sections that should get
3339         patch space.
3340         * options.cc (parse_percent): New function.
3341         * options.h (parse_percent): New function.
3342         (DEFINE_percent): New macro.
3343         (General_options): Add --incremental-patch option.
3344         * output.cc (Output_section::Output_section): Initialize new data
3345         members.
3346         (Output_section::add_input_section): Print section name when out
3347         of patch space.
3348         (Output_section::add_output_section_data): Likewise.
3349         (Output_section::set_final_data_size): Add patch space when
3350         doing --incremental-full.
3351         (Output_section::do_reset_address_and_file_offset): Remove patch
3352         space.
3353         (Output_segment::set_section_list_addresses): Print debug output
3354         only if --incremental-update.
3355         * output.h (Output_section::set_is_patch_space_allowed): New function.
3356         (Output_section::is_patch_space_allowed_): New data member.
3357         (Output_section::patch_space_): New data member.
3358         * parameters.cc (Parameters::incremental_full): New function.
3359         * parameters.h (Parameters::incremental_full): New function
3360         * testsuite/Makefile.am (incremental_test_2): Add test for
3361         --incremental-patch option.
3362         * testsuite/Makefile.in: Regenerate.
3363         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3364         (t18): Remove function body.
3365
3366 2011-07-05  Doug Kwan  <dougkwan@google.com>
3367
3368         PR gold/12771
3369         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3370         Arm_Address type for relocation result.
3371         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3372         overflow check.
3373         (Arm_relocate_functions::abs32): Use unaligned access.
3374         (Arm_relocate_functions::rel32): Ditto.
3375         (Arm_relocate_functions::prel31): Ditto.
3376         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3377         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3378         static data relocations.
3379         * testsuite/Makefile.in: Regnerate.
3380         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3381
3382 2011-07-05  Ian Lance Taylor  <iant@google.com>
3383
3384         PR gold/12392
3385         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3386         symbols if necessary.
3387         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3388
3389 2011-07-05  Ian Lance Taylor  <iant@google.com>
3390
3391         PR gold/12952
3392         * resolve.cc (Symbol::override_base_with_special): Simply override
3393         version with special symbol version, ignoring previous version.
3394
3395 2011-07-05  Ian Lance Taylor  <iant@google.com>
3396
3397         * object.cc (Sized_relobj_file::include_section_group): Add
3398         information to comment about signature location.
3399
3400 2011-07-02  Ian Lance Taylor  <iant@google.com>
3401
3402         PR gold/12957
3403         * options.h (class General_options): Add -f and -F.
3404         * options.cc (General_options::finalize): Fatal error if -f/-F
3405         are used without -shared.
3406         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3407
3408 2011-07-02  Ian Lance Taylor  <iant@google.com>
3409
3410         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3411
3412 2011-07-01  Ian Lance Taylor  <iant@google.com>
3413
3414         PR gold/12525
3415         PR gold/12952
3416         * resolve.cc (Symbol::override_base_with_special): Don't override
3417         the version if the overriding symbol has a different name.
3418         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3419         all callers.  If we give an error about an undefined version,
3420         define the base version if necessary.
3421         * dynobj.h (class Versions): Update declaration.
3422         * testsuite/weak_alias_test_5.cc: New file.
3423         * testsuite/weak_alias_test.script: New file.
3424         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3425         and versioned_alias have the right value, and call t2.
3426         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3427         weak_alias_test_5.so.
3428         (weak_alias_test_LDADD): Likewise.
3429         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3430         * testsuite/Makefile.in: Rebuild.
3431
3432 2011-07-01  Ian Lance Taylor  <iant@google.com>
3433
3434         PR gold/12525
3435         * options.h (class General_options): Support -z notext.
3436         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3437         -Wl,-z,notext.
3438         (two_file_shared_nonpic.so): Likewise.
3439         (two_file_shared_mixed.so): Likewise.
3440         (two_file_shared_mixed_1.so): Likewise.
3441         (weak_undef_lib_nonpic.so): Likewise.
3442         (alt/weak_undef_lib_nonpic.so): Likewise.
3443         (tls_test_shared_nonpic.so): Likewise.
3444         * testsuite/Makefile.in: Rebuild.
3445
3446 2011-07-01  Ian Lance Taylor  <iant@google.com>
3447
3448         PR gold/12525
3449         * configure.ac: Test whether static linking works, setting
3450         the automake conditional HAVE_STATIC.
3451         * testsuite/Makefile.am: Disable tests using -static if
3452         HAVE_STATIC is not true.
3453         * configure, testsuite/Makefile.in: Rebuild.
3454
3455 2011-07-01  Ian Lance Taylor  <iant@google.com>
3456
3457         PR gold/12525
3458         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3459         Assert if we see DW_EH_PE_indirect.
3460         * target.h (Target::ehframe_datarel_base): New function.
3461         (Target::do_ehframe_datarel_base): New target function.
3462         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3463         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3464         function.
3465
3466 2011-07-01  Ian Lance Taylor  <iant@google.com>
3467
3468         PR gold/12571
3469         * options.h (class General_options): Add
3470         --ld-generated-unwind-info.
3471         * ehframe.cc (Fde::write): Add address parameter.  Change all
3472         callers.  If associated with PLT, fill in address and size.
3473         (Cie::set_output_offset): Only add merge mapping if there is an
3474         object.
3475         (Cie::write): Add address parameter.  Change all callers.
3476         (Eh_frame::add_ehframe_for_plt): New function.
3477         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3478         input_offset_ fields into union u_, with new plt field.
3479         (Fde::Fde): Adjust for new union field.
3480         (Fde::Fde) [Output_data version]: New constructor.
3481         (Fde::add_mapping): Only add merge mapping if there is an object.
3482         (class Cie): Update declarations.
3483         (class Eh_frame): Declare add_ehframe_for_plt.
3484         * layout.cc (Layout::layout_eh_frame): Break out code into
3485         make_eh_frame_section, and call it.
3486         (Layout::make_eh_frame_section): New function.
3487         (Layout::add_eh_frame_for_plt): New function.
3488         * layout.h (class Layout): Update declarations.
3489         * merge.cc (Merge_map::add_mapping): Add assertion.
3490         * i386.cc: Include "dwarf.h".
3491         (class Output_data_plt_i386): Make first_plt_entry,
3492         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3493         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3494         and plt_eh_frame_fde.
3495         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3496         boundary.  Call add_eh_frame_for_plt if appropriate.
3497         * x86_64.cc: Include "dwarf.h".
3498         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3499         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3500         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3501         and plt_eh_frame_fde.
3502         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3503         appropriate.
3504
3505 2011-06-29  Ian Lance Taylor  <iant@google.com>
3506
3507         PR gold/12629
3508         * object.cc (Sized_relobj_file::layout_section): Change shdr
3509         parameter to be const.
3510         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3511         out of do_layout.
3512         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3513         appropriate.  Call layout_eh_frame_section.
3514         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3515         sections.
3516         * object.h (class Sized_relobj_file): Update declarations.
3517
3518 2011-06-29  Ian Lance Taylor  <iant@google.com>
3519
3520         PR gold/12652
3521         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3522         modifier.
3523         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3524
3525 2011-06-29  Ian Lance Taylor  <iant@google.com>
3526
3527         PR gold/12675
3528         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3529         SHT_X86_64_UNWIND.
3530         * layout.cc (Layout::layout_eh_frame): Likewise.
3531
3532 2011-06-29  Ian Lance Taylor  <iant@google.com>
3533
3534         PR gold/12695
3535         * layout.cc (Layout::symtab_section_shndx): New function.
3536         * layout.h (class Layout): Declare symtab_section_shndx.
3537         * output.cc (Output_section::write_header): Call it.
3538
3539 2011-06-29  Ian Lance Taylor  <iant@google.com>
3540
3541         PR gold/12818
3542         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3543         symbols which are not used in a relocation.
3544
3545 2011-06-28  Ian Lance Taylor  <iant@google.com>
3546
3547         PR gold/12898
3548         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3549         script create indistinguishable segments.
3550         (Layout::set_segment_offsets): Use stable_sort when sorting
3551         segments.  Pass this to Compare_segments constructor.
3552         * layout.h (class Layout): Make segment_precedes non-static.
3553         (class Compare_segments): Change from struct to class.  Add
3554         layout_ field.  Add constructor.
3555         * script-sections.cc
3556         (Script_sections::attach_sections_using_phdrs_clause): Rename
3557         local orphan to is_orphan.  Don't report failure to put empty
3558         section in segment.  On attachment failure, report name of
3559         section, and attach to first PT_LOAD segment.
3560
3561 2011-06-28  Ian Lance Taylor  <iant@google.com>
3562
3563         PR gold/12934
3564         * target-select.cc (Target_selector::Target_selector): Add
3565         emulation parameter.  Change all callers.
3566         (select_target_by_bfd_name): Rename from select_target_by_name.
3567         Change all callers.
3568         (select_target_by_emulation): New function.
3569         (supported_emulation_names): New function.
3570         * target-select.h (class Target_selector): Add emulation_ field.
3571         Update declarations.
3572         (Target_selector::recognize_by_bfd_name): Rename from
3573         recognize_by_name.  Change all callers.
3574         (Target_selector::supported_bfd_names): Rename from
3575         supported_names.  Change all callers.
3576         (Target_selector::recognize_by_emulation): New function.
3577         (Target_selector::supported_emulations): New function.
3578         (Target_selector::emulation): New function.
3579         (Target_selector::do_recognize_by_bfd_name): Rename from
3580         do_recognize_by_name.  Change all callers.
3581         (Target_selector::do_supported_bfd_names): Rename from
3582         do_supported_names.  Change all callers.
3583         (Target_selector::do_recognize_by_emulation): New function.
3584         (Target_selector::do_supported_emulations): New function.
3585         (select_target_by_bfd_name): Change name in declaration.
3586         (select_target_by_emulation): Declare.
3587         (supported_emulation_names): Declare.
3588         * parameters.cc (parameters_force_valid_target): Try to find
3589         target based on emulation from -m option.
3590         * options.h (class General_options): Change doc string for -m.
3591         * options.cc (help): Print emulations.
3592         (General_options::parse_V): Likewise.
3593         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3594         Add emulation parameter.  Change all callers.
3595
3596 2011-06-28  Ian Lance Taylor  <iant@google.com>
3597
3598         * target.h (class Target): Add osabi_ field.
3599         (Target::osabi): New function.
3600         (Target::set_osabi): New function.
3601         (Target::Target): Initialize osabi_.
3602         (Target::do_adjust_elf_header): Make pure virtual.
3603         (Sized_target::do_adjust_elf_header): Declare.
3604         * target.cc (Sized_target::do_adjust_elf_header): New function.
3605         (class Sized_target): Instantiate all versions.
3606         * freebsd.h (class Target_freebsd): Remove.
3607         (Target_selector_freebsd::do_recognize): Call set_osabi on
3608         Target.
3609         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3610         (Target_selector_freebsd::set_osabi): Remove.
3611         * i386.cc (class Target_i386): Inherit from Sized_target rather
3612         than Target_freebsd.
3613         * x86_64.cc (class Target_x86_64): Likewise.
3614
3615 2011-06-28  Ian Lance Taylor  <iant@google.com>
3616
3617         * target.h (Target::can_check_for_function_pointers): Rewrite.
3618         Make non-virtual.
3619         (Target::can_icf_inline_merge_sections): Likewise.
3620         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3621         (Target::Target_info): Add can_icf_inline_merge_sections field.
3622         (Target::do_can_check_for_function_pointers): New virtual
3623         function.
3624         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3625         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3626         from can_check_for_function_pointers, move in file.
3627         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3628         section_may_have_icf_unsafe_poineters, move in file.
3629         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3630         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3631         Rename from can_check_for_function_pointers, move in file.
3632         (Target_i386::can_icf_inline_merge_sections): Remove.
3633         (Target_i386::i386_info): Initialize
3634         can_icf_inline_merge_sections.
3635         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3636         Initialize can_icf_inline_merge_sections.
3637         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3638         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3639         Rename from can_check_for_function_pointers, move in file.
3640         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3641         (Target_x86_64::x86_64_info): Initialize
3642         can_icf_inline_merge_sections.
3643         * testsuite/testfile.cc (Target_test::test_target_info):
3644         Likewise.
3645         * icf.cc (get_section_contents): Correct formatting.
3646
3647 2011-06-27  Ian Lance Taylor  <iant@google.com>
3648
3649         * symtab.cc (Symbol::versioned_name): New function.
3650         (Symbol_table::add_to_final_symtab): Use versioned_name when
3651         appropriate.
3652         (Symbol_table::sized_write_symbol): Likewise.
3653         * symtab.h (class Symbol): Declare versioned_name.
3654         * stringpool.h (class Stringpool_template): Add variant of add
3655         which takes a std::basic_string.
3656         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3657         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3658         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3659         (ver_test_12.o): New target.
3660         * testsuite/Makefile.in: Rebuild.
3661
3662 2011-06-27  Doug Kwan  <dougkwan@google.com>
3663
3664         * arm.cc (Arm_relocate_functions::thm_jump8,
3665         Arm_relocate_functions::thm_jump11): Use a wider signed
3666         type to compute offset.
3667         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3668         arm_thm_jump8.
3669         * testsuite/Makefile.in: Regenerate.
3670         * testsuite/arm_branch_in_range.sh: Check test results of
3671         arm_thm_jump11 and arm_thm_jump8.
3672         * testsuite/arm_thm_jump11.s: New test source file.
3673         * testsuite/arm_thm_jump11.t: New linker script.
3674         * testsuite/arm_thm_jump8.s: New test source file.
3675         * testsuite/arm_thm_jump8.t: New linker script.
3676
3677 2011-06-24  Ian Lance Taylor  <iant@google.com>
3678
3679         * layout.cc: Include "object.h".
3680         (ctors_sections_in_init_array): New static variable.
3681         (Layout::is_ctors_in_init_array): New function.
3682         (Layout::layout): Add entry to ctors_sections_in_init_array if
3683         appropriate.
3684         * layout.h (class Layout): Declare is_ctors_in_init_array.
3685         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3686         is_ctors_reverse_view is set.
3687         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3688         all callers.  Set is_ctors_reverse_view field of View_size.
3689         (Sized_relobj_file::reverse_words): New function.
3690         * object.h (Sized_relobj_file::View_size): Add
3691         is_ctors_reverse_view field.
3692         (class Sized_relobj_file): Update declarations.
3693         * testsuite/initpri3.c: New test.
3694         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3695         initpri3b.
3696         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3697         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3698         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3699         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3700         * testsuite/Makefile.in: Rebuild.
3701
3702 2011-06-24  Cary Coutant  <ccoutant@google.com>
3703
3704         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3705         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3706         (debug_msg_cdebug.err): New targets.
3707         * testsuite/Makefile.in: Regenerate.
3708         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3709         Fix checks for link with shared library.
3710
3711 2011-06-24  Doug Kwan  <dougkwan@google.com>
3712
3713         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3714         skip empty text sections.
3715         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3716
3717 2011-06-22  Ian Lance Taylor  <iant@google.com>
3718
3719         PR gold/12910
3720         * options.h (class General_options): Add --ctors-in-init-array.
3721         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3722         friends as SHT_PROGBITS for merging sections.
3723         (Layout::layout): Remove special handling of .init_array and
3724         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3725         and .dtors if ctors_in_init_array.
3726         (Layout::make_output_section): Force correct section types for
3727         .init_array and friends.  Don't sort if doing relocatable link,
3728         Don't sort .ctors and .dtors if ctors_in_init_array.
3729         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3730         (Layout::output_section_name): Add relobj parameter.  Change all
3731         callers.  Handle .ctors. and .dtors. in code rather than table.
3732         Handle .ctors and .dtors if ctors_in_init_array.
3733         (Layout::match_file_name): New function, moved from output.cc.
3734         * layout.h (class Layout): Update declarations.
3735         * output.cc: Include "layout.h".
3736         (Input_section_sort_entry::get_priority): New function.
3737         (Input_section_sort_entry::match_file_name): Just call
3738         Layout::match_file_name.
3739         (Output_section::Input_section_sort_init_fini_compare::operator()):
3740         Handle .ctors and .dtors.  Sort by explicit priority rather than
3741         by name.
3742         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3743         * testsuite/initpri2.c: New test.
3744         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3745         (check_PROGRAMS): Add initpri2.
3746         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3747         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3748         * configure, testsuite/Makefile.in: Rebuild.
3749
3750 2011-06-19  Ian Lance Taylor  <iant@google.com>
3751
3752         PR gold/12880
3753         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3754         .interp section to a PT_INTERP segment even if we have seen a
3755         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3756         clause in a linker script.
3757         (Layout::finalize): Don't create a .interp section if we've
3758         already create a PT_INTERP segment.
3759         (Layout::create_interp): Always call choose_output_section (revert
3760         patch of 2011-06-17).  Don't create PT_INTERP segment.
3761         * script-sections.cc
3762         (Script_sections::create_note_and_tls_segments): Add a .interp
3763         section to a PT_INTERP segment even if we have seen a
3764         --dynamic-linker option.
3765
3766 2011-06-18  Ian Lance Taylor  <iant@google.com>
3767
3768         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3769         merely because a non-PT_LOAD segment has a dynamic reloc.
3770
3771 2011-06-18  Ian Lance Taylor  <iant@google.com>
3772
3773         * layout.cc (Layout::finish_dynamic_section): Don't create
3774         DT_FLAGS entry if not needed.
3775
3776 2011-06-18  Ian Lance Taylor  <iant@google.com>
3777
3778         PR gold/12745
3779         * layout.cc (Layout::layout_eh_frame): Correct handling of
3780         writable .eh_frame section.
3781
3782 2011-06-17  Ian Lance Taylor  <iant@google.com>
3783
3784         PR gold/12893
3785         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3786         symbol is redefined with the exact same object and value.
3787
3788 2011-06-17  Ian Lance Taylor  <iant@google.com>
3789
3790         PR gold/12880
3791         * layout.h (class Layout): Add interp_segment_ field.
3792         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3793         (Layout::attach_allocated_section_to_segment): If making shared
3794         library, put .interp section in PT_INTERP segment.
3795         (Layout::finalize): Also call create_interp if -dynamic-linker
3796         option was used.
3797         (Layout::create_interp): Assert that there is no PT_INTERP
3798         segment.  If not using a SECTIONS clause, use make_output_section.
3799         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3800         * script-sections.cc
3801         (Script_sections::create_note_and_tls_segments): If making shared
3802         library, put .interp section in PT_INTERP segment.
3803
3804 2011-06-17  Ian Lance Taylor  <iant@google.com>
3805
3806         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3807         when making a shared library.
3808
3809 2011-06-17  Ian Lance Taylor  <iant@google.com>
3810
3811         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3812         parameter.  Change all callers.  Don't issue warning about PC32
3813         against locally defined symbol.
3814
3815 2011-06-16  Ian Lance Taylor  <iant@google.com>
3816
3817         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3818         occurs in same object.
3819
3820 2011-06-14  Alan Modra  <amodra@gmail.com>
3821
3822         * po/POTFILES.in: Regenerate.
3823
3824 2011-06-09  Ian Lance Taylor  <iant@google.com>
3825
3826         * script-sections.cc
3827         (Orphan_output_section::set_section_addresses): For a relocatable
3828         link set address to 0.
3829
3830 2011-06-09  Cary Coutant  <ccoutant@google.com>
3831
3832         PR gold/12804
3833         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3834         used with --compress-debug-sections.
3835         * gold/object.cc (Sized_relobj_file::do_layout): Report
3836         uncompressed size of compressed input sections.
3837
3838 2011-06-08  Cary Coutant  <ccoutant@google.com>
3839
3840         PR gold/12804
3841         * testsuite/two_file_test_2_v1.cc: Change initialization of
3842         v2 to keep it in .data.
3843
3844 2011-06-07  Cary Coutant  <ccoutant@google.com>
3845
3846         * common.cc (Symbol_table::do_allocate_commons_list): Call
3847         gold_fallback.
3848         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3849         (Errors::fallback): New function.
3850         (gold_fallback): New function.
3851         * errors.h (Errors::fallback): New function.
3852         * gold.cc (gold_exit): Change status parameter to enum; adjust
3853         all callers.
3854         (queue_initial_tasks): Call gold_fallback.
3855         * gold.h: Include cstdlib.
3856         (Exit_status): New enum type.
3857         (gold_exit): Change status parameter to enum.
3858         (gold_fallback): New function.
3859         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3860         (Layout::create_symtab_sections): Likewise.
3861         (Layout::create_shdrs): Likewise.
3862         * main.cc (main): Adjust call to gold_exit.
3863         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3864         (Output_data_got::add_got_entry_pair): Likewise.
3865         (Output_section::add_input_section): Likewise.
3866         (Output_section::add_output_section_data): Likewise.
3867         (Output_segment::set_section_list_addresses): Likewise.
3868         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3869
3870 2011-06-07  Cary Coutant  <ccoutant@google.com>
3871
3872         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3873         for incremental links.
3874         * output.cc (Output_segment::set_section_list_addresses): Remove
3875         FIXME and test for TLS or BSS.
3876
3877 2011-06-07  Cary Coutant  <ccoutant@google.com>
3878
3879         * testsuite/Makefile.am: Add incremental_copy_test,
3880         incremental_common_test_1.
3881         * testsuite/Makefile.in: Regenerate.
3882         * testsuite/common_test_1_v1.c: New source file.
3883         * testsuite/common_test_1_v2.c: New source file.
3884         * testsuite/copy_test_v1.cc: New source file.
3885
3886 2011-06-07  Cary Coutant  <ccoutant@google.com>
3887
3888         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3889         update, allocate common from bss section's free list.
3890         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3891         linker-defined symbols.
3892         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3893         Skip GOT and PLT entries that are no longer referenced.
3894         (Output_section_incremental_inputs::write_info_blocks): Mark
3895         linker-defined symbols.
3896         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3897         * output.cc (Output_section::allocate): New function.
3898         * output.h (Output_section::allocate): New function.
3899         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3900         linker-defined symbols.
3901         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3902         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3903         (Symbol::init_base_output_data): Likewise.
3904         (Symbol::init_base_output_segment): Likewise.
3905         (Symbol::init_base_constant): Likewise.
3906         (Sized_symbol::init_output_data): Likewise.
3907         (Sized_symbol::init_output_segment): Likewise.
3908         (Sized_symbol::init_constant): Likewise.
3909         (Symbol_table::do_define_in_output_data): Likewise.
3910         (Symbol_table::do_define_in_output_segment): Likewise.
3911         (Symbol_table::do_define_as_constant): Likewise.
3912         * symtab.h (Symbol::is_predefined): New function.
3913         (Symbol::init_base_output_data): Add is_predefined parameter.
3914         (Symbol::init_base_output_segment): Likewise.
3915         (Symbol::init_base_constant): Likewise.
3916         (Symbol::is_predefined_): New data member.
3917         (Sized_symbol::init_output_data): Add is_predefined parameter.
3918         (Sized_symbol::init_output_segment): Likewise.
3919         (Sized_symbol::init_constant): Likewise.
3920         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3921
3922 2011-06-07  Cary Coutant  <ccoutant@google.com>
3923
3924         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3925         instead of emit_copy_reloc.
3926         (Copy_relocs::emit_copy_reloc): Refactor.
3927         (Copy_relocs::make_copy_reloc): New function.
3928         (Copy_relocs::add_copy_reloc): Remove.
3929         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3930         section.
3931         (Copy_relocs::make_copy_reloc): New function.
3932         (Copy_relocs::add_copy_reloc): Remove.
3933         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3934         unchanged input files.
3935         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3936         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3937         Reserve BSS space for COPY relocations.
3938         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3939         (Output_section_incremental_inputs::write_info_blocks): Record
3940         whether a symbol is copied from a shared object.
3941         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3942         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3943         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3944         (Incremental_input_entry_reader::get_output_symbol_index): Add
3945         is_copy parameter.
3946         (Incremental_binary::emit_copy_relocs): New function.
3947         (Incremental_binary::do_emit_copy_relocs): New function.
3948         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3949         new data member.
3950         (Sized_incremental_binary::add_copy_reloc): New function.
3951         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3952         (Sized_incremental_binary::Copy_reloc): New struct.
3953         (Sized_incremental_binary::Copy_relocs): New typedef.
3954         (Sized_incremental_binary::copy_relocs_): New data member.
3955         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3956         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3957         * target.h (Sized_target::emit_copy_reloc): New function.
3958         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3959
3960 2011-06-02  Cary Coutant  <ccoutant@google.com>
3961
3962         PR gold/12163
3963         * gold/archive.cc (Archive::Archive): Initialize new data member.
3964         (Archive::include_all_members): Return if archive has already been
3965         included.
3966         * gold/archive.h (Archive::include_all_members_): New data member.
3967
3968 2011-06-02  Nick Clifton  <nickc@redhat.com>
3969
3970         * dynobj.h: Fix spelling mistake in comment.
3971         * output.cc: Likewise.
3972
3973 2011-05-31  Doug Kwan  <dougkwan@google.com>
3974             Asier Llano
3975
3976         PR gold/12826
3977         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3978         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3979         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3980         redundant arm_exidx_test.so.
3981         * testsuite/Makefile.in: Regenerate.
3982         (check_SCRIPTS): Add pr12826.sh
3983         (check_DATA): Add pr12826.stdout
3984         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3985         * testsuite/pr12826.sh: New file.
3986         * testsuite/pr12826_1.s: Ditto.
3987         * testsuite/pr12826_1.s: Ditto.
3988
3989 2011-05-30  Ian Lance Taylor  <iant@google.com>
3990
3991         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3992         sections.
3993
3994 2011-05-29  Ian Lance Taylor  <iant@google.com>
3995
3996         PR gold/12804
3997         * testsuite/Makefile.am: Use different file name for two_file_test
3998         temporary file for each incremental test.
3999         * testsuite/Makefile.in: Rebuild.
4000
4001 2011-05-29  Ian Lance Taylor  <iant@google.com>
4002
4003         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4004         binary input file is empty.
4005
4006 2011-05-27  Ian Lance Taylor  <iant@google.com>
4007
4008         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4009         (ver_test_9.so): Likewise.
4010         * testsuite/Makefile.in: Rebuild.
4011
4012 2011-05-26 Cary Coutant  <ccoutant@google.com>
4013
4014         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4015         * incremental.cc (Incremental_inputs::report_input_section): Fix
4016         comment, indentation.
4017         (Incremental_inputs::report_comdat_group): New function.
4018         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4019         of data for incremental input file entry.
4020         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4021         group count, COMDAT group signatures.
4022         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4023         an unchanged input file.
4024         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4025         Initialize new data member.
4026         (Incremental_object_entry::add_comdat_group): New function.
4027         (Incremental_object_entry::get_comdat_group_count): New function.
4028         (Incremental_object_entry::get_comdat_signature_key): New function.
4029         (Incremental_object_entry::groups_): New data member.
4030         (Incremental_inputs::report_comdat_group): New function.
4031         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4032         data for incremental input file entry.
4033         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4034         (Incremental_input_entry_reader::get_input_section): Adjust size of
4035         data for incremental input file entry.
4036         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4037         (Incremental_input_entry_reader::get_comdat_group_signature): New
4038         function.
4039         * object.cc (Sized_relobj::include_section_group): Report kept
4040         COMDAT groups for incremental links.
4041
4042 2011-05-24  David Meyer  <pdox@google.com>
4043
4044         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4045         with name parameter.  Add found_name parameter.
4046         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4047         * dirsearch.h (class Dirsearch): Update declaration.
4048
4049 2011-05-24  Ian Lance Taylor  <iant@google.com>
4050
4051         * archive.cc (Library_base::should_include_member): Pull in object
4052         from archive if it defines the entry symbol.
4053         * parameters.cc (Parameters::entry): New function.
4054         * parameters.h (class Parameters): Declare entry.
4055         * output.h (class Output_file_header): Remove entry_ field.
4056         * output.cc (Output_file_header::Output_file_header): Remove entry
4057         parameter.  Change all callers.
4058         (Output_file_header::entry): Use parameters->entry.
4059         * gold.cc (queue_middle_tasks): Likewise.
4060         * plugin.cc (Plugin_hook::run): Likewise.
4061
4062 2011-05-24 Cary Coutant  <ccoutant@google.com>
4063
4064         * gold.cc (queue_initial_tasks): Pass incremental base filename
4065         to Output_file::open_base_file; don't print error message.
4066         * incremental-dump.cc (main): Adjust call to
4067         Output_file::open_for_modification.
4068         * incremental-dump.cc (main): Likewise.
4069         * incremental.cc (Incremental_inputs::report_command_line):
4070         Ignore --incremental-base option when comparing command lines.
4071         Ignore parameter when given as separate argument.
4072         * options.h (class General_options): Add --incremental-base.
4073         * output.cc (Output_file::Output_file):
4074         (Output_file::open_base_file): Add base_name and writable parameters;
4075         read base file into new file; print error message here.
4076         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4077         callers.
4078         * output.h (Output_file::open_for_modification): Rename to...
4079         (Output_file::open_base_file): ...this; add base_name and
4080         writable parameters; adjust all callers.
4081         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4082         callers.
4083         * testsuite/Makefile.am (incremental_test_4): Test
4084         --incremental-base.
4085         * testsuite/Makefile.in: Regenerate.
4086
4087 2011-05-24 Cary Coutant  <ccoutant@google.com>
4088
4089         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4090         incremental_test_4.
4091         * testsuite/Makefile.in: Regenerate.
4092         * testsuite/two_file_test_1_v1.cc: New test source file.
4093         * testsuite/two_file_test_1b_v1.cc: New test source file.
4094         * testsuite/two_file_test_2_v1.cc: New test source file.
4095
4096 2011-05-24 Cary Coutant  <ccoutant@google.com>
4097
4098         * dynobj.h (Dynobj::do_dynobj): New function.
4099         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4100         flag and soname for shared objects.
4101         * incremental.cc (Incremental_inputs::report_object): Make
4102         either Incremental_object_entry or Incremental_dynobj_entry; add
4103         soname to string table.
4104         (Incremental_inputs::report_input_section): Add assertion.
4105         (Output_section_incremental_inputs::set_final_data_size): Adjust
4106         type of input file entry for shared libraries; adjust size of
4107         shared library info entry.
4108         (Output_section_incremental_inputs::write_input_files): Write
4109         as_needed flag for shared libraries.
4110         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4111         of input file entry for shared libraries; write soname.
4112         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4113         soname from incremental info.
4114         * incremental.h (enum Incremental_input_flags): Add
4115         INCREMENTAL_INPUT_AS_NEEDED.
4116         (Incremental_input_entry::Incremental_input_entry): Initialize new
4117         data member.
4118         (Incremental_input_entry::set_as_needed): New function.
4119         (Incremental_input_entry::as_needed): New function.
4120         (Incremental_input_entry::do_dynobj_entry): New function.
4121         (Incremental_input_entry::as_needed_): New data member.
4122         (Incremental_object_entry::Incremental_object_entry): Don't check
4123         for shared library.
4124         (Incremental_object_entry::do_type): Likewise.
4125         (class Incremental_dynobj_entry): New class.
4126         (Incremental_input_entry_reader::as_needed): New function.
4127         (Incremental_input_entry_reader::get_soname): New function.
4128         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4129         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4130         size of shared library info entry.
4131         * layout.cc (Layout::finish_dynamic_section): Don't test for
4132         incremental link when adding DT_NEEDED entries.
4133         * object.h (Object::Object): Initialize new data member.
4134         (Object::dynobj): New function.
4135         (Object::set_as_needed): New function.
4136         (Object::as_needed): New function.
4137         (Object::do_dynobj): New function.
4138         (Object::as_needed_): New data member.
4139
4140 2011-05-24 Cary Coutant  <ccoutant@google.com>
4141
4142         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4143         info; adjust display of GOT entries.
4144         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4145         vector of input objects; remove file_status_.
4146         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4147         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4148         got_plt reader; call target hooks to reserve GOT entries.
4149         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4150         of input file info header and GOT info entry.
4151         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4152         relocation info.
4153         (Got_plt_view_info::got_descriptor): Remove.
4154         (Got_plt_view_info::sym_index): New data member.
4155         (Got_plt_view_info::input_index): New data member.
4156         (Local_got_offset_visitor::visit): Write input file index.
4157         (Global_got_offset_visitor::visit): Write 0 for input file index.
4158         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4159         with sym_index and input_index.
4160         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4161         incremental info GOT entry; replace got_descriptor with input_index.
4162         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4163         map from input file index to object.
4164         (Sized_relobj_incr::do_layout): Replace direct data member reference
4165         with accessor function.
4166         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4167         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4168         Adjust size of input file info header.
4169         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4170         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4171         (Incremental_input_entry_reader::get_input_section): Adjust size of
4172         input file info header.
4173         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4174         of incremental info GOT entry.
4175         (Incremental_got_plt_reader::get_got_desc): Remove.
4176         (Incremental_got_plt_reader::get_got_symndx): New function.
4177         (Incremental_got_plt_reader::get_got_input_index): New function.
4178         (Sized_incremental_binary::Sized_incremental_binary): Remove
4179         file_status_; add input_objects_.
4180         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4181         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4182         (Sized_incremental_binary::file_is_unchanged): Remove.
4183         (Sized_incremental_binary::set_input_object): New function.
4184         (Sized_incremental_binary::input_object): New function.
4185         (Sized_incremental_binary::file_status_): Remove.
4186         (Sized_incremental_binary::input_objects_): New data member.
4187         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4188         references.
4189         (Sized_relobj_incr::invalid_address): Move to base class.
4190         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4191         class.
4192         (Sized_relobj_incr::do_output_section_offset): Likewise.
4193         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4194         (Sized_relobj_incr::section_offsets_): Likewise.
4195         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4196         function.
4197         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4198         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4199         with accessor function.
4200         (Sized_relobj_file::do_layout): Likewise.
4201         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4202         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4203         (Sized_relobj_file::compute_final_local_value): Replace refs to
4204         section_offsets_ with accessor function.
4205         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4206         * object.h (Relobj::Relobj): Initialize new data members.
4207         (Relobj::add_dyn_reloc): New function.
4208         (Relobj::first_dyn_reloc): New function.
4209         (Relobj::dyn_reloc_count): New function.
4210         (Relobj::first_dyn_reloc_): New data member.
4211         (Relobj::dyn_reloc_count_): New data member.
4212         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4213         references.
4214         (Sized_relobj::Address): New typedef.
4215         (Sized_relobj::invalid_address): Move here from child class.
4216         (Sized_relobj::Sized_relobj): Initialize new data members.
4217         (Sized_relobj::sized_relobj): New function.
4218         (Sized_relobj::is_output_section_offset_invalid): Move here from
4219         child class.
4220         (Sized_relobj::get_output_section_offset): Likewise.
4221         (Sized_relobj::local_has_got_offset): Likewise.
4222         (Sized_relobj::local_got_offset): Likewise.
4223         (Sized_relobj::set_local_got_offset): Likewise.
4224         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4225         (Sized_relobj::clear_got_offsets): New function.
4226         (Sized_relobj::section_offsets): Move here from child class.
4227         (Sized_relobj::do_output_section_offset): Likewise.
4228         (Sized_relobj::do_set_section_offset): Likewise.
4229         (Sized_relobj::Local_got_offsets): Likewise.
4230         (Sized_relobj::local_got_offsets_): Likewise.
4231         (Sized_relobj::section_offsets_): Likewise.
4232         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4233         references.
4234         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4235         class.
4236         (Sized_relobj_file::sized_relobj): New function
4237         (Sized_relobj_file::local_has_got_offset): Move to base class.
4238         (Sized_relobj_file::local_got_offset): Likewise.
4239         (Sized_relobj_file::set_local_got_offset): Likewise.
4240         (Sized_relobj_file::get_output_section_offset): Likewise.
4241         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4242         (Sized_relobj_file::do_output_section_offset): Likewise.
4243         (Sized_relobj_file::do_set_section_offset): Likewise.
4244         (Sized_relobj_file::Local_got_offsets): Likewise.
4245         (Sized_relobj_file::local_got_offsets_): Likewise.
4246         (Sized_relobj_file::section_offsets_): Likewise.
4247         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4248         (all constructors).
4249         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4250         (Output_reloc::get_symbol_index): Likewise.
4251         (Output_reloc::local_section_offset): Likewise.
4252         (Output_reloc::get_address): Likewise.
4253         (Output_reloc::symbol_value): Likewise.
4254         (Output_data_got::reserve_slot): Move to class definition.
4255         (Output_data_got::reserve_local): New function.
4256         (Output_data_got::reserve_slot_for_global): Remove.
4257         (Output_data_got::reserve_global): New function.
4258         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4259         (all constructors, two instantiations).
4260         (Output_reloc::get_relobj): New function (two instantiations).
4261         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4262         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4263         (Output_data_reloc::add_global): Adjust type of relobj.
4264         (Output_data_reloc::add_global_relative): Likewise.
4265         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4266         (Output_data_reloc::add_local): Likewise.
4267         (Output_data_reloc::add_local_relative): Likewise.
4268         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4269         (Output_data_reloc::add_local_section): Likewise.
4270         (Output_data_reloc::add_output_section): Likewise.
4271         (Output_data_reloc::add_absolute): Likewise.
4272         (Output_data_reloc::add_target_specific): Likewise.
4273         (Output_data_got::reserve_slot): Move definition here.
4274         (Output_data_got::reserve_local): New function.
4275         (Output_data_got::reserve_global): New function.
4276         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4277         section_offsets_ with accessor function.
4278         (Sized_relobj_file::write_sections): Likewise.
4279         (Sized_relobj_file::do_relocate_sections): Likewise.
4280         * target.h (Sized_target::reserve_local_got_entry): New function.
4281         (Sized_target::reserve_global_got_entry): New function.
4282         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4283         (Target_x86_64::reserve_global_got_entry): New function.
4284         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4285
4286 2011-05-23 Cary Coutant  <ccoutant@google.com>
4287
4288         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4289         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4290         bit when checking got_type.
4291         * incremental.cc (Sized_incremental_binary::setup_readers):
4292         Store symbol table and string table locations; initialize bit vector
4293         of file status flags.
4294         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4295         unchanged files.
4296         (Sized_incremental_binary::do_process_got_plt): New function.
4297         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4298         (Output_section_incremental_inputs::set_final_data_size): Record
4299         file index for each input file.
4300         (Output_section_incremental_inputs::write_got_plt): Store file index
4301         instead of input entry offset for each GOT entry.
4302         * incremental.h
4303         (Incremental_input_entry::Incremental_input_entry): Initialize new
4304         data member.
4305         (Incremental_input_entry::set_offset): Store file index.
4306         (Incremental_input_entry::get_file_index): New function.
4307         (Incremental_input_entry::file_index_): New data member.
4308         (Incremental_binary::process_got_plt): New function.
4309         (Incremental_binary::do_process_got_plt): New function.
4310         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4311         data members.
4312         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4313         (Sized_incremental_binary::set_file_is_unchanged): New function.
4314         (Sized_incremental_binary::file_is_unchanged): New function.
4315         (Sized_incremental_binary::do_process_got_plt): New function.
4316         (Sized_incremental_binary::file_status_): New data member.
4317         (Sized_incremental_binary::main_symtab_loc_): New data member.
4318         (Sized_incremental_binary::main_strtab_loc_): New data member.
4319         * output.cc (Output_data_got::Got_entry::write): Add case
4320         RESERVED_CODE.
4321         (Output_data_got::add_global): Call add_got_entry.
4322         (Output_data_got::add_global_plt): Likewise.
4323         (Output_data_got::add_global_with_rel): Likewise.
4324         (Output_data_got::add_global_with_rela): Likewise.
4325         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4326         (Output_data_got::add_global_pair_with_rela): Likewise.
4327         (Output_data_got::add_local): Call add_got_entry.
4328         (Output_data_got::add_local_plt): Likewise.
4329         (Output_data_got::add_local_with_rel): Likewise.
4330         (Output_data_got::add_local_with_rela): Likewise.
4331         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4332         (Output_data_got::add_local_pair_with_rela): Likewise.
4333         (Output_data_got::reserve_slot): New function.
4334         (Output_data_got::reserve_slot_for_global): New function.
4335         (Output_data_got::add_got_entry): New function.
4336         (Output_data_got::add_got_entry_pair): New function.
4337         (Output_section::add_output_section_data): Edit FIXME.
4338         * output.h
4339         (Output_section_data_build::Output_section_data_build): New
4340         constructor with size parameter.
4341         (Output_data_space::Output_data_space): Likewise.
4342         (Output_data_got::Output_data_got): Initialize new data member; new
4343         constructor with size parameter.
4344         (Output_data_got::add_constant): Call add_got_entry.
4345         (Output_data_got::reserve_slot): New function.
4346         (Output_data_got::reserve_slot_for_global): New function.
4347         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4348         (Output_data_got::add_got_entry): New function.
4349         (Output_data_got::add_got_entry_pair): New function.
4350         (Output_data_got::free_list_): New data member.
4351         * target.h (Sized_target::init_got_plt_for_update): New function.
4352         (Sized_target::register_global_plt_entry): New function.
4353         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4354         Initialize new data member; call init; add constructor with PLT count.
4355         (Output_data_plt_x86_64::init): New function.
4356         (Output_data_plt_x86_64::add_relocation): New function.
4357         (Output_data_plt_x86_64::reserve_slot): New function.
4358         (Output_data_plt_x86_64::free_list_): New data member.
4359         (Target_x86_64::init_got_plt_for_update): New function.
4360         (Target_x86_64::register_global_plt_entry): New function.
4361         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4362         incremental updates.
4363         (Output_data_plt_x86_64::add_relocation): New function.
4364         * testsuite/object_unittest.cc (Object_test): Set default options.
4365
4366 2011-05-16  Ian Lance Taylor  <iant@google.com>
4367
4368         * options.h (class General_options): Make -i a synonym for -r.
4369
4370 2011-05-16  Ian Lance Taylor  <iant@google.com>
4371
4372         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4373
4374 2011-05-10 Cary Coutant  <ccoutant@google.com>
4375
4376         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4377         strip_all (-s).
4378
4379 2011-05-06  Ian Lance Taylor  <iant@google.com>
4380
4381         * layout.cc (Layout::layout): If the output section flags change,
4382         update the ordering.
4383
4384 2011-04-25 Cary Coutant  <ccoutant@google.com>
4385
4386         * incremental-dump.cc (dump_incremental_inputs): Print local
4387         symbol info for each input file.
4388         * incremental.cc
4389         (Output_section_incremental_inputs::set_final_data_size): Add local
4390         symbol info to input file entries in incremental info.
4391         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4392         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4393         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4394         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4395         implementation.
4396         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4397         (Sized_incr_relobj::do_relocate): Write the local symbols.
4398         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4399         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4400         Adjust size of input file header.
4401         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4402         (Incremental_inputs_reader::get_local_symbol_count): New function.
4403         (Incremental_inputs_reader::get_input_section): Adjust size of input
4404         file header.
4405         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4406         (Sized_incr_relobj::This): New typedef.
4407         (Sized_incr_relobj::sym_size): New const data member.
4408         (Sized_incr_relobj::Local_symbol): New struct.
4409         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4410         (Sized_incr_relobj::do_local_symbol_offset): New function.
4411         (Sized_incr_relobj::local_symbol_count_): New data member.
4412         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4413         (Sized_incr_relobj::local_symbol_index_): New data member.
4414         (Sized_incr_relobj::local_symbol_offset_): New data member.
4415         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4416         (Sized_incr_relobj::local_symbols_): New data member.
4417         * object.h (Relobj::output_local_symbol_count): New function.
4418         (Relobj::local_symbol_offset): New function.
4419         (Relobj::do_output_local_symbol_count): New function.
4420         (Relobj::do_local_symbol_offset): New function.
4421         (Sized_relobj::do_output_local_symbol_count): New function.
4422         (Sized_relobj::do_local_symbol_offset): New function.
4423
4424 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4425
4426         * descriptors.cc (set_close_on_exec): New function.
4427         (Descriptors::open): Use set_close_on_exec.
4428         * output.cc (S_ISLNK): Define if not defined.
4429
4430 2011-04-22 Cary Coutant  <ccoutant@google.com>
4431
4432         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4433         global symbol map.
4434         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4435         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4436         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4437         relocations.
4438         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4439         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4440         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4441         * incremental.h
4442         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4443         function.
4444         (Incremental_binary::apply_incremental_relocs): New function.
4445         (Incremental_binary::do_apply_incremental_relocs): New function.
4446         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4447         data member.
4448         (Sized_incremental_binary::add_global_symbol): New function.
4449         (Sized_incremental_binary::global_symbol): New function.
4450         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4451         (Sized_incremental_binary::symbol_map_): New data member.
4452         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4453         * target.h (Sized_target::apply_relocation): New function.
4454         * target-reloc.h (apply_relocation): New function.
4455         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4456
4457 2011-04-22  Doug Kwan  <dougkwan@google.com>
4458
4459         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4460         flag of a SHT_ARM_EXIDX section.
4461         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4462         * testsuite/Makefile.in: Regenerate.
4463         * testsuite/arm_exidx_test.s: New file.
4464         * testsuite/arm_exidx_test.sh: Same.
4465
4466 2011-04-20 Cary Coutant  <ccoutant@google.com>
4467
4468         PR gold/12689
4469         * archive.h (Incremental_archive_entry::Archive_member):
4470         Initialize arg_serial_ (second constructor).
4471
4472 2011-04-17  Ian Lance Taylor  <iant@google.com>
4473
4474         * object.cc (Relocate_info::location): Simplify location string.
4475         * errors.cc (Errors::error_at_location): Don't print program
4476         name.
4477         (Errors::warning_at_location): Likewise.
4478         (Errors::undefined_symbol): Likewise.
4479         * testsuite/debug_msg.sh: Update accordingly.
4480
4481 2011-04-14 Cary Coutant  <ccoutant@google.com>
4482
4483         * gold/layout.cc (Layout::symtab_section_offset): New function.
4484         * gold/layout.h (Layout::symtab_section_offset): New function.
4485         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4486
4487 2011-04-12  Ian Lance Taylor  <iant@google.com>
4488
4489         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4490         with MREMAP_MAYMOVE.
4491         * output.h (class Output_file): Add map_is_allocated_ field.
4492         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4493         not available, provide stubs.  If mremap is not available, #define
4494         it to gold_mremap.
4495         (MREMAP_MAYMOVE): Define if not defined.
4496         (Output_file::Output_file): Initialize map_is_allocated_.
4497         (Output_file::resize): Check map_is_allocated_.
4498         (Output_file::map_anonymous): If mmap fails, use malloc.
4499         (Output_file::unmap): Don't do anything for an anonymous map.
4500         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4501         is not available, provide stubs.
4502         (File_read::View::~View): Use free rather than delete[].
4503         (File_read::make_view): Use malloc rather than new[].  If mmap
4504         fails, use malloc.
4505         (File_read::find_or_make_view): Use malloc rather than new[].
4506         * gold.h: Remove HAVE_REMAP code.
4507         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4508         exists.  Rename mremap to gold_mremap.  If mmap is not available
4509         don't do anything.
4510         * configure, config.in: Rebuild.
4511
4512 2011-04-11  Ian Lance Taylor  <iant@google.com>
4513
4514         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4515         initialize local variable v.
4516
4517 2011-04-11  Cary Coutant  <ccoutant@google.com>
4518
4519         * archive.cc (Archive::include_member): Adjust call to
4520         report_object.
4521         (Add_archive_symbols::run): Track argument serial numbers.
4522         (Lib_group::include_member): Likewise.
4523         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4524         * archive.h (Incremental_archive_entry::Archive_member):
4525         Initialize arg_serial_.
4526         (Archive_member::arg_serial_): New data member.
4527         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4528         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4529         incremental link.
4530         (Sized_dynobj::do_for_all_local_got_entries): New function.
4531         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4532         function.
4533         * fileread.cc (get_mtime): New function.
4534         * fileread.h (get_mtime): New function.
4535         * gold.cc (queue_initial_tasks): Check for incremental update.
4536         (process_incremental_input): New function.
4537         (queue_middle_tasks): Don't force valid target for incremental
4538         update.
4539         * incremental-dump.cc (find_input_containing_global): Adjust
4540         size of symbol info entry.
4541         (dump_incremental_inputs): Dump argument serial number and
4542         in_system_directory flag; bias shndx by 1; print symbol names
4543         when dumping per-file symbol lists; use new symbol info readers.
4544         * incremental.cc
4545         (Output_section_incremental_inputs:update_data_size): New function.
4546         (Sized_incremental_binary::setup_readers): Setup input readers
4547         for each input file; build maps for files added from libraries
4548         and scripts.
4549         (Sized_incremental_binary::check_input_args): New function.
4550         (Sized_incremental_binary::do_check_inputs): Build map of argument
4551         serial numbers to input arguments.
4552         (Sized_incremental_binary::do_file_has_changed): Rename
4553         do_file_is_unchanged to this; compare file modification times.
4554         (Sized_incremental_binary::do_init_layout): New function.
4555         (Sized_incremental_binary::do_reserve_layout): New function.
4556         (Sized_incremental_binary::do_get_input_reader): Remove.
4557         (Sized_incremental_binary::get_symtab_view): New function.
4558         (Incremental_checker::can_incrementally_link_output_file): Remove.
4559         (Incremental_inputs::report_command_line): Exclude --debug options.
4560         (Incremental_inputs::report_archive_begin): Add parameter; track
4561         argument serial numbers; don't put input file entry for archive
4562         before archive members.
4563         (Incremental_inputs::report_archive_end): Put input file entry
4564         for archive after archive members.
4565         (Incremental_inputs::report_object): Add parameter; track argument
4566         serial numbers and in_system_directory flag.
4567         (Incremental_inputs::report_script): Add parameter; track argument
4568         serial numbers.
4569         (Output_section_incremental_inputs::set_final_data_size): Adjust
4570         size of symbol info entry; check for forwarding symbols.
4571         (Output_section_incremental_inputs::write_input_files): Write
4572         in_system_directory flag and argument serial number.
4573         (Output_section_incremental_inputs::write_info_blocks): Map section
4574         indices between incremental info and original input file; store
4575         input section index for each symbol.
4576         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4577         change operator() to visit().
4578         (class Global_got_offset_visitor): Likewise.
4579         (class Global_symbol_visitor_got_plt):
4580         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4581         classes.
4582         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4583         (Sized_incr_relobj::do_read_symbols): New function.
4584         (Sized_incr_relobj::do_layout): New function.
4585         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4586         (Sized_incr_relobj::do_add_symbols): New function.
4587         (Sized_incr_relobj::do_should_include_member): New function.
4588         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4589         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4590         (Sized_incr_relobj::do_section_size): New function.
4591         (Sized_incr_relobj::do_section_name): New function.
4592         (Sized_incr_relobj::do_section_contents): New function.
4593         (Sized_incr_relobj::do_section_flags): New function.
4594         (Sized_incr_relobj::do_section_entsize): New function.
4595         (Sized_incr_relobj::do_section_address): New function.
4596         (Sized_incr_relobj::do_section_type): New function.
4597         (Sized_incr_relobj::do_section_link): New function.
4598         (Sized_incr_relobj::do_section_info): New function.
4599         (Sized_incr_relobj::do_section_addralign): New function.
4600         (Sized_incr_relobj::do_initialize_xindex): New function.
4601         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4602         (Sized_incr_relobj::do_read_relocs): New function.
4603         (Sized_incr_relobj::do_gc_process_relocs): New function.
4604         (Sized_incr_relobj::do_scan_relocs): New function.
4605         (Sized_incr_relobj::do_count_local_symbols): New function.
4606         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4607         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4608         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4609         (Sized_incr_relobj::do_relocate): New function.
4610         (Sized_incr_relobj::do_set_section_offset): New function.
4611         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4612         (Sized_incr_dynobj::do_read_symbols): New function.
4613         (Sized_incr_dynobj::do_layout): New function.
4614         (Sized_incr_dynobj::do_add_symbols): New function.
4615         (Sized_incr_dynobj::do_should_include_member): New function.
4616         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4617         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4618         (Sized_incr_dynobj::do_section_size): New function.
4619         (Sized_incr_dynobj::do_section_name): New function.
4620         (Sized_incr_dynobj::do_section_contents): New function.
4621         (Sized_incr_dynobj::do_section_flags): New function.
4622         (Sized_incr_dynobj::do_section_entsize): New function.
4623         (Sized_incr_dynobj::do_section_address): New function.
4624         (Sized_incr_dynobj::do_section_type): New function.
4625         (Sized_incr_dynobj::do_section_link): New function.
4626         (Sized_incr_dynobj::do_section_info): New function.
4627         (Sized_incr_dynobj::do_section_addralign): New function.
4628         (Sized_incr_dynobj::do_initialize_xindex): New function.
4629         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4630         (make_sized_incremental_object): New function.
4631         (Incremental_library::copy_unused_symbols): New function.
4632         (Incremental_library::do_for_all_unused_symbols): New function.
4633         * incremental.h (enum Incremental_input_flags): New type.
4634         (class Incremental_checker): Remove.
4635         (Incremental_input_entry::Incremental_input_entry): Add argument
4636         serial number.
4637         (Incremental_input_entry::arg_serial): New function.
4638         (Incremental_input_entry::set_is_in_system_directory): New function.
4639         (Incremental_input_entry::is_in_system_directory): New function.
4640         (Incremental_input_entry::arg_serial_): New data member.
4641         (Incremental_input_entry::is_in_system_directory_): New data member.
4642         (class Script_info): Move here from script.h.
4643         (Script_info::Script_info): Add filename parameter.
4644         (Script_info::filename): New function.
4645         (Script_info::filename_): New data member.
4646         (Incremental_script_entry::Incremental_script_entry): Add argument
4647         serial number.
4648         (Incremental_object_entry::Incremental_object_entry): Likewise.
4649         (Incremental_object_entry::add_input_section): Build list of input
4650         sections with map to original shndx.
4651         (Incremental_object_entry::get_input_section_index): New function.
4652         (Incremental_object_entry::shndx_): New data member.
4653         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4654         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4655         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4656         serial number.
4657         (Incremental_inputs::report_archive_begin): Likewise.
4658         (Incremental_inputs::report_object): Likewise.
4659         (Incremental_inputs::report_script): Likewise.
4660         (class Incremental_global_symbol_reader): New class.
4661         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4662         and store flags and input file type.
4663         (Incremental_input_entry_reader::arg_serial): New function.
4664         (Incremental_input_entry_reader::type): Extract type from flags.
4665         (Incremental_input_entry_reader::is_in_system_directory): New function.
4666         (Incremental_input_entry_reader::get_input_section_count): Call
4667         accessor function for type.
4668         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4669         function for type; adjust size of global symbol entry.
4670         (Incremental_input_entry_reader::get_global_symbol_count): Call
4671         accessor function for type.
4672         (Incremental_input_entry_reader::get_object_count): Likewise.
4673         (Incremental_input_entry_reader::get_object_offset): Likewise.
4674         (Incremental_input_entry_reader::get_member_count): Likewise.
4675         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4676         (Incremental_input_entry_reader::get_member_offset): Likewise.
4677         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4678         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4679         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4680         (Incremental_input_entry_reader::get_global_symbol_reader): New
4681         function.
4682         (Incremental_input_entry_reader::get_output_symbol_index): New
4683         function.
4684         (Incremental_input_entry_reader::type_): Remove.
4685         (Incremental_input_entry_reader::flags_): New data member.
4686         (Incremental_inputs_reader::input_file_offset): New function.
4687         (Incremental_inputs_reader::input_file_index): New function.
4688         (Incremental_inputs_reader::input_file): Call input_file_offset.
4689         (Incremental_inputs_reader::input_file_at_offset): New function.
4690         (Incremental_relocs_reader::get_r_type): Reformat.
4691         (Incremental_relocs_reader::get_r_shndx): Reformat.
4692         (Incremental_relocs_reader::get_r_offset): Reformat.
4693         (Incremental_relocs_reader::data): New function.
4694         (Incremental_binary::Incremental_binary): Initialize new data members.
4695         (Incremental_binary::check_inputs): Add cmdline parameter.
4696         (Incremental_binary::file_is_unchanged): Remove.
4697         (Input_reader::arg_serial): New function.
4698         (Input_reader::get_unused_symbol_count): New function.
4699         (Input_reader::get_unused_symbol): New function.
4700         (Input_reader::do_arg_serial): New function.
4701         (Input_reader::do_get_unused_symbol_count): New function.
4702         (Input_reader::do_get_unused_symbol): New function.
4703         (Incremental_binary::input_file_count): New function.
4704         (Incremental_binary::get_input_reader): Change signature to use
4705         index instead of filename.
4706         (Incremental_binary::file_has_changed): New function.
4707         (Incremental_binary::get_input_argument): New function.
4708         (Incremental_binary::get_library): New function.
4709         (Incremental_binary::get_script_info): New function.
4710         (Incremental_binary::init_layout): New function.
4711         (Incremental_binary::reserve_layout): New function.
4712         (Incremental_binary::output_file): New function.
4713         (Incremental_binary::do_check_inputs): New function.
4714         (Incremental_binary::do_file_is_unchanged): Remove.
4715         (Incremental_binary::do_file_has_changed): New function.
4716         (Incremental_binary::do_init_layout): New function.
4717         (Incremental_binary::do_reserve_layout): New function.
4718         (Incremental_binary::do_input_file_count): New function.
4719         (Incremental_binary::do_get_input_reader): Change signature.
4720         (Incremental_binary::input_args_map_): New data member.
4721         (Incremental_binary::library_map_): New data member.
4722         (Incremental_binary::script_map_): New data member.
4723         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4724         new data members.
4725         (Sized_incremental_binary::output_section): New function.
4726         (Sized_incremental_binary::inputs_reader): Add const.
4727         (Sized_incremental_binary::symtab_reader): Add const.
4728         (Sized_incremental_binary::relocs_reader): Add const.
4729         (Sized_incremental_binary::got_plt_reader): Add const.
4730         (Sized_incremental_binary::get_symtab_view): New function.
4731         (Sized_incremental_binary::Inputs_reader): New typedef.
4732         (Sized_incremental_binary::Input_entry_reader): New typedef.
4733         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4734         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4735         (Sized_incremental_binary::do_file_has_changed): New function.
4736         (Sized_incremental_binary::do_init_layout): New function.
4737         (Sized_incremental_binary::do_reserve_layout): New function.
4738         (Sized_input_reader::Inputs_reader): Remove.
4739         (Sized_input_reader::Input_entry_reader): Remove.
4740         (Sized_input_reader::do_arg_serial): New function.
4741         (Sized_input_reader::do_get_unused_symbol_count): New function.
4742         (Sized_input_reader::do_get_unused_symbol): New function.
4743         (Sized_incremental_binary::do_input_file_count): New function.
4744         (Sized_incremental_binary::do_get_input_reader): Change signature;
4745         use index instead of filename.
4746         (Sized_incremental_binary::section_map_): New data member.
4747         (Sized_incremental_binary::input_entry_readers_): New data member.
4748         (class Sized_incr_relobj): New class.
4749         (class Sized_incr_dynobj): New class.
4750         (make_sized_incremental_object): New function.
4751         (class Incremental_library): New class.
4752         * layout.cc (Free_list::num_lists): New static data member.
4753         (Free_list::num_nodes): New static data member.
4754         (Free_list::num_removes): New static data member.
4755         (Free_list::num_remove_visits): New static data member.
4756         (Free_list::num_allocates): New static data member.
4757         (Free_list::num_allocate_visits): New static data member.
4758         (Free_list::init): New function.
4759         (Free_list::remove): New function.
4760         (Free_list::allocate): New function.
4761         (Free_list::dump): New function.
4762         (Free_list::print_stats): New function.
4763         (Layout_task_runner::run): Resize output file for incremental updates.
4764         (Layout::Layout): Initialize new data members.
4765         (Layout::set_incremental_base): New function.
4766         (Layout::init_fixed_output_section): New function.
4767         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4768         incremental updates.
4769         (Layout::create_gold_note): Do not create gold note section for
4770         incremental updates.
4771         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4772         for incremental updates.
4773         (Layout::set_section_offsets): For incremental updates, allocate space
4774         from free list.
4775         (Layout::create_symtab_sections): Layout with offsets relative to
4776         start of section; for incremental updates, allocate space from free
4777         list.
4778         (Layout::create_shdrs): For incremental updates, allocate space from
4779         free list.
4780         (Layout::finish_dynamic_section): For incremental updates, do not
4781         check --as-needed (fixed in subsequent patch).
4782         * layout.h (class Free_list): New class.
4783         (Layout::set_incremental_base): New function.
4784         (Layout::incremental_base): New function.
4785         (Layout::init_fixed_output_section): New function.
4786         (Layout::allocate): New function.
4787         (Layout::incremental_base_): New data member.
4788         (Layout::free_list_): New data member.
4789         * main.cc (main): Print Free_list statistics.
4790         * object.cc (Relobj::finalize_incremental_relocs): Add
4791         clear_counts parameter; clear counts only when clear_counts is set.
4792         (Sized_relobj::Sized_relobj): Initialize new base class.
4793         (Sized_relobj::do_layout): Don't report special sections.
4794         (Sized_relobj::do_for_all_local_got_entries): New function.
4795         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4796         symtab_off to all symbol table offsets.
4797         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4798         * object.h (class Got_offset_list): Move to top of file.
4799         (Object::Object): Allow case where input_file == NULL.
4800         (Object::~Object): Likewise.
4801         (Object::input_file): Assert that input_file != NULL.
4802         (Object::lock): Allow case where input_file == NULL.
4803         (Object::unlock): Likewise.
4804         (Object::is_locked): Likewise.
4805         (Object::token): Likewise.
4806         (Object::release): Likewise.
4807         (Object::is_incremental): New function.
4808         (Object::get_mtime): New function.
4809         (Object::for_all_local_got_entries): New function.
4810         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4811         (Object::set_is_in_system_directory): New function.
4812         (Object::is_in_system_directory): New function.
4813         (Object::do_is_incremental): New function.
4814         (Object::do_get_mtime): New function.
4815         (Object::do_for_all_local_got_entries): New function.
4816         (Object::is_in_system_directory_): New data member.
4817         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4818         (class Sized_relobj_base): New class.
4819         (class Sized_relobj): Derive from Sized_relobj_base.
4820         (class Sized_relobj::Symbols): Redeclare from base class.
4821         (class Sized_relobj::local_got_offset_list): Remove.
4822         (class Sized_relobj::Output_sections): Redeclare from base class.
4823         (class Sized_relobj::do_for_all_local_got_entries): New function.
4824         (class Sized_relobj::write_local_symbols): Add offset parameter.
4825         (class Sized_relobj::local_symbol_offset_): Update comment.
4826         (class Sized_relobj::local_dynsym_offset_): Update comment.
4827         * options.cc (Input_arguments::add_file): Remove const.
4828         * options.h (Input_file_argument::Input_file_argument):
4829         Initialize arg_serial_ (all constructors).
4830         (Input_file_argument::set_arg_serial): New function.
4831         (Input_file_argument::arg_serial): New function.
4832         (Input_file_argument::arg_serial_): New data member.
4833         (Input_arguments::Input_arguments): Initialize file_count_.
4834         (Input_arguments::add_file): Remove const.
4835         (Input_arguments::number_of_input_files): New function.
4836         (Input_arguments::file_count_): New data member.
4837         (Command_line::number_of_input_files): Call
4838         Input_arguments::number_of_input_files.
4839         * output.cc (Output_segment_headers::Output_segment_headers):
4840         Set current size.
4841         (Output_section::Input_section::current_data_size): New function.
4842         (Output_section::Output_section): Initialize new data members.
4843         (Output_section::add_input_section): Don't do merge sections for
4844         an incremental link; allocate space from free list for an
4845         incremental update.
4846         (Output_section::add_output_section_data): Allocate space from
4847         free list for an incremental update.
4848         (Output_section::update_data_size): New function.
4849         (Output_section::set_fixed_layout): New function.
4850         (Output_section::reserve): New function.
4851         (Output_segment::set_section_addresses): Remove const.
4852         (Output_segment::set_section_list_addresses): Remove const; allocate
4853         space from free list for an incremental update.
4854         (Output_segment::set_offset): Adjust size of RELRO segment for an
4855         incremental update.
4856         * output.h (Output_data::current_data_size): Move here from
4857         child classes.
4858         (Output_data::pre_finalize_data_size): New function.
4859         (Output_data::update_data_size): New function.
4860         (Output_section_headers::update_data_size): new function.
4861         (Output_section_data_build::current_data_size): Move to Output_data.
4862         (Output_data_strtab::update_data_size): New function.
4863         (Output_section::current_data_size): Move to Output_data.
4864         (Output_section::set_fixed_layout): New function.
4865         (Output_section::has_fixed_layout): New function.
4866         (Output_section::reserve): New function.
4867         (Output_section::update_data_size): New function.
4868         (Output_section::has_fixed_layout_): New data member.
4869         (Output_section::free_list_): New data member.
4870         (Output_segment::set_section_addresses): Remove const.
4871         (Output_segment::set_section_list_addresses): Remove const.
4872         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4873         New function.
4874         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4875         New function.
4876         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4877         parameter when calling Add_symbols constructor; store argument
4878         serial number for members of a lib group.
4879         (Add_symbols::locks): Allow case where token == NULL.
4880         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4881         (Read_member::~Read_member): New function.
4882         (Read_member::is_runnable): New function.
4883         (Read_member::locks): New function.
4884         (Read_member::run): New function.
4885         (Check_script::~Check_script): New function.
4886         (Check_script::is_runnable): New function.
4887         (Check_script::locks): New function.
4888         (Check_script::run): New function.
4889         (Check_library::~Check_library): New function.
4890         (Check_library::is_runnable): New function.
4891         (Check_library::locks): New function.
4892         (Check_library::run): New function.
4893         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4894         (Add_symbols::library_): New data member.
4895         (class Read_member): New class.
4896         (class Check_script): New class.
4897         (class Check_library): New class.
4898         * reloc.cc (Read_relocs::is_runnable): Allow case where
4899         token == NULL.
4900         (Read_relocs::locks): Likewise.
4901         (Scan_relocs::locks): Likewise.
4902         (Relocate_task::locks): Likewise.
4903         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4904         to clear counters.
4905         (Sized_relobj::incremental_relocs_scan): Fix comment.
4906         (Sized_relobj::do_relocate): Pass output file offset to
4907         write_local_symbols.
4908         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4909         from class declaration.
4910         * script.cc (read_input_script): Allocate Script_info; pass
4911         argument serial number to report_script.
4912         * script.h (class Script_info): Move to incremental.h.
4913         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4914         * symtab.h (Symbol_table::add_from_incrobj): New function.
4915         (Symbol_table::set_file_offset): New function.
4916
4917 2011-04-05  Cary Coutant  <ccoutant@google.com>
4918
4919         * incremental-dump.cc (dump_incremental_inputs): Change signature
4920         to take a Sized_incremental_binary; change caller.  Use readers
4921         in Sized_incremental_binary.
4922         * incremental.cc
4923         (Sized_incremental_binary::find_incremental_inputs_sections):
4924         Rename do_find_incremental_inputs_sections to this.
4925         (Sized_incremental_binary::setup_readers): New function.
4926         (Sized_incremental_binary::do_check_inputs): Check
4927         has_incremental_info_ flag; move setup code to setup_readers;
4928         use input readers.
4929         (Sized_incremental_binary::do_file_is_unchanged): New function.
4930         (Sized_incremental_binary::do_get_input_reader): New function.
4931         * incremental.h (class Incremental_binary): Move to end of file.
4932         (Incremental_binary::file_is_unchanged): New function.
4933         (Incremental_binary::do_file_is_unchanged): New function.
4934         (Incremental_binary::Input_reader): New class.
4935         (Incremental_binary::get_input_reader): New function.
4936         (class Sized_incremental_binary): Move to end of file.
4937         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4938         input section reader classes.
4939         (Sized_incremental_binary::has_incremental_info): New function.
4940         (Sized_incremental_binary::inputs_reader): New function.
4941         (Sized_incremental_binary::symtab_reader): New function.
4942         (Sized_incremental_binary::relocs_reader): New function.
4943         (Sized_incremental_binary::got_plt_reader): New function.
4944         (Sized_incremental_binary::do_file_is_unchanged): New function.
4945         (Sized_incremental_binary::Sized_input_reader): New class.
4946         (Sized_incremental_binary::get_input_reader): New function.
4947         (Sized_incremental_binary::find_incremental_inputs_sections):
4948         Rename do_find_incremental_inputs_sections to this.
4949         (Sized_incremental_binary::setup_readers): New function.
4950         (Sized_incremental_binary::has_incremental_info_): New data member.
4951         (Sized_incremental_binary::inputs_reader_): New data member.
4952         (Sized_incremental_binary::symtab_reader_): New data member.
4953         (Sized_incremental_binary::relocs_reader_): New data member.
4954         (Sized_incremental_binary::got_plt_reader_): New data member.
4955         (Sized_incremental_binary::current_input_file_): New data member.
4956
4957 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4958
4959         PR gold/12640
4960         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4961         violation.
4962
4963 2011-03-30  Cary Coutant  <ccoutant@google.com>
4964
4965         * archive.cc (Archive::include_member): Adjust call to report_object.
4966         (Add_archive_symbols::run): Add script_info to call to
4967         report_archive_begin.
4968         (Lib_group::include_member): Adjust call to report_object.
4969         (Add_lib_group_symbols::run): Adjust call to report_object.
4970         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4971         blocks.  Add object count for script input files.
4972         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4973         script_info parameter; change all callers.
4974         (Incremental_inputs::report_object): Add script_info parameter;
4975         change all callers.
4976         (Incremental_inputs::report_script): Store backpointer to
4977         incremental info entry.
4978         (Output_section_incremental_inputs::set_final_data_size): Record
4979         additional information for scripts.
4980         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4981         * incremental.h (Incremental_script_entry::add_object): New function.
4982         (Incremental_script_entry::get_object_count): New function.
4983         (Incremental_script_entry::get_object): New function.
4984         (Incremental_script_entry::objects_): New data member; adjust
4985         constructor.
4986         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4987         (Incremental_inputs::report_object): Add script_info parameter.
4988         (Incremental_inputs_reader::get_object_count): New function.
4989         (Incremental_inputs_reader::get_object_offset): New function.
4990         * options.cc (Input_arguments::add_file): Return reference to
4991         new input argument.
4992         * options.h (Input_argument::set_script_info): New function.
4993         (Input_argument::script_info): New function.
4994         (Input_argument::script_info_): New data member; adjust all
4995         constructors.
4996         (Input_file_group::add_file): Return reference to new input argument.
4997         (Input_file_lib::add_file): Likewise.
4998         (Input_arguments::add_file): Likewise.
4999         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5000         * script.cc (Parser_closure::Parser_closure): Add script_info
5001         parameter; adjust all callers.
5002         (Parser_closure::script_info): New function.
5003         (Parser_closure::script_info_): New data member.
5004         (read_input_script): Report scripts earlier to incremental info.
5005         (script_add_file): Set script_info in Input_argument.
5006         (script_add_library): Likewise.
5007         * script.h (Script_options::Script_info): Rewrite class.
5008
5009 2011-03-29  Cary Coutant  <ccoutant@google.com>
5010
5011         * archive.cc (Library_base::should_include_member): Move
5012         method here from class Archive.
5013         (Archive::Archive): Initialize base class.
5014         (Archive::should_include_member): Move to base class.
5015         (Archive::do_for_all_unused_symbols): New function.
5016         (Add_archive_symbols::run): Remove redundant access to
5017         incremental_inputs.
5018         (Lib_group::Lib_group): Initialize base class.
5019         (Lib_group::do_filename): New function.
5020         (Lib_group::include_member): Pass pointer to Lib_group to
5021         report_object.
5022         (Lib_group::do_for_all_unused_symbols): New function.
5023         (Add_lib_group_symbols::run): Report archive information for
5024         incremental links.
5025         * archive.h (class Library_base): New base class.
5026         (class Archive): Derive from Library_base.
5027         (Archive::filename): Move to base class.
5028         (Archive::set_incremental_info): Likewise.
5029         (Archive::incremental_info): Likewise.
5030         (Archive::Should_include): Likewise.
5031         (Archive::should_include_member): Likewise.
5032         (Archive::Armap_entry): Remove.
5033         (Archive::Unused_symbol_iterator): Remove.
5034         (Archive::unused_symbols_begin): Remove.
5035         (Archive::unused_symbols_end): Remove.
5036         (Archive::do_filename): New function.
5037         (Archive::do_get_mtime): New function.
5038         (Archive::do_for_all_unused_symbols): New function.
5039         (Archive::task_): Move to base class.
5040         (Archive::incremental_info_): Likewise.
5041         (class Lib_group): Derive from Library_base.
5042         (Lib_group::do_filename): New function.
5043         (Lib_group::do_get_mtime): New function.
5044         (Lib_group::do_for_all_unused_symbols): New function.
5045         (Lib_group::task_): Move to base class.
5046         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5047         function.
5048         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5049         function.
5050         * incremental.cc (Incremental_inputs::report_archive_begin):
5051         Use Library_base; call library's get_mtime; add incremental inputs
5052         entry before members.
5053         (class Unused_symbol_visitor): New class.
5054         (Incremental_inputs::report_archive_end): Use Library_base; use
5055         visitor class to record unused symbols; don't add incremental inputs
5056         entry after members.
5057         (Incremental_inputs::report_object): Use Library_base.
5058         * incremental.h
5059         (Incremental_archive_entry::Incremental_archive_entry): Remove
5060         unused Archive parameter.
5061         (Incremental_inputs::report_archive_begin): Use Library_base.
5062         (Incremental_inputs::report_archive_end): Likewise.
5063         (Incremental_inputs::report_object): Likewise.
5064         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5065         function.
5066         * object.h (Object::for_all_global_symbols): New function.
5067         (Object::do_for_all_global_symbols): New function.
5068         (Sized_relobj::do_for_all_global_symbols): New function.
5069         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5070         function.
5071         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5072         function.
5073
5074 2011-03-27  Ian Lance Taylor  <iant@google.com>
5075
5076         * archive.cc (Archive::interpret_header): Return -1 if something
5077         goes wrong.  Change callers accordingly.
5078
5079 2011-03-25  Cary Coutant  <ccoutant@google.com>
5080
5081         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5082         * testsuite/Makefile.in: Regenerate.
5083
5084 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5085
5086         * plugin.cc (get_view): New.
5087         (Plugin::load): Pass get_view to the plugin.
5088         (Plugin_manager::get_view): New.
5089
5090 2011-03-21  Ian Lance Taylor  <iant@google.com>
5091
5092         * testsuite/final_layout.sh: Rewrite to not use dc.
5093         * testsuite/relro_test.sh: Fail if dc is not present.
5094
5095 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5096
5097         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5098         Change == to -eq.
5099         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5100         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5101         Change == to -eq.
5102         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5103         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5104
5105 2011-03-14  Ian Lance Taylor  <iant@google.com>
5106
5107         * script-sections.cc (Sort_output_sections::script_compare):
5108         Rename from is_before, change return type.
5109         (Sort_output_sections::operator()): Adjust accordingly.
5110
5111 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5112
5113         PR gold/12572
5114         * testsuite/odr_violation2.cc: Add comment to make all error line
5115         numbers double digits.
5116         * testsuite/debug_msg.sh: Adjust expected errors.
5117
5118 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5119
5120         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5121         but mark earlier ones as non-canonical
5122         (offset_to_iterator): Update search target and example
5123         (do_addr2line): Return extra lines in a vector*
5124         (format_file_lineno): Extract from do_addr2line
5125         (one_addr2line): Add vector* out-param
5126         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5127         when a lineno entry appeared last for its instruction
5128         (Dwarf_line_info): Add vector* out-param
5129         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5130         * symtab.cc (Odr_violation_compare): Include the lineno in the
5131         comparison again.
5132         (linenos_from_loc): New. Combine the canonical line for an
5133         address with its other lines.
5134         (True_if_intersect): New. Helper functor to make
5135         std::set_intersection a query.
5136         (detect_odr_violations): Compare sets of lines instead of just
5137         one line for each function. This became less deterministic, but
5138         has fewer false positives.
5139         * symtab.h: Declarations.
5140         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5141         mix an optimized and non-optimized object in the same binary
5142         (odr_violation2.so): Same.
5143         * testsuite/Makefile.in: Regenerate from Makefile.am.
5144         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5145         * testsuite/debug_msg.sh: Update line numbers and add
5146         assertions.
5147         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5148         non-optimized context.
5149         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5150         isn't inlined, and use OdrDerived in an optimized context.
5151         * testsuite/odr_header1.h: Defines OdrDerived, where
5152         optimization will change the
5153         first-instruction-in-the-destructor's file and line number.
5154         * testsuite/odr_header2.h: Defines OdrBase.
5155
5156 2011-03-09  Ian Lance Taylor  <iant@google.com>
5157
5158         * fileread.cc (File_read::clear_views): Don't delete the whole
5159         file view.
5160
5161 2011-03-08  Ian Lance Taylor  <iant@google.com>
5162
5163         PR gold/12525
5164         * fileread.cc: #include <climits>.
5165         (GOLD_IOV_MAX): Define.
5166         (File_read::read_multiple): Limit number of entries by iov_max.
5167         * fileread.h (class File_read): Always set max_readv_entries to
5168         128.
5169
5170 2011-03-07  Ian Lance Taylor  <iant@google.com>
5171
5172         PR gold/12525
5173         * options.h (class General_options): Add -dy and -dn.
5174
5175 2011-03-02  Cary Coutant  <ccoutant@google.com>
5176
5177         * testsuite/script_test_9.t: Add TLS segment.
5178
5179 2011-03-02  Simon Baldwin  <simonb@google.com>
5180
5181         * configure.ac: Add check for gnu_indirect_function support in
5182         the toolchain building binutils.
5183         * configure: Rebuild.
5184
5185 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5186
5187         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5188         plugin only symbols.
5189         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5190         in plugin files as not needed in the symbol table.
5191
5192 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5193
5194         * output.cc (Output_section::add_input_section): Delay fill
5195         generation for section ordering.
5196
5197 2011-02-09  Ian Lance Taylor  <iant@google.com>
5198
5199         PR gold/12316
5200         * object.h (class Sized_relobj): Remove clear_local_symbols.
5201         * reloc.cc (Sized_relobj::do_relocate): Don't call
5202         clear_local_symbols.
5203
5204 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5205
5206         * plugin.cc (is_visible_from_outside): Return true for symbols
5207         in the -u option.
5208
5209 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5210
5211         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5212         filename.
5213
5214 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5215
5216         * icf.h (is_section_foldable_candidate): Change type of parameter
5217         to std::string.
5218         * icf.cc (Icf::find_identical_sections): Change type of local variable
5219         section_name to be std::string.
5220         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5221
5222 2011-01-25  Ian Lance Taylor  <iant@google.com>
5223
5224         * script.cc (script_add_extern): Rewrite to use
5225         add_symbol_reference.
5226
5227 2011-01-25  Doug Kwan  <dougkwan@google.com>
5228
5229         * icf.cc (get_section_contents): Always lock section's object.
5230
5231 2011-01-24  Ian Lance Taylor  <iant@google.com>
5232
5233         * options.h (class General_options): Accept
5234         --no-detect-odr-violations.
5235
5236 2011-01-24  Ian Lance Taylor  <iant@google.com>
5237
5238         * version.cc (version_string): Bump to 1.11.
5239
5240 2011-01-24  Ian Lance Taylor  <iant@google.com>
5241
5242         * plugin.cc (class Plugin_rescan): Define new class.
5243         (Plugin_manager::claim_file): Set any_claimed_.
5244         (Plugin_manager::save_archive): New function.
5245         (Plugin_manager::save_input_group): New function.
5246         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5247         necessary.
5248         (Plugin_manager::new_undefined_symbol): New function.
5249         (Plugin_manager::rescan): New function.
5250         (Plugin_manager::rescannable_defines): New function.
5251         (Plugin_manager::add_input_file): Set any_added_.
5252         * plugin.h (class Plugin_manager): define new fields rescannable_,
5253         undefined_symbols_, any_claimed_, and any_added_.  Declare
5254         Plugin_rescan as friend.  Declare new functions.
5255         (Plugin_manager::Rescannable): Define type.
5256         (Plugin_manager::Rescannable_list): Define type.
5257         (Plugin_manager::Undefined_symbol_list): Define type.
5258         (Plugin_manager::Plugin_manager): Initialize new fields.
5259         * archive.cc (Archive::defines_symbol): New function.
5260         (Add_archive_symbols::run): Pass archive to plugins if any.
5261         * archive.h (class Archive): Declare defines_symbol.
5262         * readsyms.cc (Input_group::~Input_group): New function.
5263         (Finish_group::run): Pass input_group to plugins if any.
5264         * readsyms.h (class Input_group): Declare destructor.
5265         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5266         any.
5267
5268 2011-01-10  Ian Lance Taylor  <iant@google.com>
5269
5270         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5271         section as relro.
5272         (Layout::set_segment_offsets): Reset increase_relro before calling
5273         set_section_addresses a second time.
5274
5275 2011-01-04  Cary Coutant  <ccoutant@google.com>
5276
5277         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5278         sections before NOBITS sections.
5279
5280 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5281
5282         * version.cc (print_version): Update copyright to 2011.
5283
5284 2010-12-23  Cary Coutant  <ccoutant@google.com>
5285
5286         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5287         of OS to this->add.  Add OD parameter to second form of the function.
5288
5289 2010-12-20  Ian Lance Taylor  <iant@google.com>
5290
5291         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5292         second of two consecutive entries with same offset.
5293
5294 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5295
5296         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5297         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5298         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5299         to avoid unneeded links against $(LDADD).
5300         * testsuite/Makefile.in: Regenerate.
5301
5302 2010-12-15  Ian Lance Taylor  <iant@google.com>
5303
5304         PR gold/12324
5305         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5306         for R_X86_64_32 and R_X86_64_PC32.
5307         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5308         ver_matching_def_pic.o.
5309         (ver_matching_def_pic.o): New target.
5310
5311 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5312
5313         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5314         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5315         Move definition before File_read::View member definitions.
5316         (File_read::View::~View): Initialize and hold lock before
5317         updating current_mapped_bytes.
5318
5319 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5320
5321         * dwarf_reader.cc: Remove outdated comment.
5322         * gold-threads.cc: Fix typo in error message.
5323         * archive.cc: Fix typos in comments.
5324         * archive.h: Likewise.
5325         * arm-reloc-property.cc: Likewise.
5326         * arm-reloc-property.h: Likewise.
5327         * arm-reloc.def: Likewise.
5328         * arm.cc: Likewise.
5329         * attributes.h: Likewise.
5330         * cref.cc: Likewise.
5331         * ehframe.cc: Likewise.
5332         * fileread.h: Likewise.
5333         * gold.h: Likewise.
5334         * i386.cc: Likewise.
5335         * icf.cc: Likewise.
5336         * incremental.h: Likewise.
5337         * int_encoding.cc: Likewise.
5338         * layout.h: Likewise.
5339         * main.cc: Likewise.
5340         * merge.h: Likewise.
5341         * object.cc: Likewise.
5342         * object.h: Likewise.
5343         * options.cc: Likewise.
5344         * readsyms.cc: Likewise.
5345         * reduced_debug_output.cc: Likewise.
5346         * reloc.cc: Likewise.
5347         * script-sections.cc: Likewise.
5348         * sparc.cc: Likewise.
5349         * symtab.h: Likewise.
5350         * target-reloc.h: Likewise.
5351         * target.cc: Likewise.
5352         * target.h: Likewise.
5353         * timer.cc: Likewise.
5354         * timer.h: Likewise.
5355         * x86_64.cc: Likewise.
5356
5357 2010-12-09  Cary Coutant  <ccoutant@google.com>
5358
5359         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5360         stack.
5361         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5362         parameter; change all callers.
5363         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5364         * options.h (warn_execstack): New option.
5365
5366 2010-12-07  Doug Kwan  <dougkwan@google.com>
5367
5368         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5369         like function call relocations.
5370
5371 2010-12-07  Ian Lance Taylor  <iant@google.com>
5372
5373         * archive.cc (Archive::get_elf_object_for_member): Permit
5374         punconfigured to be NULL.
5375         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5376         (Archive::include_member): Pass NULL to get_elf_object_for_member
5377         if we searched for the archive and this is the first included
5378         object.
5379
5380 2010-12-01  Ian Lance Taylor  <iant@google.com>
5381
5382         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5383         track_relocs_type_ field.
5384         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5385         Set track_relocs_type_.
5386         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5387         contents when using RELA relocs.
5388         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5389         reloc_map_.
5390         * reloc.cc (Track_relocs::next_addend): New function.
5391         * reloc.h (class Track_relocs): Declare next_addend.
5392
5393 2010-12-01  Ian Lance Taylor  <iant@google.com>
5394
5395         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5396         virtual destructor.
5397
5398 2010-12-01  Ian Lance Taylor  <iant@google.com>
5399
5400         * README: Update compilers known to work and fail.
5401
5402 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5403
5404         * configure.in: For --enable-gold, handle value `default' instead of
5405         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5406         not the default.
5407         * configure: Regenerate.
5408
5409 2010-11-18  Doug Kwan  <dougkwan@google.com>
5410
5411         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5412         and right_alignment to be zero.  Store result alignment only if it is
5413         greater than existing alignment.
5414
5415 2010-11-16  Cary Coutant  <ccoutant@google.com>
5416
5417         PR gold/12220
5418         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5419         Check for ".zdebug_line".
5420
5421 2010-11-16  Doug Kwan  <dougkwan@google.com>
5422             Cary Coutant  <ccoutant@google.com>
5423
5424         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5425         by reference; adjust all callers.
5426         * output.cc (Output_segment::set_section_addresses): Adjust references
5427         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5428         list is empty.
5429         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5430         end at page boundary.
5431
5432 2010-11-16  Cary Coutant  <ccoutant@google.com>
5433
5434         PR gold/12220
5435         * layout.cc (Layout::choose_output_section): Transform names of
5436         compressed sections even when using a script with a SECTIONS clause.
5437         (Layout::output_section_name): Remove code to transform
5438         compressed debug section names.
5439         * output.cc (Output_section::add_input_section): Use uncompressed
5440         section size when tracking input sections.
5441
5442 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5443
5444         * symtab.h (Symbol::NON_PIC_REF): Remove.
5445         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5446         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5447         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5448         (Symbol::use_plt_offset): Take a flags argument and pass it
5449         directly to needs_dynamic_reloc.  Restrict check for undefined
5450         weak symbols to function calls.
5451         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5452         (Target_arm::Scan::global): Use it.
5453         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5454         (Target_arm::Relocate::relocate): Likewise.
5455         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5456         parameter with an r_type parameter.  Use get_reference_flags
5457         to get the flags.
5458         (Target_arm::Relocate::relocate): Update accordingly.
5459         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5460         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5461         (Target_i386::Scan::global): Likewise.
5462         (Target_i386::Relocate::relocate): Likewise.
5463         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5464         parameter with an r_type parameter.  Use get_reference_flags
5465         to get the flags.
5466         (Target_i386::Relocate::relocate): Update accordingly.
5467         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5468         (Target_powerpc::Scan::global): Use it.
5469         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5470         (Target_powerpc::Relocate::relocate): Likewise.
5471         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5472         (Target_sparc::Scan::global): Use it.
5473         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5474         (Target_sparc::Relocate::relocate): Likewise.
5475         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5476         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5477         (Target_x86_64::Scan::global): Likewise.
5478         (Target_x86_64::Relocate::relocate): Likewise.
5479
5480 2010-11-08  Doug Kwan  <dougkwan@google.com>
5481             Cary Coutant  <ccoutant@google.com>
5482
5483         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5484         (Arm_exidx_merge_section::section_contents_): New data member.
5485         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5486         (Arm_input_section::~Arm_input_section): De-allocate memory.
5487         (Arm_input_section::original_contents_): New data member.
5488         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5489         in parameters instead of calling Object::section_contents without
5490         locking.
5491         (Arm_output_section::group_section): New parameter TASK.  Pass it
5492         to callees that need locking objects.
5493         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5494         to lock EXIDX input sections.  Fix a formatting issue.  Call
5495         Arm_exidx_merged_section::build_contents to create merged section
5496         contents.
5497         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5498         to lock object of stub table owner.
5499         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5500         TEXT_SIZE to initialize data member TEXT_SIZE_.
5501         (Arm_exidx_input_section::addralign): Fix typo in comment.
5502         (Arm_exidx_input_section::text_size): New method.
5503         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5504         that require locking objects.  Lock objects before scanning for stubs
5505         and updating local symbols.
5506         (Arm_input_section<big_endian>::init): Copy contents of original
5507         input section.
5508         (Arm_input_section<big_endian>::do_write): Use saved contents of
5509         original input section instead of calling Object::section_contents
5510         without locking.
5511         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5512         size without calling Object::section_size().
5513         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5514         for size.  Allocate a buffer for merged EXIDX entries.
5515         (Arm_exidx_merged_section::build_contents): New method.
5516         (Arm_exidx_merged_section::do_write): Move merge section contents
5517         building code to Arm_exidx_merged_section::build_contetns.  Write
5518         out contetns in buffer instead of building it on the fly.
5519         (Arm_relobj::make_exidx_input_section): Also pass text section size
5520         to Arm_exidx_input_section constructor.
5521         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5522         (Arm_dynobj::do_read_symbols): Fix memory leak.
5523         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5524         * target.h: (class Task): Add forward declaration.
5525         (Target::relax): Add new parameter TASK and pass it to
5526         Target::do_relax().
5527         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5528
5529 2010-11-05  Cary Coutant  <ccoutant@google.com>
5530
5531         PR gold/10708
5532         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5533         object when reading from the file.
5534         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5535         second layout pass.
5536         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5537         when reading section contents.
5538         (get_section_contents): Likewise.
5539         (icf::find_identical_sections): Likewise.
5540         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5541         object when reading from the file.
5542         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5543         the object when doing deferred section layout.
5544
5545 2010-11-03  Nick Clifton  <nickc@redhat.com>
5546
5547         PR gold/12001
5548         * script.h (class Symbol_assignment: name): New member.  Returns
5549         the name of the symbol.
5550         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5551         Returns true if the given symbol name is on the list of
5552         assignments wating to be processed.
5553         * archive.cc (should_incldue_member): If the symbol is undefined,
5554         check to see if it is on the list of symbols pending assignment.
5555
5556 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5557
5558         * script-sections.cc (Script_sections::find_memory_region): Check
5559         for a NULL output section pointer.
5560
5561 2010-10-29  Doug Kwan  <dougkwan@google.com>
5562
5563         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5564         Output_section::add_relaxed_input_section.
5565         * output.cc (Output_section::add_relaxed_input_section): Add new
5566         arguments LAYOUT and NAME.  Set section order index.
5567         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5568         Copy section order index.
5569         * output.h (Output_section::add_relaxed_input_section): Add new
5570         arguments LAYOUT and NAME.
5571
5572 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5573
5574         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5575         NATIVE_OR_CROSS_LINKER.
5576         * testsuite/Makefile.in: Regenerate.
5577
5578 2010-10-20  Doug Kwan  <dougkwan@google.com>
5579
5580         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5581         without SHF_LINK_ORDER flags.
5582         * layout.cc (Layout::choose_output_section): Do not filter
5583         SHF_LINK_ORDER flag in a relocatable link.
5584
5585 2010-10-17  Cary Coutant  <ccoutant@google.com>
5586
5587         * output.h (Output_segment::set_section_addresses): Change function
5588         signature.  Update all callers.
5589         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5590         sections.
5591         (Output_segment::set_section_addresses): Align after last TLS
5592         section.  Add padding before last relro section instead of after.
5593
5594 2010-10-17  Doug Kwan  <dougkwan@google.com>
5595
5596         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5597         GOT output section to be writable.
5598
5599 2010-10-14  Cary Coutant  <ccoutant@google.com>
5600
5601         * debug.h (DEBUG_INCREMENTAL): New flag.
5602         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5603         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5604         mode.
5605         * incremental.cc (report_command_line): Ignore all forms of
5606         --incremental.
5607         * layout.cc (Layout::Layout): Check parameters for incremental link
5608         mode.
5609         * options.cc (General_options::parse_incremental): New function.
5610         (General_options::parse_no_incremental): New function.
5611         (General_options::parse_incremental_full): New function.
5612         (General_options::parse_incremental_update): New function.
5613         (General_options::incremental_mode_): New data member.
5614         (General_options::finalize): Check incremental_mode_.
5615         * options.h (General_options): Update help text for --incremental.
5616         Add --no-incremental, --incremental-full, --incremental-update.
5617         (General_options::Incremental_mode): New enum type.
5618         (General_options::incremental_mode): New function.
5619         (General_options::incremental_mode_): New data member.
5620         * parameters.cc (Parameters::incremental_mode_): New data member.
5621         (Parameters::set_options): Set incremental_mode_.
5622         (Parameters::set_incremental_full): New function.
5623         (Parameters::incremental): New function.
5624         (Parameters::incremental_update): New function.
5625         (set_parameters_incremental_full): New function.
5626         * parameters.h (Parameters::set_incremental_full): New function.
5627         (Parameters::incremental): New function.
5628         (Parameters::incremental_update): New function.
5629         (Parameters::incremental_mode_): New data member.
5630         (set_parameters_incremental_full): New function.
5631         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5632         incremental link mode.
5633         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5634         (Sized_relobj::do_relocate_sections): Likewise.
5635         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5636         option.
5637         * testsuite/Makefile.in: Regenerate.
5638         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5639
5640 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5641
5642         * script-sections.h (class Script_sections): Make
5643         Sections_elements typedef public.
5644         * script-sections.cc (class Sort_output_sections): Add elements_
5645         field.  Add constructor which sets it; change all callers.
5646         (Sort_output_sections::is_before): New function.
5647         (Sort_output_sections::operator()): Call is_before.
5648         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5649         conditional.
5650         * testsuite/script_test_10.sh: New test. Test script section
5651         order.
5652         * testsuite/script_test_10.t: Likewise.
5653         * testsuite/script_test_10.s: Likewise.
5654         * testsuite/Makefile.am: Wrap the cross linker tests and the
5655         common tests into NATIVE_OR_CROSS_LINKER.
5656         (check_SCRIPTS): Add script_test_10.sh.
5657         (check_DATA): Add script_test_10.stdout.
5658         (script_test_10.o, script_test_10): New targets.
5659         (script_test_10.stdout): New target.
5660         * configure, testsuite/Makefile.in: Regenerate.
5661
5662 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5663
5664         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5665         error for the deprecated relocations.
5666         (Target_arm::Scan::global): Likewise.
5667         (Target_arm::Relocate::relocate): Likewise.
5668
5669 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5670
5671         * fileread.cc (Input_file::find_file): Initialize *found_name
5672         and *namep when using the fallback search for case 4.
5673
5674 2010-10-11  Cary Coutant  <ccoutant@google.com>
5675
5676         * options.h (class General_options): Redefine -z lazy as an alias for
5677         the negation of -z now.
5678
5679 2010-10-11  Ian Lance Taylor  <iant@google.com>
5680
5681         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5682         binding.
5683
5684 2010-10-06  Nick Clifton  <nickc@redhat.com>
5685
5686         * script-sections.cc(class Memory_region): Remove
5687         current_lma_offset_ field.  Rename current_vma_offset_ to
5688         current_offset_.  Add last_section_ field.
5689         (Memory_region::get_current_vma_address): Rename to
5690         get_current_address.
5691         (Memory_region::get_current_lma_address): Delete.
5692         (Memory_region::increment_vma_offset): Rename to
5693         increment_offset.
5694         (Memory_region::increment_lma_offset): Delete.
5695         (Memory_region::attributes_compatible): New method.  Returns
5696         true if the provided section is compatible with the region.
5697         (Memory_region::get_last_section): New method.  Returns the last
5698         section to use the region.
5699         (Memory_region::set_last_section): New method.  Stores the last
5700         section to use the region.
5701         (Script_sections::block_in_region): New method.  Returns true if
5702         a block of memory is contained within a region.
5703         (Script_sections::find_memory_region): New method.  Locates a
5704         memory region to be used to set a VMA or LMA address.
5705         (Output_section_definition::set_section_addresses): Add code to
5706         check for addresses set by memory regions.
5707         (Output_segment::set_section_addresses): Remove memory region
5708         walking code.
5709         (Script_sections::create_segment): Add a warning if a header
5710         segment is created outside of any region.
5711         * script-sections.h (class Script_sections): Add prototypes for
5712         find_memory_region and block_in_region methods.
5713         * testsuite/memory_test.s: Use .long instead of .word.
5714         * testsuite/memory_test.t: Add some more output sections.
5715         * testsuite/memory_test.sh: Update expected output.
5716
5717 2010-10-02  Doug Kwan  <dougkwan@google.com>
5718
5719         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5720         defintion to symtab.h
5721         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5722         declaration to defintion.
5723
5724 2010-10-01  Nick Clifton  <nickc@redhat.com>
5725
5726         * expression.cc (eval): Replace dummy argument with NULL.
5727         (eval_maybe_dot): Check for a NULL result section pointer.
5728         (Symbol_expression::value): Likewise.
5729         (Dot_expression::value): Likewise.
5730         (BINARY_EXPRESSION): Likewise.
5731         (Max_expression::value): Likewise.
5732         (Min_expression::value): Likewise.
5733         (Absolute_expression::value): Likewise.
5734         (Addr_expression::value_from_output_section): Likewise.
5735         (Loaddddr_expression::value_from_output_section): Likewise.
5736         (Segment_start_expression::value): Likewise.
5737         * script-sections.cc
5738         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5739         argument with NULL.
5740         (Sections_elememt_dot_assignment::set_section_addresses):
5741         Likewise.
5742         (Output_data_expression::do_write_to_buffer): Likewise.
5743         (Output_section_definition::finalize_symbols): Likewise.
5744         (Output_section_definition::set_section_addresses): Likewise.
5745
5746 2010-09-30  Doug Kwan  <dougkwan@google.com>
5747
5748         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5749
5750 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5751
5752         * target.h (Target::can_icf_inline_merge_sections): New virtual
5753         function.
5754         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5755         virtual function.
5756         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5757         virtual function.
5758         * icf.cc (get_section_contents): Inline merge sections only when
5759         target allows it.
5760
5761 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5762
5763         * configure: Regenerate.
5764
5765 2010-09-17  Ian Lance Taylor  <iant@google.com>
5766
5767         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5768         * testsuite/Makefile.am (memory_test.o): New target.
5769         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5770         memory_test.t.
5771         * testsuite/Makefile.in: Rebuild.
5772
5773 2010-09-17  Doug Kwan  <dougkwan@google.com>
5774
5775         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5776         defintion if relocation uses GOT entries of the symbol.
5777         * testsuite/icf_safe_test.sh: Fix test.
5778         * testsuite/icf_safe_so_test.sh: Fix test.
5779
5780 2010-09-16  Cary Coutant  <ccoutant@google.com>
5781
5782         * script_sections.cc (class Memory_region): Remove "NULL" from
5783         vector initializations.
5784
5785 2010-09-15  Cary Coutant  <ccoutant@google.com>
5786
5787         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5788         Resolve forwarding symbols.
5789
5790 2010-09-15  Doug Kwan  <dougkwan@google.com>
5791
5792         * gold/testsuite/script_test_3.t: Add ARM special sections.
5793         * gold/testsuite/script_test_4.t: Same.
5794         * gold/testsuite/script_test_5.t: Same.
5795         * gold/testsuite/script_test_6.t: Same.
5796         * gold/testsuite/script_test_7.t: Same.
5797         * gold/testsuite/script_test_7.t: Same.
5798         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5799
5800 2010-09-14  Cary Coutant  <ccoutant@google.com>
5801
5802         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5803         (Target_x86_64::Relocate::relocate_tls): Replace check for
5804         saw_tls_block_reloc_ with test for executable section.
5805
5806 2010-09-12  Cary Coutant  <ccoutant@google.com>
5807
5808         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5809         position-independent executables to shared libraries need dynamic
5810         relocations.
5811         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5812         position-independent executables.
5813         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5814         * testsuite/Makefile.in: Regenerate.
5815
5816 2010-09-10  Nick Clifton  <nickc@redhat.com>
5817
5818         PR gold/11997
5819         * testsuite/memory_test.t: Discard any sections that are not
5820         needed.
5821
5822 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5823
5824         PR gold/11996
5825         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5826         "This::" to work around a bug in gcc 4.2.
5827
5828         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5829
5830 2010-09-09  Rafael Espindola  <espindola@google.com>
5831
5832         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5833         sections with different PF_X flags in the same segment.
5834         (Layout::find_first_load_seg): Search all segments to find the first
5835         one.
5836         * options.h (rosegment): New.
5837
5838 2010-09-08  Rafael Espindola  <espindola@google.com>
5839
5840         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5841
5842 2010-09-08  Doug Kwan  <dougkwan@google.com>
5843
5844         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5845         (Arm_relobj::do_relocate_sections): Add new parameter for output
5846         file to match the parent.
5847         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5848         of local symbols instead of input values.  Update code to track
5849         changes in gold::relocate_section.
5850         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5851         (Sized_relobj::compute_final_local_value_internal): New methods.
5852         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5853         body into private version of Sized_relobj::compute_final_local_value.
5854         Call the inline method.
5855         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5856         merged symbol value if there is one.
5857         (Symbol_value::has_output_value): New method defintiion.
5858         (Sized_relobj::Compute_final_local_value_status): New enum type.
5859         (Sized_relobj::compute_final_local_value): New methods.
5860         (Sized_relobj::compute_final_local_value_internal): New methods.
5861         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5862         and arm_cortex_a8.sh.
5863         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5864         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5865         New tests.
5866         * Makefile.in: Regenerate.
5867         * testsuite/arm_bl_out_of_range.s: Update test.
5868         * testsuite/thumb_bl_out_of_range.s: Ditto.
5869         * testsuite/thumb_blx_out_of_range.s: Ditto.
5870         * testsuite/arm_branch_out_of_range.sh: New file.
5871         * testsuite/arm_cortex_a8.sh: Ditto.
5872         * testsuite/arm_cortex_a8_b.s: Ditto.
5873         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5874         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5875         * testsuite/arm_cortex_a8_bl.s: Ditto.
5876         * testsuite/arm_cortex_a8_blx.s: Ditto.
5877         * testsuite/arm_cortex_a8_local.s: Ditto.
5878         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5879         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5880
5881 2010-09-08  Rafael Espindola  <espindola@google.com>
5882
5883         * Makefile.am (memory_test.stdout): Run readelf with -W.
5884         * Makefile.in: Regenerate.
5885         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5886         64 bit output.
5887
5888 2010-09-08  Rafael Espindola  <espindola@google.com>
5889
5890         * script-sections.cc (Script_sections::add_memory_region): Convert
5891         field precision to int.
5892         * script.cc (script_set_section_region, script_set_section_region):
5893         Convert field precision to int.
5894
5895 2010-09-08  Rafael Espindola  <espindola@google.com>
5896
5897         * arm.cc (do_finalize_sections): Create the __exidx_start and
5898         __exdix_end symbols even when the section is missing.
5899
5900 2010-09-08  Nick Clifton  <nickc@redhat.com>
5901
5902         * README: Remove claim that MEMORY is not supported.
5903         * expression.cc (script_exp_function_origin)
5904         (script_exp_function_length): Move from here to ...
5905         * script.cc: ... here.
5906         (script_set_section_region, script_add_memory)
5907         (script_parse_memory_attr, script_include_directive): New
5908         functions.
5909         * script-sections.cc
5910         (class Memory_region): New class.
5911         (class Output_section_definition): Add set_memory_region,
5912         set_section_vma, set_section_lma and get_section_name methods.
5913         (class Script_Sections): Add add_memory_region,
5914         find_memory_region, find_memory_region_origin,
5915         find_memory_region_length and set_memory_region methods.
5916         Have set_section_addresses method walk the list of set memory
5917         regions.
5918         Extend the print methos to display memory regions.
5919         * script-sections.h: Add prototypes for new methods.
5920         Add enum for MEMORY region attributes.
5921         * yyscript.y: Add support for parsing MEMORY regions.
5922         * script-c.h: Add prototypes for new functions.
5923         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5924         * testsuite/Makefile.in: Regenerate.
5925         * testsuite/memory_test.sh: New script.
5926         * testsuite/memory_test.s: New assembler source file.
5927         * testsuite/memory_test.t: New linker script.
5928
5929 2010-08-27  Doug Kwan  <dougkwan@google.com>
5930
5931         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5932         reference override an existing dynamic weak reference.
5933         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5934         * testsuite/Makefile.in: Regenerate.
5935         * testsuite/dyn_weak_ref.sh: New file.
5936         * testsuite/dyn_weak_ref_1.c: Ditto.
5937         * testsuite/dyn_weak_ref_2.c: Ditto.
5938
5939 2010-08-27  Ian Lance Taylor  <iant@google.com>
5940
5941         * incremental.h (class Incremental_input_entry): Add virtual
5942         destructor.
5943
5944 2010-08-27  Ian Lance Taylor  <iant@google.com>
5945
5946         * testsuite/start_lib_test_3.c: Mark t3 as used.
5947
5948 2010-08-27  Nick Clifton  <nickc@redhat.com>
5949
5950         * options.cc (version_script): Fix small typo in previous
5951         whitespace tidyup.
5952
5953 2010-08-25  Nick Clifton  <nickc@redhat.com>
5954
5955         * archive.cc: Formatting fixes: Remove whitespace between
5956         typename and following asterisk.  Remove whitespace between
5957         function name and opening parenthesis.
5958         * archive.h: Likewise.
5959         * arm.cc: Likewise.
5960         * attributes.cc: Likewise.
5961         * attributes.h: Likewise.
5962         * common.cc: Likewise.
5963         * copy-relocs.cc: Likewise.
5964         * dirsearch.h: Likewise.
5965         * dynobj.cc: Likewise.
5966         * ehframe.cc: Likewise.
5967         * ehframe.h: Likewise.
5968         * expression.cc: Likewise.
5969         * fileread.cc: Likewise.
5970         * fileread.h: Likewise.
5971         * gc.h: Likewise.
5972         * gold-threads.cc: Likewise.
5973         * gold.cc: Likewise.
5974         * i386.cc: Likewise.
5975         * icf.h: Likewise.
5976         * incremental-dump.cc: Likewise.
5977         * incremental.cc: Likewise.
5978         * layout.cc: Likewise.
5979         * layout.h: Likewise.
5980         * main.cc: Likewise.
5981         * merge.cc: Likewise.
5982         * merge.h: Likewise.
5983         * object.cc: Likewise.
5984         * object.h: Likewise.
5985         * options.cc: Likewise.
5986         * options.h: Likewise.
5987         * output.cc: Likewise.
5988         * output.h: Likewise.
5989         * plugin.cc: Likewise.
5990         * plugin.h: Likewise.
5991         * powerpc.cc: Likewise.
5992         * reloc.cc: Likewise.
5993         * script-c.h: Likewise.
5994         * script-sections.cc: Likewise.
5995         * script.cc: Likewise.
5996         * stringpool.cc: Likewise.
5997         * symtab.cc: Likewise.
5998         * symtab.h: Likewise.
5999         * target.cc: Likewise.
6000         * timer.cc: Likewise.
6001         * timer.h: Likewise.
6002         * version.cc: Likewise.
6003         * x86_64.cc: Likewise.
6004
6005 2010-08-24  Nick Clifton  <nickc@redhat.com>
6006
6007         PR 11899
6008         * layout.cc (segment_precedes): Sort segments by their physical
6009         addresses, if they have been set.
6010
6011 2010-08-23  Cary Coutant  <ccoutant@google.com>
6012
6013         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6014         symbols data.
6015         (Lib_group::include_member): Unlock object after deleting its
6016         symbols data.
6017         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6018         the bug fixed here.
6019
6020 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6021             Cary Coutant  <ccoutant@google.com>
6022
6023         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6024         constructor, and set_blocker.
6025         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6026         readsyms_blocker_.
6027         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6028         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6029         * testsuite/Makefile.am (start_lib_test): New test case.
6030         * testsuite/Makefile.in: Regenerate.
6031         * testsuite/start_lib_test_main.c: New file.
6032         * testsuite/start_lib_test_1.c: New file.
6033         * testsuite/start_lib_test_2.c: New file.
6034         * testsuite/start_lib_test_3.c: New file.
6035
6036 2010-08-19  Ian Lance Taylor  <iant@google.com>
6037
6038         * Makefile.in: Rebuild with automake 1.11.1.
6039         * aclocal.m4: Likewise.
6040         * testsuite/Makefile.in: Likewise.
6041
6042 2010-08-19  Ian Lance Taylor  <iant@google.com>
6043
6044         PR 10893
6045         * i386.cc (class Output_data_plt_i386): Update declarations.
6046         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6047         local_ifuncs_ fields.
6048         (Target_i386::do_plt_section_for_global): New function.
6049         (Target_i386::do_plt_section_for_local): New function.
6050         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6051         parameter; change all callers.  Initialize global_ifuncs_ and
6052         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6053         __rel_iplt_end.
6054         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6055         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6056         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6057         symbols.
6058         (Target_i386::make_plt_section): New function, broken out of
6059         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6060         (Target_i386::make_plt_entry): Call make_plt_section.
6061         (Target_i386::make_local_ifunc_plt_entry): New function.
6062         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6063         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6064         R_386_IRELATIVE to switch.
6065         (Target_i386::Scan::global): Likewise.
6066         (Target_i386::Relocate::relocate): Likewise.
6067         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6068         switch.
6069         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6070         (Target_x86_64::do_plt_section_for_global): New function.
6071         (Target_x86_64::do_plt_section_for_local): New function.
6072         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6073         parameter; change all callers.  If doing a static link define
6074         __rela_iplt_start and __rela_iplt_end.
6075         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6076         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6077         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6078         to point to .plt.
6079         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6080         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6081         switch.
6082         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6083         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6084         R_X86_64_IRELATIVE to switch.
6085         (Target_x86_64::Scan::global): Likewise.
6086         (Target_x86_64::Relocate::relocate): Likewise.
6087         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6088         switch.
6089         * target.h (class Target): Add plt_section_for_global and
6090         plt_section_for_local functions.  Add do_plt_section_for_global
6091         and do_plt_section_for_local virtual functions.
6092         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6093         clarifying comments.
6094         (Symbol::use_plt_offset): Handle IFUNC symbol.
6095         * object.cc (Sized_relobj::Sized_relobj): Initialize
6096         local_plt_offsets_.
6097         (Sized_relobj::local_has_plt_offset): New function.
6098         (Sized_relobj::local_plt_offset): New function.
6099         (Sized_relobj::set_local_plt_offset): New function.
6100         (Sized_relobj::do_count): Handle IFUNC symbol.
6101         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6102         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6103         is_ifunc_symbol functions.
6104         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6105         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6106         local_plt_offsets_ field.
6107         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6108         * output.h (class Output_section_data): Add non-const
6109         output_section function.
6110         (class Output_data_got): Update declarations.
6111         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6112         Add use_plt_offset parameter to global and local constructors.
6113         Change all callers.  Change local_sym_index_ field to 31 bits.
6114         Change GSYM_CODE and CONSTANT_CODE accordingly.
6115         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6116         doing a static link don't set sh_link field.
6117         (Output_data_got::Got_entry::write): Use PLT offset if
6118         appropriate.
6119         (Output_data_got::add_global_plt): New function.
6120         (Output_data_got::add_local_plt): New function.
6121         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6122         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6123         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6124         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6125         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6126         IFUNC conditional.
6127         * testsuite/ifunc-sel.h: New file.
6128         * testsuite/ifuncmain1.c: New file.
6129         * testsuite/ifuncmain1vis.c: New file.
6130         * testsuite/ifuncmod1.c: New file.
6131         * testsuite/ifuncdep2.c: New file.
6132         * testsuite/ifuncmain2.c: New file.
6133         * testsuite/ifuncmain3.c: New file.
6134         * testsuite/ifuncmod3.c: New file.
6135         * testsuite/ifuncmain4.c: New file.
6136         * testsuite/ifuncmain5.c: New file.
6137         * testsuite/ifuncmod5.c: New file.
6138         * testsuite/ifuncmain6pie.c: New file.
6139         * testsuite/ifuncmod6.c: New file.
6140         * testsuite/ifuncmain7.c: New file.
6141         * configure, testsuite/Makefile.in: Rebuild.
6142
6143 2010-08-18  Ian Lance Taylor  <iant@google.com>
6144
6145         * incremental.cc
6146         (Output_section_incremental_inputs::write_input_files): Add cast
6147         to avoid signed/unsigned comparison warning.
6148         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6149
6150 2010-08-12  Cary Coutant  <ccoutant@google.com>
6151
6152         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6153
6154 2010-08-13  Ian Lance Taylor  <iant@google.com>
6155
6156         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6157
6158 2010-08-12  Cary Coutant  <ccoutant@google.com>
6159             Doug Kwan  <dougkwan@google.com>
6160
6161         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6162         defintion overrides non-weak undef, remember that the original undef
6163         is not weak.
6164         * symtab.cc (Symbol_table::sized_write_global): For undef without
6165         an original weak binding, set binding to global in output.
6166         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6167         * testsuite/Makefile.in: Regenerate.
6168         * testsuite/strong_ref_weak_def.sh: New file.
6169         * testsuite/strong_ref_weak_def_1.c: Ditto.
6170         * testsuite/strong_ref_weak_def_2.c: Ditto.
6171
6172 2010-08-12  Cary Coutant  <ccoutant@google.com>
6173
6174         * testsuite/incremental_test.sh: Rewrite.
6175         * testsuite/incremental_test_1.c: Rewrite.
6176         * testsuite/incremental_test_2.c: Rewrite.
6177
6178 2010-08-12  Cary Coutant  <ccoutant@google.com>
6179
6180         * arm.cc (Target_arm::got_size): Add const.
6181         (Target_arm::got_entry_count): New function.
6182         (Target_arm::plt_entry_count): New function.
6183         (Target_arm::first_plt_entry_offset): New function.
6184         (Target_arm::plt_entry_size): New function.
6185         (Output_data_plt_arm::entry_count): New function.
6186         (Output_data_plt_arm::first_plt_entry_offset): New function.
6187         (Output_data_plt_arm::get_plt_entry_size): New function.
6188         * i386.cc (Target_i386::got_size): Add const.
6189         (Target_i386::got_entry_count): New function.
6190         (Target_i386::plt_entry_count): New function.
6191         (Target_i386::first_plt_entry_offset): New function.
6192         (Target_i386::plt_entry_size): New function.
6193         (Output_data_plt_i386::entry_count): New function.
6194         (Output_data_plt_i386::first_plt_entry_offset): New function.
6195         (Output_data_plt_i386::get_plt_entry_size): New function.
6196         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6197         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6198         * incremental.cc: Include target.h.
6199         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6200         parameter.  Adjust all callers.  Find incremental_got_plt section.
6201         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6202         section.
6203         (Output_section_incremental_inputs::set_final_data_size): Calculate
6204         size of incremental_got_plt section.
6205         (Output_section_incremental_inputs::do_write): Write the
6206         incremental_got_plt section.
6207         (Got_plt_view_info): New struct.
6208         (Local_got_offset_visitor): New class.
6209         (Global_got_offset_visitor): New class.
6210         (Global_symbol_visitor_got_plt): New class.
6211         (Output_section_incremental_inputs::write_got_plt): New function.
6212         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6213         Add parameter.  Adjust all callers.
6214         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6215         (Incremental_inputs::got_plt_section): New function.
6216         (Incremental_inputs::got_plt_section_): New data member.
6217         (Incremental_got_plt_reader): New class.
6218         * layout.cc (Layout::create_incremental_info_sections): Add the
6219         incremental_got_plt section.
6220         * object.h (Got_offset_list::get_list): New function.
6221         (Got offset_list::for_all_got_offsets): New function.
6222         (Sized_relobj::local_got_offset_list): New function.
6223         * powerpc.cc (Target_powerpc::got_size): Add const.
6224         (Target_powerpc::got_entry_count): New function.
6225         (Target_powerpc::plt_entry_count): New function.
6226         (Target_powerpc::first_plt_entry_offset): New function.
6227         (Target_powerpc::plt_entry_size): New function.
6228         (Output_data_plt_powerpc::entry_count): New function.
6229         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6230         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6231         * sparc.cc (Target_sparc::got_size): Add const.
6232         (Target_sparc::got_entry_count): New function.
6233         (Target_sparc::plt_entry_count): New function.
6234         (Target_sparc::first_plt_entry_offset): New function.
6235         (Target_sparc::plt_entry_size): New function.
6236         (Output_data_plt_sparc::entry_count): New function.
6237         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6238         (Output_data_plt_sparc::get_plt_entry_size): New function.
6239         * symtab.h (Symbol::got_offset_list): New function.
6240         (Symbol_table::for_all_symbols): New function.
6241         * target.h (Sized_target::got_entry_count): New function.
6242         (Sized_target::plt_entry_count): New function.
6243         (Sized_target::plt_entry_size): New function.
6244         * x86_64.cc (Target_x86_64::got_size): Add const.
6245         (Target_x86_64::got_entry_count): New function.
6246         (Target_x86_64::plt_entry_count): New function.
6247         (Target_x86_64::first_plt_entry_offset): New function.
6248         (Target_x86_64::plt_entry_size): New function.
6249         (Output_data_plt_x86_64::entry_count): New function.
6250         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6251         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6252
6253 2010-08-12  Cary Coutant  <ccoutant@google.com>
6254
6255         * archive.cc: Include incremental.h.
6256         (Archive::Archive): Initialize incremental_info_.
6257         (Archive::include_member): Record archive members in incremental info.
6258         (Add_archive_symbols::run): Record begin and end of an archive in
6259         incremental info.
6260         (Lib_group::include_member): Record objects in incremental info.
6261         * archive.h (Incremental_archive_entry): Forward declaration.
6262         (Archive::set_incremental_info): New member function.
6263         (Archive::incremental_info): New member function.
6264         (Archive::Unused_symbol_iterator): New class.
6265         (Archive::unused_symbols_begin): New member function.
6266         (Archive::unused_symbols_end): New member function.
6267         (Archive::incremental_info_): New data member.
6268         * incremental-dump.cc (find_input_containing_global): New function.
6269         (dump_incremental_inputs): Dump new incremental info sections.
6270         * incremental.cc: Include symtab.h.
6271         (Output_section_incremental_inputs): New class.
6272         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6273         new incremental info sections.
6274         (Sized_incremental_binary::do_check_inputs): Likewise.
6275         (Incremental_inputs::report_archive): Remove.
6276         (Incremental_inputs::report_archive_begin): New function.
6277         (Incremental_inputs::report_archive_end): New function.
6278         (Incremental_inputs::report_object): New function.
6279         (Incremental_inputs::finalize_inputs): Remove.
6280         (Incremental_inputs::report_input_section): New function.
6281         (Incremental_inputs::report_script): Rewrite.
6282         (Incremental_inputs::finalize): Do nothing but finalize string table.
6283         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6284         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6285         (Incremental_inputs::create_data_sections): New function.
6286         (Incremental_inputs::relocs_entsize): New function.
6287         (Output_section_incremental_inputs::set_final_data_size): New function.
6288         (Output_section_incremental_inputs::do_write): New function.
6289         (Output_section_incremental_inputs::write_header): New function.
6290         (Output_section_incremental_inputs::write_input_files): New function.
6291         (Output_section_incremental_inputs::write_info_blocks): New function.
6292         (Output_section_incremental_inputs::write_symtab): New function.
6293         * incremental.h (Incremental_script_entry): Forward declaration.
6294         (Incremental_object_entry): Forward declaration.
6295         (Incremental_archive_entry): Forward declaration.
6296         (Incremental_inputs): Forward declaration.
6297         (Incremental_inputs_header_data): Remove.
6298         (Incremental_inputs_header): Remove.
6299         (Incremental_inputs_header_write): Remove.
6300         (Incremental_inputs_entry_data): Remove.
6301         (Incremental_inputs_entry): Remove.
6302         (Incremental_inputs_entry_write): Remove.
6303         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6304         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6305         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6306         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6307         Likewise.
6308         (Incremental_input_entry): New class.
6309         (Incremental_script_entry): New class.
6310         (Incremental_object_entry): New class.
6311         (Incremental_archive_entry): New class.
6312         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6313         (Incremental_inputs::report_inputs): Remove.
6314         (Incremental_inputs::report_archive): Remove.
6315         (Incremental_inputs::report_archive_begin): New function.
6316         (Incremental_inputs::report_archive_end): New function.
6317         (Incremental_inputs::report_object): Change prototype.
6318         (Incremental_inputs::report_input_section): New function.
6319         (Incremental_inputs::report_script): Change prototype.
6320         (Incremental_inputs::get_reloc_count): New function.
6321         (Incremental_inputs::set_reloc_count): New function.
6322         (Incremental_inputs::create_data_sections): New function.
6323         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6324         (Incremental_inputs::inputs_section): New function.
6325         (Incremental_inputs::symtab_section): New function.
6326         (Incremental_inputs::relocs_section): New function.
6327         (Incremental_inputs::get_stringpool): Add const.
6328         (Incremental_inputs::command_line): Add const.
6329         (Incremental_inputs::inputs): Remove.
6330         (Incremental_inputs::command_line_key): New function.
6331         (Incremental_inputs::input_file_count): New function.
6332         (Incremental_inputs::input_files): New function.
6333         (Incremental_inputs::relocs_entsize): New function.
6334         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6335         (Incremental_inputs::finalize_inputs): Remove.
6336         (Incremental_inputs::Input_info): Remove.
6337         (Incremental_inputs::lock_): Remove.
6338         (Incremental_inputs::inputs_): Change type.
6339         (Incremental_inputs::inputs_map_): Remove.
6340         (Incremental_inputs::current_object_entry_): New data member.
6341         (Incremental_inputs::inputs_section_): New data member.
6342         (Incremental_inputs::symtab_section_): New data member.
6343         (Incremental_inputs::relocs_section_): New data member.
6344         (Incremental_inputs::reloc_count_): New data member.
6345         (Incremental_inputs_reader): New class.
6346         (Incremental_symtab_reader): New class.
6347         (Incremental_relocs_reader): New class.
6348         * layout.cc (Layout::finalize): Move finalization of incremental info
6349         and creation of incremental info sections to follow finalization of
6350         symbol table.  Set offsets for postprocessing sections.
6351         (Layout::create_incremental_info_sections): Call
6352         Incremental_inputs::create_data_sections.  Add incremental symtab
6353         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6354         sections to layout after input sections.
6355         * layout.h (struct Timespec): Forward declaration.
6356         (Layout::incremental_inputs): Add const.
6357         (Layout::create_incremental_info_sections): Add parameter.
6358         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6359         * object.cc: Include incremental.h.
6360         (Relobj::finalize_incremental_relocs): New function.
6361         (Sized_relobj::do_layout): Record input sections in incremental info.
6362         * object.h (Object::output_section): New function.
6363         (Object::output_section_offset): Moved from Relobj.
6364         (Object::get_incremental_reloc_base): New function.
6365         (Object::get_incremental_reloc_count): New function.
6366         (Object::do_output_section): New function.
6367         (Object::do_output_section_offset): Moved from Relobj.
6368         (Object::do_get_incremental_reloc_base): New function.
6369         (Object::do_get_incremental_reloc_count): New function.
6370         (Object::Object): Initialize new data members.
6371         (Relobj::output_section): Renamed do_output_section and moved to
6372         protected.
6373         (Relobj::output_section_offset): Moved to Object.
6374         (Relobj::do_get_incremental_reloc_base): New function.
6375         (Relobj::do_get_incremental_reloc_count): New function.
6376         (Relobj::allocate_incremental_reloc_counts): New function.
6377         (Relobj::count_incremental_reloc): New function.
6378         (Relobj::finalize_incremental_relocs): New function.
6379         (Relobj::next_incremental_reloc_index): New function.
6380         (Relobj::reloc_counts_): New data member.
6381         (Relobj::reloc_bases_): New data member.
6382         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6383         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6384         (Sized_relobj::incremental_relocs_scan): New function.
6385         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6386         (Sized_relobj::incremental_relocs_write): New function.
6387         (Sized_relobj::incremental_relocs_write_reltype): New function.
6388         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6389         incremental link.
6390         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6391         archives and object files elsewhere.
6392         (Add_symbols::run): Report object files here.
6393         (Finish_group::run): Report end of archive at end of group.
6394         * reloc.cc: Include layout.h, incremental.h.
6395         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6396         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6397         (Sized_relobj::incremental_relocs_scan): New function.
6398         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6399         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6400         (Sized_relobj::incremental_relocs_write): New function.
6401         (Sized_relobj::incremental_relocs_write_reltype): New function.
6402         * script.cc (read_input_script): Rewrite test for incremental link.
6403         Change call to Incremental_inputs::report_script.
6404         * symtab.h (Symbol_table::first_global_index): New function.
6405         (Symbol_table::output_count): New function.
6406
6407 2010-08-12  Doug Kwan  <dougkwan@google.com>
6408
6409         * arm.cc (Target_arm::merge_object_attributes): Check command line
6410         options --no-wchar-size-warning and --no-enum-size-warning.
6411         * options.h (General_options): Add ld-compatible options
6412         --no-enum-size-warning and --no-wchar-size-warning.
6413
6414 2010-08-04  Ian Lance Taylor  <iant@google.com>
6415
6416         * x86_64.cc (Target_x86_64::Scan::local): Use
6417         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6418         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6419         (Target_x86_64::Scan::global): Likewise.
6420         (Target_x86_64::Relocate::relocate): Likewise.
6421         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6422         Likewise.
6423
6424 2010-08-03  Cary Coutant  <ccoutant@google.com>
6425
6426         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6427         to reserve space in merged_strings vector. Keep total input size
6428         for stats.
6429         (Output_merge_string::do_print_merge_stats): Print total input size.
6430         * merge.h (Output_merge_string): Add input_size_ field.
6431         * stringpool.cc (Stringpool_template::string_length): Move
6432         implementations out of Stringpool_template class and place in
6433         stringpool.h.
6434         * stringpool.h (string_length): Move out of Stringpool_template.
6435
6436 2010-08-03  Ian Lance Taylor  <iant@google.com>
6437
6438         PR 11712
6439         * layout.cc (relaxation_loop_body): If address of load segment is
6440         set, adjust address to include headers if possible.
6441
6442 2010-08-03  Ian Lance Taylor  <iant@google.com>
6443
6444         * version.cc (version_string): Bump to 1.10.
6445
6446 2010-08-03  Ian Lance Taylor  <iant@google.com>
6447
6448         PR 11805
6449         * layout.h (enum Output_section_order): Define.
6450         (class Layout): Update declarations.
6451         * layout.cc (Layout::get_output_section): Add order parameter.
6452         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6453         is_first_non_relro parameters.  Change all callers.
6454         (Layout::choose_output_section): Likewise.
6455         (Layout::add_output_section_data): Likewise.
6456         (Layout::make_output_section): Likewise.  Set order.
6457         (Layout::default_section_order): New function.
6458         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6459         * output.cc (Output_section::Output_section): Initialize order_.
6460         Don't initialize deleted fields.
6461         (Output_segment::Output_segment): Don't initialize deleted
6462         fields.
6463         (Output_segment::add_output_section_to_load): New function
6464         replacing add_output_section.  Change all callers to call this or
6465         add_output_section_to_nonload.
6466         (Output_segment::add_output_section_to_nonload): New function.
6467         (Output_segment::remove_output_section): Rewrite.
6468         (Output_segment::add_initial_output_data): Likewise.
6469         (Output_segment::has_any_data_sections): Likewise.
6470         (Output_segment::is_first_section_relro): Likewise.
6471         (Output_segment::maximum_alignment): Likewise.
6472         (Output_segment::has_dynamic_reloc): New function replacing
6473         dynamic_reloc_count.  Change all callers.
6474         (Output_segment::has_dynamic_reloc_list): New function replacing
6475         dynamic_reloc_count_list.  Change all callers.
6476         (Output_segment::set_section_addresses): Rewrite.
6477         (Output_segment::set_offset): Rewrite.
6478         (Output_segment::find_first_and_last_list): Remove.
6479         (Output_segment::set_tls_offsets): Rewrite.
6480         (Output_segment::first_section_load_address): Likewise.
6481         (Output_segment::output_section_count): Likewise.
6482         (Output_segment::section_with_lowest_load_address): Likewise.
6483         (Output_segment::write_section_headers): Likewise.
6484         (Output_segment::print_sections_to_map): Likewise.
6485         * output.h (class Output_data): Remove dynamic_reloc_count_
6486         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6487         (Output_data::add_dynamic_reloc): Rewrite.
6488         (Output_data::has_dynamic_reloc): New function.
6489         (Output_data::dynamic_reloc_count): Remove.
6490         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6491         is_last_relro_, is_first_non_relro_, is_interp_,
6492         is_dynamic_linker_section_ fields.  Add order and set_order
6493         functions.  Remove is_relro_local, set_is_relro_local,
6494         is_last_relro, set_is_last_relro, is_first_non_relro,
6495         set_is_first_non_relro functions, is_interp, set_is_interp,
6496         is_dynamic_linker_section, and set_is_dynamic_linker_section
6497         functions.
6498         (class Output_segment): Change Output_data_list from std::list to
6499         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6500         output_bss_ fields.  Update declarations.
6501
6502 2010-08-02  Ian Lance Taylor  <iant@google.com>
6503
6504         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6505         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6506         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6507
6508 2010-08-02  Ian Lance Taylor  <iant@google.com>
6509
6510         PR 11855
6511         * script.cc (Script_options::Script_options): Initialize
6512         symbol_definitions_ and symbol_references_.
6513         (Script_options::add_symbol_assignment): Update
6514         symbol_definitions_ and symbol_references_.
6515         (Script_options::add_symbol_reference): New function.
6516         (script_symbol): New function.
6517         * script.h (class Script_options): Add symbol_definitions_ and
6518         symbol_references_ fields.
6519         (Script_options::referenced_const_iterator): New type.
6520         (Script_options::referenced_begin): New function.
6521         (Script_options::referenced_end): New function.
6522         (Script_options::is_referenced): New function.
6523         (Script_options::any_unreferenced): New function.
6524         * script-c.h (script_symbol): Declare.
6525         * yyscript.y (exp): Call script_symbol.
6526         * symtab.cc: Include "script.h".
6527         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6528         Change all callers.  Check symbols referenced by scripts.
6529         (Symbol_table::add_undefined_symbols_from_command_line): Add
6530         layout parameter.  Change all callers.
6531         (Symbol_table::do_add_undefined_symbols_from_command_line):
6532         Likewise.  Break out loop body.  Check symbols referenced by
6533         scripts.
6534         (Symbol_table::add_undefined_symbol_from_command_line): New
6535         function broken out of
6536         do_add_undefined_symbols_from_command_line.
6537         * symtab.h (class Symbol_table): Update declarations.
6538         * archive.cc: Include "layout.h".
6539         (Archive::should_include_member): Add layout parameter.  Change
6540         all callers.  Check for symbol mentioned in expression.
6541         * archive.h (class Archive): Update declaration.
6542         * object.cc (Sized_relobj::do_should_include_member): Add layout
6543         parameter.
6544         * object.h (Object::should_include_member): Add layout parameter.
6545         Change all callers.
6546         (Object::do_should_include_member): Add layout parameter.
6547         (class Sized_relobj): Update declaration.
6548         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6549         parameter.
6550         * dynobj.h (class Sized_dynobj): Update declaration.
6551         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6552         layout parameter.
6553         * plugin.h (class Sized_pluginobj): Update declaration.
6554
6555 2010-08-02  Ian Lance Taylor  <iant@google.com>
6556
6557         PR 11866
6558         * output.cc (Output_segment::set_offset): Search for the first and
6559         last sections rather than assuming that the list is in order.
6560         (Output_segment::find_first_and_last_list): New function.
6561         * output.h (class Output_segment): Update declarations.
6562         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6563         (relro_strip_test_SOURCES): New variable.
6564         (relro_strip_test_DEPENDENCIES): New variable.
6565         (relro_strip_test_LDFLAGS): New variable.
6566         (relro_strip_test_LDADD): New variable.
6567         (relro_strip_test.so): New target.
6568
6569 2010-08-02  Ian Lance Taylor  <iant@google.com>
6570
6571         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6572         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6573         (Target_i386::got_tlsdesc_section): New function.
6574         (Target_i386::got_section): Create space for GOT entries for
6575         TLSDESC relocations.
6576         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6577         R_386_TLS_GOTDESC.
6578         (Target_i386::Scan::global): Likewise.
6579         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6580         using TLSDESC GOT.
6581         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6582         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6583         (Target_x86_64::got_tlsdesc_section): New function.
6584         (Target_x86_64::got_section): Create space for GOT entries for
6585         TLSDESC relocations.
6586         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6587         R_386_TLS_GOTDESC.
6588         (Target_x86_64::Scan::global): Likewise.
6589         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6590         using TLSDESC GOT.
6591
6592 2010-08-02  Ian Lance Taylor  <iant@google.com>
6593
6594         * testsuite/final_layout.sh: Use dc to convert from hex to
6595         decimal.
6596
6597 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6598
6599         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6600         paramter to the call to gold::gc_process_relocs.
6601         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6602         paramter to the call to gold::gc_process_relocs.
6603         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6604         parameter to the call to gold::gc_process_relocs.
6605         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6606         template parameter to the call to gold::gc_process_relocs.
6607         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6608         paramter to the call to gold::gc_process_relocs.
6609         * gc.h (get_embedded_addend_size): New function.
6610         (gc_process_relocs): Save the size of the reloc for use by ICF.
6611         * icf.cc (get_section_contents): Get the addend from the text section
6612         for SHT_REL relocation sections.
6613         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6614         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6615         * int_encoding.h (read_from_pointer): New overloaded function.
6616         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6617         * testsuite/icf_sht_rel_addend_test.sh: New file.
6618         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6619         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6620
6621 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6622
6623         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6624         * Makefile.in: Regenerate.
6625         * testsuite/Makefile.in: Regenerate.
6626
6627 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6628
6629         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6630         * gold/testsuite/debug_msg.cc: Likewise.
6631         * gold/testsuite/odr_violation1.cc
6632         * gold/testsuite/odr_violation2.cc
6633
6634 2010-07-21  Cary Coutant  <ccoutant@google.com>
6635
6636         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6637         string, and length fields.
6638         (Output_merge_string::Merged_strings_list): New type.
6639         (Output_merge_string::Merged_strings_lists): New typedef.
6640         (Output_merge_string): Replace merged_strings_ with
6641         merged_strings_lists_.
6642         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6643         Merged_strings_list per input object and section.  Don't store pointer
6644         to the string.  Don't store length with each merged string entry.
6645         (Output_merge_string::finalize_merged_data): Loop over list of merged
6646         strings lists.  Recompute length of each merged string.
6647
6648 2010-07-15  Cary Coutant  <ccoutant@google.com>
6649
6650         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6651         here.
6652
6653 2010-07-14  Ian Lance Taylor  <iant@google.com>
6654
6655         * descriptors.cc (Descriptors::open): Report correct name in error
6656         message.
6657
6658 2010-07-13  Doug Kwan  <dougkwan@google.com>
6659
6660         * arm.cc (Arm_input_section::Arm_input_section): For a
6661         SHT_ARM_EXIDX section, always keeps the input sections.
6662         (Arm_input_section::set_exidx_section_link): New method.
6663         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6664         has_errors_ to false.
6665         (Arm_exidx_input_section::has_errors,
6666         Arm_exidx_input_section::set_has_errors): New methods.
6667         (Arm_exidx_input_section::has_errors_): New data member.
6668         (Arm_relobj::get_exidx_shndx_list): New method.
6669         (Arm_output_section::append_text_sections_to_list): Do not skip
6670         section without SHF_EXECINSTR.
6671         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6672         errors.
6673         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6674         section header.  Make error messages more verbose.  Check for
6675         a non-executable section linked to an EXIDX section.
6676         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6677         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6678         check that there is no deferred EXIDX section if we exit early.
6679         Instead of not making an EXIDX section in case of an error, make one
6680         and set the has_errors flag of it.
6681         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6682         in a relocatable link.
6683         (Target_arm::do_relax): Look for the EXIDX output section instead of
6684         assuming that it is called .ARM.exidx.
6685         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6686         section list.  Do not check for SHF_EXECINSTR section flags but
6687         skip any input section with errors.
6688         * output.cc (Output_section::Output_section): Initialize
6689         always_keeps_input_sections_ to false.
6690         (Output_section::add_input_section): Check for
6691         always_keeps_input_sections_.
6692         *  output.h (Output_section::always_keeps_input_sections,
6693         Output_section::set_always_keeps_input_sections): New methods.
6694         (Output_section::always_keeps_input_sections): New data member.
6695
6696 2010-07-13  Rafael Espindola  <espindola@google.com>
6697
6698         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6699         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6700
6701 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6702             Ian Lance Taylor  <iant@google.com>
6703
6704         * output.h (Output_section_lookup_maps::add_merge_section):
6705         Correct check of whether value was inserted.
6706         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6707         (Output_section_lookup_maps::add_relaxed_input_section):
6708         Likewise.
6709         * arm.cc (Target_arm::got_section): Remove used local os.
6710         * i386.cc (Target_i386::got_section): Likewise.
6711         * x86_64.cc (Target_x86_64::got_section): Likewise.
6712         * sparc.cc (Target_sparc::got_section): Likewise.
6713         (Target_sparc::relocate): Remove unused local have_got_offset.
6714         * powerpc.cc (Target_powerpc::relocate): Likewise.
6715
6716 2010-07-13  Ian Lance Taylor  <iant@google.com>
6717
6718         * compressed_output.cc (zlib_decompress): Fix signature in
6719         !HAVE_ZLIB_H case.
6720
6721         * archive.cc (Archive::include_member): Unlock an external member
6722         of a thin archive.  Don't bother to delete an object we know is
6723         NULL.
6724
6725 2010-07-12  Cary Coutant  <ccoutant@google.com>
6726
6727         * compressed_output.cc (zlib_decompress): New function.
6728         (get_uncompressed_size): New function.
6729         (decompress_input_section): New function.
6730         * compressed_output.h (get_uncompressed_size): New function.
6731         (decompress_input_section): New function.
6732         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6733         Handle compressed debug sections.
6734         * layout.cc (is_compressed_debug_section): New function.
6735         (Layout::output_section_name): Map compressed section names to
6736         canonical names.
6737         * layout.h (is_compressed_debug_section): New function.
6738         (is_debug_info_section): Recognize compressed debug sections.
6739         * merge.cc: Include compressed_output.h.
6740         (Output_merge_data::do_add_input_section): Handle compressed
6741         debug sections.
6742         (Output_merge_string::do_add_input_section): Handle compressed
6743         debug sections.
6744         * object.cc: Include compressed_output.h.
6745         (Sized_relobj::Sized_relobj): Initialize new data members.
6746         (build_compressed_section_map): New function.
6747         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6748         * object.h (Object::section_is_compressed): New method.
6749         (Object::do_section_is_compressed): New method.
6750         (Sized_relobj::Compressed_section_map): New type.
6751         (Sized_relobj::do_section_is_compressed): New method.
6752         (Sized_relobj::compressed_sections_): New data member.
6753         * output.cc (Output_section::add_input_section): Handle compressed
6754         debug sections.
6755         * reloc.cc: Include compressed_output.h.
6756         (Sized_relobj::write_sections): Handle compressed debug sections.
6757
6758 2010-07-08  Cary Coutant  <ccoutant@google.com>
6759
6760         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6761         weak when resolving to a dynamic def.
6762         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6763         for weak undef/dynamic def cases. Adjust callers.
6764         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6765         undef_binding_weak_.
6766         (Symbol_table::sized_write_globals): Adjust symbol binding.
6767         (Symbol_table::sized_write_symbol): Add binding parameter.
6768         * symtab.h (Symbol::set_undef_binding): New method.
6769         (Symbol::is_undef_binding_weak): New method.
6770         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6771         (Symbol_table::should_override): Add new parameter.
6772         (Symbol_table::sized_write_symbol): Add new parameter.
6773
6774         * testsuite/weak_undef_file1.cc: Add new test case.
6775         * testsuite/weak_undef_file2.cc: Fix header comment.
6776         * testsuite/weak_undef_test.cc: Add new test case.
6777
6778 2010-06-29  Doug Kwan  <dougkwan@google.com>
6779
6780         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6781         Initialize USE_SYMBOL_.
6782         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6783         definition.
6784         (Arm_reloc_property::uses_symbol_): New data member declaration.
6785         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6786         uses symbol value and symbol is undefined but not weakly undefined.
6787
6788 2010-06-28  Rafael Espindola  <espindola@google.com>
6789
6790         * plugin.cc (Plugin::load): Use dlerror.
6791
6792 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6793
6794         * symtab.cc (detect_odr_violations): When reporting an ODR
6795         violation, report an object where the symbol is defined.
6796
6797 2010-06-25  Doug Kwan  <dougkwan@google.com>
6798
6799         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6800         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6801         definition.
6802         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6803         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6804         target hook to detect function points.
6805         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6806         * icf.h (Icf::check_section_for_function_pointers): Change type of
6807         parameter SECTION_NAME to const reference to std::string.  Use
6808         target hook to determine if section may have unsafe pointers.
6809         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6810         method definition.
6811
6812 2010-06-21  Rafael Espindola  <espindola@google.com>
6813
6814         * fileread.cc (Input_file::find_fie): New
6815         (Input_file::open): Use Input_file::find_fie.
6816         * fileread.h (Input_file::find_fie): New
6817         * plugin.cc (set_extra_library_path): New.
6818         (Plugin::load): Add set_extra_library_path to the transfer vector.
6819         (Plugin_manager::set_extra_library_path): New.
6820         (Plugin_manager::add_input_file): Use the extra search path if set.
6821         (set_extra_library_path(): New.
6822         * plugin.h (Plugin_manager): Add set_extra_library_path and
6823         extra_search_path_.
6824
6825 2010-06-19  Cary Coutant  <ccoutant@google.com>
6826
6827         * layout.cc (gdb_sections): Add .debug_types.
6828         (lines_only_debug_sections): Likewise.
6829
6830 2010-06-18  Rafael Espindola  <espindola@google.com>
6831
6832         * plugin.cc (add_input_file,add_input_library)
6833         (Plugin_manager::add_input_file): Make filename arguments const.
6834         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6835         const.
6836
6837 2010-06-16  Doug Kwan  <dougkwan@google.com>
6838
6839         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6840         .ARM.attributes section if we have not merged any input
6841         attributes sections.
6842
6843 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6844
6845         * arm.cc: Allow combining objects with no EABI version
6846         information.
6847
6848 2010-06-15  Rafael Espindola  <espindola@google.com>
6849
6850         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6851
6852 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6853
6854         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6855         (struct iovec): Correct !HAVE_READV definition.
6856
6857 2010-06-10  Cary Coutant  <ccoutant@google.com>
6858
6859         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6860         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6861         reloc sections.
6862         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6863
6864         PR 11683
6865         * symtab.h (Symbol::is_placeholder): New member function.
6866         * target-reloc.h (relocate_section): Check for placeholder symbols.
6867
6868         * testsuite/Makefile.am (plugin_test_8): New test.
6869         (plugin_test_9): New test.
6870         * testsuite/Makefile.in: Regenerate.
6871
6872 2010-06-09  Nick Clifton  <nickc@redhat.com>
6873
6874         * yyscript.y (input_list_element): Allow strings prefixed with
6875         the '-' character.  Treat these as libraries.
6876         * script.cc (script_add_library): New function.  Adds a library
6877         specified by "-l<name>" found in an input script.
6878         * script-c.h: Add prototype for script_add_library.
6879
6880 2010-06-07  Doug Kwan  <dougkwan@google.com>
6881
6882         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6883         Restrict stub-group size to be within long conditional branch
6884         range when working around cortex-A8 erratum.
6885
6886 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6887
6888         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6889         #ifdef typo.
6890
6891 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6892
6893         PR gold/11658
6894         * output.cc
6895         (Output_section::Input_section_sort_entry::compare_section_ordering):
6896         Change to return non-zero correctly.
6897         (Output_section::Input_section_sort_section_order_index_compare
6898         ::operator()): Change to fix ambiguity in comparisons.
6899
6900 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6901
6902         * gold.h (is_wildcard_string): New function.
6903         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6904         (Layout::layout_eh_frame): Ditto.
6905         (Layout::find_section_order_index): New method.
6906         (Layout::read_layout_from_file): New method.
6907         * layout.h (Layout::find_section_order_index): New method.
6908         (Layout::read_layout_from_file): New method.
6909         (Layout::input_section_position_): New private member.
6910         (Layout::input_section_glob_): New private member.
6911         * main.cc (main): Call read_layout_from_file here.
6912         * options.h (--section-ordering-file): New option.
6913         * output.cc (Output_section::input_section_order_specified_): New
6914         member.
6915         (Output_section::Output_section): Initialize new member.
6916         (Output_section::add_input_section): Add new parameter.
6917         Keep input sections when --section-ordering-file is used.
6918         (Output_section::set_final_data_size): Sort input sections when
6919         section ordering file is specified.
6920         (Output_section::Input_section_sort_entry): Add new parameter.
6921         Check sorting type.
6922         (Output_section::Input_section_sort_entry::compare_section_ordering):
6923         New method.
6924         (Output_section::Input_section_sort_compare::operator()): Change to
6925         consider section_order_index.
6926         (Output_section::Input_section_sort_init_fini_compare::operator()):
6927         Change to consider section_order_index.
6928         (Output_section::Input_section_sort_section_order_index_compare
6929         ::operator()): New method.
6930         (Output_section::sort_attached_input_sections): Change to sort
6931         according to section order when specified.
6932         (Output_section::add_input_section<32, true>): Add new parameter.
6933         (Output_section::add_input_section<64, true>): Add new parameter.
6934         (Output_section::add_input_section<32, false>): Add new parameter.
6935         (Output_section::add_input_section<64, false>): Add new parameter.
6936         * output.h (Output_section::add_input_section): Add new parameter.
6937         (Output_section::input_section_order_specified): New
6938         method.
6939         (Output_section::set_input_section_order_specified): New method.
6940         (Input_section::Input_section): Initialize section_order_index_.
6941         (Input_section::section_order_index): New method.
6942         (Input_section::set_section_order_index): New method.
6943         (Input_section::section_order_index_): New member.
6944         (Input_section::Input_section_sort_section_order_index_compare): New
6945         struct.
6946         (Output_section::input_section_order_specified_): New member.
6947         * script-sections.cc (is_wildcard_string): Delete and move modified
6948         method to gold.h.
6949         (Output_section_element_input::Output_section_element_input): Modify
6950         call to is_wildcard_string.
6951         (Output_section_element_input::Input_section_pattern
6952         ::Input_section_pattern): Ditto.
6953         (Output_section_element_input::Output_section_element_input): Ditto.
6954         * testsuite/Makefile.am (final_layout): New test case.
6955         * testsuite/Makefile.in: Regenerate.
6956         * testsuite/final_layout.cc: New file.
6957         * testsuite/final_layout.sh: New file.
6958
6959 2010-06-01  Rafael Espindola  <espindola@google.com>
6960
6961         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6962
6963 2010-06-01  Rafael Espindola  <espindola@google.com>
6964
6965         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6966         visibility of symbols.
6967
6968 2010-05-27  Doug Kwan  <dougkwan@google.com>
6969
6970         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6971         from start of output section instead of address for a local symbol
6972         in a merged or relaxed section when doing a relocatable link.
6973
6974 2010-05-26  Rafael Espindola  <espindola@google.com>
6975
6976         PR 11604
6977         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6978         adding sections the garbage collector removed.
6979         * gold/testsuite/Makefile.am: Add test.
6980         * gold/testsuite/Makefile.in: Regenerate.
6981         * gold/testsuite/plugin_test_7.sh: New.
6982         * gold/testsuite/plugin_test_7_1.c: New.
6983         * gold/testsuite/plugin_test_7_2.c: New.
6984
6985 2010-05-26  Rafael Espindola  <espindola@google.com>
6986
6987         * script-sections.cc (Output_section_definition::set_section_addresses):
6988         Check for --section-start.
6989
6990 2010-05-26  Doug Kwan  <dougkwan@google.com>
6991
6992         * arm.cc (Arm_scan_relocatable_relocs): New class.
6993         (Target_arm::relocate_special_relocatable): New method.
6994         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6995         (Arm_relocate_functions::thumb_branch_common): Same.
6996         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6997         instead of Default_scan_relocatable_relocs.
6998         * target-reloc.h (relocate_for_relocatable): Let target handle
6999         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7000         * target.h (Sized_target::relocate_special_relocatable): New method.
7001
7002 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7003
7004         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7005
7006 2010-05-23  Doug Kwan  <dougkwan@google.com>
7007
7008         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7009         instead of a cast.
7010         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7011         with a direct branch, not a conditional branch, to a stub.
7012         * merge.cc (Output_merge_base::record_input_section): New method
7013         defintion.
7014         (Output_merge_data::do_add_input_section): Record input section if
7015         keeps-input-sections flag is set.
7016         (Output_merge_string::do_add_input_section): Ditto.
7017         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7018         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7019         INPUT_SECTIONS_.
7020         (Output_merge_base::keeps_input_sections,
7021         Output_merge_base::set_keeps_input_sections,
7022         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7023         method definitions.
7024         (Output_merge_base::Input_sections): New type declaration.
7025         (Output_merge_base::input_sections_begin,
7026         Output_merge_base::input_sections_end,
7027         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7028         (Output_merge_base::bool keeps_input_sections_,
7029         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7030         Output_merge_base::input_sections_): New data members.
7031         (Output_merge_data::do_set_keeps_input_sections): New method
7032         defintion.
7033         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7034         * output.cc (Output_section::Input_section::relobj): Move method
7035         defintion from class declaration to here and handle merge sections.
7036         (Output_section::Input_section::shndx): Ditto.
7037         (Output_section::Output_section): Remove initializations of removed
7038         data members and initialize new data member LOOKUP_MAPS_.
7039         (Output_section::add_input_section): Set keeps-input-sections flag
7040         for a newly created merge output section as appropriate.  Adjust code
7041         to use Output_section_lookup_maps class.
7042         (Output_section::add_relaxed_input_section): Adjst code for lookup
7043         maps code refactoring.
7044         (Output_section::add_merge_input_section): Add a new parameter
7045         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7046         class.  If adding input section to a newly created merge output
7047         section fails, remove the new merge section.
7048         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7049         Adjust code for use of the Output_section_lookup_maps class.
7050         (Output_section::find_merge_section): Ditto.
7051         (Output_section::build_lookup_maps): New method defintion.
7052         (Output_section::find_relaxed_input_section): Adjust code to use
7053         Output_section_lookup_maps class.
7054         (Output_section::get_input_sections): Export merge sections.  Adjust
7055         code to use Output_section_lookup_maps class.
7056         (Output_section:::add_script_input_section): Adjust code to use
7057         Output_section_lookup_maps class.  Update lookup maps for merge
7058         sections also.
7059         (Output_section::discard_states): Use Output_section_lookup_maps.
7060         (Output_section::restore_states): Same.
7061         * output.h (Merge_section_properties): Move class defintion out of
7062         Output_section.
7063         (Output_section_lookup_maps): New class.
7064         (Output_section::Input_section::is_merge_section): New method
7065         defintion.
7066         (Output_section::Input_section::relobj): Move defintion out of class
7067         defintion.  Declare method only.
7068         (Output_section::Input_section::shndx): Ditto.
7069         (Output_section::Input_section::output_merge_base): New method defintion.
7070         (Output_section::Input_section::u2_.pomb): New union field.
7071         (Output_section::Merge_section_by_properties_map,
7072         Output_section::Output_section_data_by_input_section_map,
7073         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7074         Remove types.
7075         (Output_section::add_merge_input_section): Add new parameter
7076         KEEPS_INPUT_SECTIONS.
7077         (Output_section::build_lookup_maps): New method declaration.
7078         (Output_section::merge_section_map_,
7079         Output_section::merge_section_by_properties_map_,
7080         Output_section::relaxed_input_section_map_,
7081         Output_section::is_relaxed_input_section_map_valid_): Remove data
7082         members.
7083         (Output_section::lookup_maps_): New data member.
7084
7085 2010-05-21  Doug Kwan  <dougkwan@google.com>
7086
7087         PR gold/11619
7088         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7089         avoid a compilation error.
7090
7091 2010-05-19  Rafael Espindola  <espindola@google.com>
7092
7093         * script-sections.cc (Output_section_definition::allocate_to_segment):
7094         Update the phdrs_list even when the output section is NULL.
7095         * testsuite/Makefile.am: Add test.
7096         * testsuite/Makefile.in: Regenerate.
7097         * testsuite/script_test_9.cc: New.
7098         * testsuite/script_test_9.sh: New.
7099         * testsuite/script_test_9.t: New.
7100
7101 2010-05-19  Doug Kwan  <dougkwan@google.com>
7102
7103         * arm.cc (Arm_input_section::original_size): New method.
7104         (Arm_input_section::do_addralign): Add a cast.
7105         (Arm_input_section::do_output_offset): Remove static cast.
7106         (Arm_input_section::original_addralign,
7107          Arm_input_section::original_size_): Change type to uint32_t.
7108         (Arm_input_section::init): Add safe casts for section alignment
7109         and size.
7110         (Arm_input_section::set_final_data_size): Do not set address and
7111         offset of stub table.
7112         (Arm_output_section::fix_exidx_coverage): Change use of of
7113         Output_section::Simple_input_section to that of
7114         Output_section::Input_section.
7115         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7116         except for the first pass.
7117         * output.cc (Output_section::get_input_sections): Change type of
7118         input_sections to std::list<Input_section>.
7119         (Output_section::add_script_input_section): Rename from
7120         Output_section::add_simple_input_section.  Change type of SIS
7121         parameter from Simple_input_section to Input_section.
7122         * output.h (Output_section::Simple_input_section): Remove class.
7123         (Output_section::Input_section): Change class visibility to public.
7124         (Output_section::Input_section::addralign): Use stored alignments
7125         for special input sections if set.
7126         (Output_section::Input_section::set_addralign): New method.
7127         (Output_section::get_input_sections): Change parameter type from
7128         list of Simple_input_section to list of Input_section.
7129         (Output_section::add_script_input_section): Rename from
7130         Output_section::add_simple_input_section. Change first parameter's
7131         type from Simple_input_section to Input_section and remove the
7132         second and third parameters.
7133         * script-sections.cc (Input_section::Input_section_list): Change
7134         type to list of Output_section::Input_section/
7135         (Input_section_info::Input_section_info): Change parameter type of
7136         INPUT_SECTION to Output_section::Input_section.
7137         (Input_section_info::input_section): Change return type.
7138         (Input_section_info::input_section_): Change type to
7139         Output_section::Input_section.
7140         (Output_section_element_input::set_section_addresses): Adjust code
7141         to use Output_section::Input_section instead of
7142         Output_section::Simple_input_section.  Adjust code for renaming
7143         of Output_section::add_simple_input_section.
7144         (Orphan_output_section::set_section_addresses): Ditto.
7145
7146 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7147
7148         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7149         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7150
7151 2010-05-18  Rafael Espindola  <espindola@google.com>
7152
7153         * options.cc (General_options::finalize): Handle -nostdlib.
7154         * options.h (nostdlib): New option.
7155         * script.cc (script_add_search_dir): Handle -nostdlib.
7156
7157 2010-05-12  Doug Kwan  <dougkwan@google.com>
7158
7159         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7160         attributes section only if there no attributes section after merging.
7161         (Target_arm::merge_object_attributes): Move value of
7162         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7163         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7164         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7165         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7166         and arm_attr_merge_7.stdout.
7167         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7168         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7169         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7170         arm_attr_merge_7b.o): New rules.
7171         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7172         arm_attr_merge_7
7173         * testsuite/Makefile.in: Regenerate.
7174         * testsuite/arm_attr_merge.sh: New file.
7175         * testsuite/arm_attr_merge_[67][ab].s: Same.
7176
7177 2010-05-05  Nick Clifton  <nickc@redhat.com>
7178
7179         * po/es.po: Updated Spanish translation.
7180
7181 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7182
7183         * Makefile.am (install-exec-local): Properly install gold as
7184         default cross linker.
7185         * Makefile.in: Regenerated.
7186
7187 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7188             Nick Clifton  <nickc@redhat.com>
7189
7190         * configure.ac (install_as_default): Define and set to false
7191         unless --enable-gold or --enable-gold=both/gold has been
7192         specified.
7193         * configure: Regenerate.
7194
7195         * Makefile.am (install-exec-local): Install the executable as
7196         'ld.gold'.  If install_as_default is true then also install it as
7197         'ld'.
7198         * Makefile.in: Regenerated.
7199
7200 2010-04-24  Ian Lance Taylor  <iant@google.com>
7201
7202         * layout.cc (Layout::layout_reloc): In relocatable link don't
7203         combine reloc sections for grouped sections.
7204
7205 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7206
7207         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7208         sections that are not ordinary to icf.
7209         * icf.cc (get_section_contents): Handle relocation pointing to section
7210         with no object or shndx information.
7211         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7212         * testsuite/Makefile.in: Regenerate.
7213         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7214         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7215
7216 2010-04-22  Ian Lance Taylor  <iant@google.com>
7217
7218         * expression.cc (Expression::Expression_eval_info): Add
7219         result_alignment_pointer field.
7220         (Expression::eval_with_dot): Add result_alignment_pointer
7221         parameter.  Change all callers.
7222         (Expression::eval_maybe_dot): Likewise.
7223         (class Binary_expression): Add alignment_pointer parameter to
7224         left_value and right_value.  Change all callers.
7225         (BINARY_EXPRESSION): Set result alignment.
7226         (class Trinary_expression): Add alignment_pointer parameter to
7227         arg2_value and arg3_value.  Change all callers.
7228         (Trinary_cond::value): Set result alignment.
7229         (Max_expression::value, Min_expression::value): Likewise.
7230         (Align_expression::value): Likewise.
7231         * script-sections.cc (class Sections_element): Add dot_alignment
7232         parameter to set_section_addresses virtual function.  Update
7233         instantiations.
7234         (class Output_section_element): Likewise.
7235         (Script_sections::create_segments): Add dot_alignment parameter.
7236         Change all callers.
7237         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7238         (Script_sections::set_phdrs_clause_addresses): Likewise.
7239         * script-sections.h: Update declarations.
7240         * script.h: Update declarations.
7241         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7242         min_p_align.
7243         * testsuite/script_test_3.t: Set large alignment.
7244         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7245         segment has expected alignment.
7246
7247 2010-04-22  Nick Clifton  <nickc@redhat.com>
7248
7249         * po/gold.pot: Updated by the Translation project.
7250         * po/vi.po: Updated Vietnamese translation.
7251
7252 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7253
7254         * testsuite/Makefile.am (check_PROGRAMS): Add
7255         icf_virtual_function_folding_test.
7256         * testsuite/Makefile.in: Regenerated.
7257
7258 2010-04-15  Andrew Haley  <aph@redhat.com>
7259
7260         * options.h (merge_exidx_entries): New option.
7261         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7262         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7263         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7264         (Target_arm::merge_exidx_entries): New function.
7265         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7266         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7267         to Arm_exidx_fixup constructor.
7268         Add new arg, merge_exidx_entries.
7269         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7270         Arm_output_section::fix_exidx_coverage.
7271
7272 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7273
7274         * icf.cc (get_section_contents): Check for preemptible functions.
7275         Ignore addend when appropriate.
7276         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7277         section folded.
7278         (add_from_relobj): Check for section folded.
7279         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7280         * symtab.h (should_add_dynsym_entry): Add new parameter.
7281         * target-reloc.h (scan_relocs): Check for section folded.
7282         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7283         Check reloc types for function pointers in shared objects.
7284         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7285         case.
7286         (icf_preemptible_functions_test): New test case.
7287         (icf_string_merge_test): New test case.
7288         * testsuite.Makefile.in: Regenerate.
7289         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7290         bar_glob.  Refactor code.
7291         * testsuite/icf_preemptible_functions_test.cc: New file.
7292         * testsuite/icf_preemptible_functions_test.sh: New file.
7293         * testsuite/icf_string_merge_test.cc: New file.
7294         * testsuite/icf_string_merge_test.sh: New file.
7295         * testsuite/icf_virtual_function_folding_test.cc: New file.
7296         * testsuite/icf_virtual_function_folding_test.sh: New file.
7297
7298 2010-04-14  Doug Kwan  <dougkwan@google.com>
7299
7300         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7301         for local symbol recounting if we remove a section due to ICF.
7302         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7303         there are no regular objects in input.
7304
7305 2010-04-13  Doug Kwan  <dougkwan@google.com>
7306
7307         * arm.cc (Arm_input_section::set_final_data_size): Compute
7308         accurate final data size instead of using current data size.
7309
7310 2010-04-09  Doug Kwan  <dougkwan@google.com>
7311
7312         * layout.cc (Layout::choose_output_section): Handle script section
7313         types.
7314         (Layout::make_output_section_for_script): Add section type parameter.
7315         Handle script section types.
7316         * layout.h (Layout::make_output_section_for_script): Add section
7317         type parameter.
7318         * output.cc (Output_section::Output_section): Initialize data member
7319         is_noload_.
7320         (Output_section::do_reset_address_and_file_offset): Do not set address
7321         to 0 if section is a NOLOAD section.
7322         * output.h (Output_section::is_noload): New method.
7323         (Output_section::set_is_noload): Ditto.
7324         (Output_section::is_noload_): New data member.
7325         * script-c.h (Script_section_type): New enum type.
7326         (struct Parser_output_section_header): Add new file section_type.
7327         * script-sections.cc (Sections_element::output_section_name): Add
7328         parameter for returning script section type.
7329         (Output_section_definition::output_section_name): Ditto.
7330         (Output_section_definition::section_type)P; New method.
7331         (Output_section_definiton::script_section_type_name): Ditto.
7332         (Output_section_definition::script_section_type_): New data member.
7333         (Output_section_definition::Output_section_definition): Initialize
7334         data member Output_section_definition::script_section_type_.
7335         (Output_section_definition::create_sections): Pass script section type
7336         to Layout::make_output_section_for_script.
7337         (Output_section_definition::output_section_name): Return script
7338         section type to caller.
7339         (Output_section_definition::set_section_address): Do not advance
7340         dot value and load address if section type is NOLOAD.  Set address
7341         of NOLOAD sections regardless of section flags.
7342         (Output_section_definition::print): Print section type if it is
7343         not SCRIPT_SECTION_TYPE_NONE.
7344         (Output_section_definition::section_type): New method.
7345         (Output_section_definition::script_section_type_name): Ditto.
7346         (Script_sections::output_section_name): Add new parameter
7347         PSECTION_TYPE for returning script section type.  Pass it to
7348         section elements.  Handle discard sections.
7349         (Sort_output_sections::operator()): Handle NOLOAD sections.
7350         * script-sections.h (Script_sections::Section_type): New enum type.
7351         (Script_sections::output_section_name): Add a new parameter for
7352         returning script section type.
7353         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7354         INFO and NOLOAD.
7355         * yyscript.y (union): Add new field SECTION_TYPE.
7356         (COPY, DSECT, INFO, NOLOAD): New tokens.
7357         (opt_address_and_section_type): Change type to output_section_header.
7358         (section_type): New non-terminal
7359         (section_header): Handle section type.
7360         (opt_address_and_section_type): Return section type value.
7361
7362 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7363
7364         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7365         * testsuite/plugin_common_test_2.c (foo): Likewise.
7366
7367 2010-04-08  Doug Kwan  <dougkwan@google.com>
7368
7369         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7370         Output_merge_data.
7371         * output.cc (Output_section::add_merge_input_section): Simplify
7372         code and return status of Output_merge_base::add_input_section.
7373         Update merge section map only if Output_merge_base::add_input_section
7374         returns true.
7375
7376 2010-04-07  Doug Kwan  <dougkwan@google.com>
7377
7378         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7379         if section is marked as containing instructions but has no mapping
7380         symbols.
7381         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7382         correct section index.
7383         (Arm_relobj::find_linked_text_section): Ditto.
7384
7385 2010-04-07  Cary Coutant  <ccoutant@google.com>
7386
7387         * archive.cc (include_member): Destroy Read_symbols_data object before
7388         releasing file.
7389         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7390         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7391         (Read_symbols_data::~Read_symbols_data) New destructor.
7392         (Section_relocs::Section_relocs) New constructor.
7393         (Section_relocs::~Section_relocs) New destructor.
7394         (Read_relocs_data::Read_relocs_data) New constructor.
7395         (Read_relocs_data::~Read_relocs_data) New destructor.
7396         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7397         pointers to NULL after deleting.
7398
7399 2010-04-07  Doug Kwan  <dougkwan@google.com>
7400
7401         * arm.cc: Replace "endianity" with "endianness" in comments.
7402         (Arm_exidx_cantunwind): Ditto.
7403         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7404         (Arm_relobj::merge_flags_and_attributes): New method.
7405         (Arm_relobj::merge_flags_and_attributes_): New data member.
7406         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7407         (Arm_relobj::scan_sections_for_stubs): Ditto.
7408         (Arm_relobj::do_read_symbols): Check to see if we really want to
7409         merge processor-specific flags and attributes.  Exit early if
7410         an object is empty except for section names and the undefined symbol.
7411         (Target_arm::do_finalize_sections): Move check for ELF format to
7412         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7413         attributes from a regular object only when we have determined that
7414         it is aapropriate.  Do not create an .ARM.attributes section in
7415         output if there is no regular input object.
7416         (Target_arm::merge_processor_specific_flags): Check
7417         --warn-mismatch before printing any error.
7418         (Target_arm::merge_object_attributes): Ditto.
7419         * gold.cc (queue_middle_tasks): Handle the case in which there is
7420         no regular object in input.
7421         * options.cc (General_options::parse_EB): New method.
7422         (General_options::parse_EL): Same.
7423         (General_options::General_options): Initialize endianness_.
7424         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7425         New options.
7426         (General_options::Endianness): New enum.
7427         (General_options::endianness): New method.
7428         (General_options::endianness_): New data member.
7429         * parameters.cc (Parameters::set_options): Check target endianness.
7430         (Parameters::set_target_once): Ditto.
7431         (Parameters::check_target_endianness): New method.
7432         (parameters_force_valid_target): If either -EL or -EB is specified,
7433         use it to define endianness of default target.
7434         * parameters.h (Parameters::check_target_endianness): New method
7435         declaration.
7436         * target.h (class Target): Change "endianity" to "endianness"
7437         in comments.
7438
7439 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7440
7441         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7442         * configure: Regenerate.
7443         * Makefile.in: Regenerate.
7444         * testsuite/Makefile.in: Regenerate.
7445
7446 2010-04-06  Cary Coutant  <ccoutant@google.com>
7447
7448         gcc PR lto/42757
7449         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7450         prevailing definitions of common symbols.
7451         * testsuite/plugin_test_6.sh: New test case.
7452         * testsuite/plugin_common_test_1.c: New test case.
7453         * testsuite/plugin_common_test_2.c: New test case.
7454         * testsuite/Makefile.am (plugin_test_6): New test case.
7455         * testsuite/Makefile.in: Regenerate.
7456
7457 2010-04-06  Nick Clifton  <nickc@redhat.com>
7458
7459         * po/vi.po: New Vietnamese translation.
7460
7461 2010-03-30  Doug Kwan  <dougkwan@google.com>
7462
7463         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7464
7465 2010-03-25  Doug Kwan  <dougkwan@google.com>
7466
7467         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7468         to avoid a conversion warning on a 32-bit host.
7469
7470 2010-03-24  Ian Lance Taylor  <iant@google.com>
7471
7472         * testsuite/script_test_3.t: Add a TLS segment.
7473         * testsuite/Makefile.am (check_PROGRAMS): Add
7474         tls_phdrs_script_test.
7475         (tls_phdrs_script_test_SOURCES): Define.
7476         (tls_phdrs_script_test_DEPENDENCIES): Define.
7477         (tls_phdrs_script_test_LDFLAGS): Define.
7478         (tls_phdrs_script_test_LDADD): Define.
7479         * testsuite/Makefile.in: Rebuild.
7480
7481 2010-03-23  Cary Coutant  <ccoutant@google.com>
7482
7483         * fileread.cc (find_or_make_view): Fix comment.
7484
7485 2010-03-23  Ian Lance Taylor  <iant@google.com>
7486
7487         * script-sections.cc (class Orphan_section_placement): Define
7488         PLACE_TLS and PLACE_TLS_BSS.
7489         (Orphan_section_placement::Orphan_section_placement): Initialize
7490         new places.
7491         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7492         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7493         (tls_script_test_SOURCES): Define.
7494         (tls_script_test_DEPENDENCIES): Define.
7495         (tls_script_test_LDFLAGS): Define.
7496         (tls_script_test_LDADD): Define.
7497         * testsuite/Makefile.in: Rebuild.
7498
7499 2010-03-22  Doug Kwan  <dougkwan@google.com>
7500
7501         * arm.cc (Arm_relocate_functions::abs8,
7502         Arm_relocate_functions::abs16): Use correct check for overflow
7503         specified in the ARM ELF specs.
7504         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7505         target of a BLX instruction specially.
7506         (Reloc_stub::stub_type_for_reloc): Ditto.
7507         (Relocate::relocate): Use symbolic names instead of numeric relocation
7508         codes to report error.
7509         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7510         workaround.
7511         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7512         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7513         thumb2_blx_out_of_range.stdout
7514         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7515         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7516         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7517         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7518         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7519         thumb2_blx_in_range, thumb2_blx_in_range.o,
7520         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7521         thumb2_blx_out_of_range.o): New rules.
7522         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7523         thumb2_blx_in_range and thumb2_blx_out_of_range.
7524         * testsuite/Makefile.in: Regenerate.
7525         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7526         * testsuite/thumb_blx_in_range.s: New file.
7527         * testsuite/thumb_blx_out_of_range.s: New file.
7528
7529 2010-03-22  Rafael Espindola  <espindola@google.com>
7530
7531         * archive.cc (Should_include): Move to archive.h.
7532         (should_include_member): Make it a member of Archive.
7533         (Lib_group): New.
7534         (Add_lib_group_symbols): New.
7535         * archive.h: Include options.h.
7536         (Archive_member): Moved from Archive.
7537         (Should_include): Moved from archive.cc.
7538         (Lib_group): New.
7539         (Add_lib_group_symbols): New.
7540         * dynobj.cc (do_should_include_member): New.
7541         * dynobj.h (do_should_include_member): New.
7542         * gold.cc (queue_initial_tasks): Update call to queue.
7543         * main.cc (main): Print lib group stats.
7544         * object.cc (do_should_include_member): New.
7545         * object.h: Include archive.h.
7546         (Object::should_include_member): New.
7547         (Object::do_should_include_member): New.
7548         (Sized_relobj::do_should_include_member): New.
7549         * options.cc (General_options::parse_start_lib): New.
7550         (General_options::parse_end_lib): New.
7551         (Input_arguments::add_file): Handle lib groups.
7552         (Input_arguments::start_group): Check we are not in a lib.
7553         (Input_arguments::start_lib): New.
7554         (Input_arguments::end_lib): New.
7555         * options.h (General_options): Add start_lib and end_lib.
7556         (Input_argument::lib_): New.
7557         (Input_argument::lib): New.
7558         (Input_argument::is_lib): New.
7559         (Input_file_lib): New.
7560         (Input_arguments::in_lib_): New.
7561         (Input_arguments::in_lib): New.
7562         (Input_arguments::start_lib): New.
7563         (Input_arguments::end_lib_): New.
7564         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7565         in unused members as preempted.
7566         (Sized_pluginobj::do_should_include_member): New.
7567         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7568         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7569         return the blocker.
7570         (Read_symbols::do_whole_lib_group): New.
7571         (Read_symbols::do_lib_group): New.
7572         (Read_symbols::do_read_symbols): Handle lib groups.
7573         (Read_symbols::get_name): Handle lib groups.
7574         * readsyms.h (Read_symbols): Add an archive member pointer.
7575         (Read_symbols::do_whole_lib_group): New.
7576         (Read_symbols::do_lib_group): New.
7577         (Read_symbols::member_): New.
7578         * script.cc (read_input_script): Update call to queue_soon.
7579
7580 2010-03-19  Doug Kwan  <dougkwan@google.com>
7581
7582         * arm.cc (Stub_table::Stub_table): Initialize new data members
7583         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7584         (Stub_table::add_reloc_stub): Assign stub offset and update
7585         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7586         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7587         New data members.
7588         (Stub_table::update_data_size_and_addralign): Use
7589         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7590         instead of going over all reloc stubs.
7591         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7592         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7593         Stringpool_template::offset_ to size of Stringpool_char.
7594         (Stringpool_template::new_key_offset): Remove code to initialize
7595         Stringpool_template::offset_.
7596         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7597         Stringpool_template::offset_ to zero.
7598
7599 2010-03-15  Doug Kwan  <dougkwan@google.com>
7600
7601         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7602         offset_.
7603         (Stringpool_template::new_key_offset): New method.
7604         (Stringpool_template::add_string): Assign offsets when adding new
7605         strings.
7606         (Stringpool_template::set_string_offsets): Do not set string offsets
7607         when not optimizing.
7608         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7609         member size_.
7610         (Chunked_vector::clear): Clear size_.
7611         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7612         (Chunked_vector::size): Return size_.
7613         (Chunked_vector::push_back): Use size_ to find insert position.
7614         (Chunked_vector::size_): New data member.
7615         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7616         (Stringpool_template::new_key_offset): New method declaration.
7617         (Stringpool_template::offset_): New data member.
7618
7619 2010-03-15   Rafael Espindola  <espindola@google.com>
7620
7621         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7622         Add_symbols' constructor.
7623         * readsyms.h (Add_symbols): Remove the input_group member.
7624
7625 2010-03-10  Ian Lance Taylor  <iant@google.com>
7626
7627         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7628         target to ask whether a reference to a symbol requires a stack
7629         split.
7630         * target.h (Target::is_call_to_non_split): New function.
7631         (Target::do_is_call_to_non_split): Declare virtual function.
7632         * target.cc: Include "symtab.h".
7633         (Target::do_is_call_to_non_split): New function.
7634         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7635
7636 2010-03-10  Cary Coutant  <ccoutant@google.com>
7637
7638         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7639         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7640         (File_read::open[2]): Add whole_file_view_ to list of views.
7641         (File_read::make_view): Remove test of whole_file_view_.
7642         (File_read::find_or_make_view): Create whole_file_view_ if
7643         necessary.
7644         (File_read::clear_views): Replace bool parameter with enum;
7645         adjust all callers.  Don't delete views with permanent data;
7646         do delete cached views and views from archives if
7647         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7648         if clearing the corresponding view.
7649         * fileread.h (File_read::Clear_views_mode): New enum.
7650         (File_read::View::is_permanent_view): New method.
7651         (File_read::clear_views): Replace bool parameter
7652         with enum; adjust all callers.
7653         * options.h (General_options): Change keep_files_mapped option;
7654         add map_whole_files.
7655         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7656         releasing the file.
7657         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7658         the file.
7659
7660 2010-03-10  David S. Miller  <davem@davemloft.net>
7661
7662         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7663
7664 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7665
7666         * icf.cc (get_section_contents): Add '@' marker after processing the
7667         merge reloc.
7668
7669 2010-03-08  Doug Kwan  <dougkwan@google.com>
7670
7671         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7672         due to a conversion warning.
7673         (Arm_relobj::update_output_local_symbol_count): Check for local
7674         symbol with unset output index.
7675
7676 2010-03-05  Ian Lance Taylor  <iant@google.com>
7677
7678         * options.h (class General_options): Add --spare-dynamic-tags.
7679         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7680         --spare-dynamic-tags.
7681
7682 2010-03-05  Ian Lance Taylor  <iant@google.com>
7683
7684         * incremental.cc: Include "libiberty.h".
7685
7686 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7687
7688         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7689         function, is_info_ member.
7690         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7691         (Versions::Versions): Update caller.
7692         (Versions::define_base_version): Likewise.
7693         (Versions::add_def): Likewise.
7694
7695 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7696
7697         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7698         (Scan::possible_function_pointer_reloc): New function.
7699         (Scan::local_reloc_may_be_function_pointer): Change to call
7700         possible_function_pointer_reloc.
7701         (Scan::global_reloc_may_be_function_pointer): Ditto.
7702         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7703         relocations in ".data.rel.ro._ZTV" section.
7704         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7705         * testsuite/icf_safe_so_test.cc: Ditto.
7706         * testsuite/icf_safe_test.cc: Ditto.
7707         * testsuite/icf_safe_test.sh: Ditto.
7708
7709 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7710             Ian Lance Taylor  <iant@google.com>
7711
7712         * target-reloc.h (relocate_section): Check the symbol table index
7713         for -1U before setting the local symbol index.
7714         (scan_relocatable_relocs): If copying the relocation, record that
7715         the local symbol is required.
7716         * object.h (Symbol_value::is_output_symtab_index_set): New
7717         function.
7718         (Symbol_value::may_be_discarded_from_output_symtab): New
7719         function.
7720         (Symbol_value::has_output_symtab_entry): New function.
7721         (Symbol_value::needs_output_symtab_entry): Remove.
7722         (Symbol_value::output_symtab_index): Make sure the symbol index is
7723         set.
7724         (Symbol_value::set_output_symtab_index): Make sure the symbol
7725         index is not set.  Make sure the new index is valid.
7726         (Symbol_value::set_must_have_output_symtab_entry): New function.
7727         (Symbol_value::has_output_dynsym_entry): New function.
7728         (Symbol_value::set_output_dynsym_index): Make sure the new index
7729         is valid.
7730         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7731         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7732         local symbol if permitted.
7733         (Sized_relobj::do_finalize_local_symbols): Call
7734         is_output_symtab_index_set rather than needs_output_symtab_entry.
7735         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7736         rather than needs_output_symtab_entry.  Call
7737         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7738         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7739         is_output_symtab_index_set rather than needs_output_symtab_entry.
7740         * testsuite/discard_locals_relocatable_test.c: New file.
7741         * testsuite/discard_locals_test.sh: Test -r.
7742         * testsuite/Makefile.am (check_DATA): Add
7743         discard_locals_relocatable_test1.syms,
7744         discard_local_relocatable_test2.syms.
7745         (MOSTLYCLEANFILES): Likewise.  Also add
7746         discard_locals_relocatable_test1.lout and
7747         discard_locals_relocatable_test2.out.
7748         (discard_locals_relocatable_test1.syms): New target.
7749         (discard_locals_relocatable_test.o): New target.
7750         (discard_locals_relocatable_test1.out): New target.
7751         (discard_locals_relocatable_test2.syms): New target.
7752         (discard_locals_relocatable_test2.out): New target.
7753         (various): Add missing ../ld-new dependencies.
7754         * testsuite/Makefile.in: Rebuild.
7755
7756 2010-03-03  Nick Clifton  <nickc@redhat.com>
7757
7758         * po/fi.po: New Finnish translation.
7759
7760 2010-03-01  Doug Kwan  <dougkwan@google.com>
7761
7762         * layout.cc (Layout::Layout): Force section types of .init_array*,
7763         .preinit_array* and .fini_array* sections.
7764         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7765         Fix check of return value of std::string::find.().
7766         (Output_section::Input_section_sort_compare::operator()): Remove
7767         comment about .init_array.
7768         (Output_section::Input_section_sort_init_fini_compare::operator()):
7769         New method.
7770         (Output_section::sort_attached_input_sections): Handle .init_array
7771         and .fini_array specially.
7772         * output.h (Output_section::Inut_section_sort_compare): Update
7773         comment.
7774         (Output_section::Input_section_sort_init_fini_compare): New struct.
7775
7776 2010-02-26  Doug Kwan  <dougkwan@google.com>
7777
7778         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7779         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7780         * testsuite/debug_msg.sh: Avoid matching source line number for
7781         use of global variable undef_int.
7782
7783 2010-02-26  Doug Kwan  <dougkwan@google.com>
7784
7785         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7786         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7787         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7788         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7789         * options.cc (General_options::General_options): Initialize member
7790         fix_v4bx_.
7791         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7792         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7793         and rm_no_fix_v4bx.stdout
7794         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7795         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7796         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7797         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7798         and arm_no_fix_v4bx.
7799         * Makefile.in: Regenerate.
7800         * testsuite/arm_fix_v4bx.s: New file.
7801         * testsuite/arm_fix_v4bx.sh: Ditto.
7802
7803 2010-02-24  Doug Kwan  <dougkwan@google.com>
7804
7805         * arm.cc (Target_arm::got_section): Make the .got section the first
7806         non RELRO section in the data segment.
7807         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7808         suffixes of section names.
7809
7810 2010-02-24  Doug Kwan  <dougkwan@google.com>
7811
7812         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7813         flags and attributes merging if an input file is a binary file.
7814         * fileread.cc (Input_file::open): Record format of original file.
7815         * fileread.h (Input_file::Format): New enum type.
7816         (Input_file::Input_file): Initialize data member format_.
7817         (Input_file::format): New method definition.
7818         (Input_file::format_):: New data member.
7819
7820 2010-02-24  Doug Kwan  <dougkwan@google.com>
7821
7822         * arm.cc (Arm_output_data_got): New class.
7823         (ARM_TCB_SIZE): New constant
7824         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7825         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7826         If user uses a script with a SECTIONS clause, issue only a warning
7827         for a misplaced EXIDX input section.  Otherwise, issue an error.
7828         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7829         garbage collection.
7830         (Target_arm::got_mode_index_entry): Handle static linking.
7831         (Target_arm::Scan::local): Ditto.
7832         (Target_arm::Scan::global): Ditto.
7833         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7834         all incorrectly implemented relocations.
7835         (Target_arm::fix_exidx_coverage): Pass layout to
7836         Arm_output_section::fix_exidx_coverage.
7837         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7838         from ".ARM.exidx." and ".ARM.extab.".
7839
7840 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7841
7842         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7843         section if it does not already exist.
7844         * attributes.cc (Attributes_section_data::Attributes_section_data):
7845         Don't crash if size is zero.
7846
7847 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7848             Ian Lance Taylor  <iant@google.com>
7849
7850         * gold.cc (queue_middle_tasks): If no input files were opened,
7851         exit.
7852         * workqueue.h (Task_function::Task_function): Assert that there is
7853         a blocker.
7854
7855 2010-02-22  Doug Kwan  <dougkwan@google.com>
7856
7857         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7858         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7859         types to avoid warnings due to different uint64_t implementations
7860         on different hosts.
7861
7862 2010-02-21  Doug Kwan  <dougkwan@google.com>
7863
7864         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7865         handling of the maximum backward branch offset.
7866         (Arm_relocate_functions::thumb_branch_common): Ditto.
7867         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7868         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7869         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7870         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7871         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7872         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7873         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7874         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7875         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7876         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7877         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7878         thumb2_bl_out_of_range.o): New rules.
7879         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7880         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7881         thumb2_bl_out_of_range
7882         * testsuite/Makefile.in: Regenerate.
7883         * testsuite/arm_bl_in_range.s: New file.
7884         * testsuite/arm_bl_out_of_range.s: Ditto.
7885         * testsuite/arm_branch_in_range.sh: Ditto.
7886         * testsuite/arm_branch_range.t: Ditto.
7887         * testsuite/thumb2_branch_range.t: Ditto.
7888         * testsuite/thumb_bl_in_range.s: Ditto.
7889         * testsuite/thumb_bl_out_of_range.s: Ditto.
7890         * testsuite/thumb_branch_range.t: Ditto.
7891
7892 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7893
7894         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7895         Add reloc offset information.
7896         * icf.cc (get_section_contents): Change iterators to point to the new
7897         vectors. Add reloc offset information to the contents.
7898         * icf.h (Icf::Sections_reachable_info): New typedef.
7899         (Icf::Sections_reachable_list): New typedef.
7900         (Icf::Offset_info): New typedef.
7901         (Icf::Reloc_info): New struct typedef.
7902         (Icf::Reloc_info_list): New typedef.
7903         (Icf::symbol_reloc_list): Delete method.
7904         (Icf::addend_reloc_list): Delete method.
7905         (Icf::section_reloc_list): Delete method.
7906         (Icf::reloc_info_list): New method.
7907         (Icf::reloc_info_list_): New member.
7908
7909 2010-02-19  Doug Kwan  <dougkwan@google.com>
7910
7911         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7912         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7913         * arm.cc (Arm_relocation_functions): New forward declaration.
7914         (Target_arm::Target_arm): Initialize new data members
7915         got_mod_index_offset_ and tls_base_symbol_defined_.
7916         (Target_arm::Relocate::relocate_tls): New method.
7917         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7918          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7919         New methods.
7920         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7921         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7922         (Target_arm::got_mod_index_offset_,
7923         Target_arm::tls_base_symbol_defined_): New data members.
7924         (Target_arm::Scan::local, Target::Scan::global,
7925         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7926         relocations.
7927
7928 2010-02-18  Doug Kwan  <dougkwan@google.com>
7929
7930         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7931         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7932         text section as a parameter becuase some broken tools may not set
7933         the link in section header.
7934         (Target_arm::has_got_section): New method.
7935         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7936         without any mapping symbol as data only.  Remove warning.
7937         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7938         link in its section header, try to discover the link by inspecting the
7939         REL31 relocation at the beginning of the section.
7940         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7941         in error message.
7942         (Target_arm::Scan::global): Treat any reference to the symbol
7943         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7944
7945 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7946
7947         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7948         (Scan::global_reloc_may_be_function_pointer): New function.
7949         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7950         (Scan::global_reloc_may_be_function_pointer): New function.
7951         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7952         (Scan::global_reloc_may_be_function_pointer): New function.
7953         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7954         (Scan::global_reloc_may_be_function_pointer): New function.
7955         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7956         (Scan::global_reloc_may_be_function_pointer): New function.
7957         (Scan::possible_function_pointer_reloc): New function.
7958         (Target_x86_64::can_check_for_function_pointers): New function.
7959         * gc.h (gc_process_relocs): Scan relocation types to determine if
7960         function pointers were taken for targets that support it.
7961         * icf.cc (Icf::find_identical_sections): Include functions for
7962         folding in safe ICF whose pointer is not taken.
7963         * icf.h (Secn_fptr_taken_set): New typedef.
7964         (fptr_section_id_): New member.
7965         (section_has_function_pointers): New function.
7966         (set_section_has_function_pointers): New function.
7967         (check_section_for_function_pointers): New function.
7968         * options.h: Fix comment for safe ICF option.
7969         * target.h (can_check_for_function_pointers): New function.
7970         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7971         Modify icf_safe_test for X86-64.
7972         * testsuite/Makefile.in: Regenerate.
7973         * testsuite/icf_safe_so_test.cc: New file.
7974         * testsuite/icf_safe_so_test.sh: New file.
7975         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7976         (main): Change to take pointer to function kept_func_3.
7977         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7978         folding is done correctly for X86-64.
7979
7980 2010-02-12  David S. Miller  <davem@davemloft.net>
7981
7982         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7983         is_symbolless parameter.
7984         (Output_reloc<SHT_REL>::is_symbolless): New.
7985         (Output_reloc<SHT_REL>::is_symbolless_): New.
7986         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7987         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7988         (Output_reloc<SHT_RELA>::is_symbolless): New.
7989         (Output_data_reloc::add_global): Handle is_symbolless.
7990         (Output_data_reloc::add_global_relative): Likewise.
7991         (Output_data_reloc::add_local): Likewise.
7992         (Output_data_reloc::add_local_relative): Likewise.
7993         (Output_data_reloc::add_symbolless_global_addend): New.
7994         (Output_data_reloc::add_symbolless_local_addend): New.
7995         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7996         is_symbolless.
7997         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7998         instead of ->is_relative_
7999         (Output_reloc::write): Likewise.
8000         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8001         (Output_reloc::write_rel): Simplify.
8002
8003         * sparc.cc (Target_sparc::Scan::local): Use
8004         ->add_symbolless_local_addend as needed.
8005         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8006         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8007         based upon relocation offset.
8008
8009 2010-02-11  Doug Kwan  <dougkwan@google.com>
8010
8011         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8012         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8013         beginning of function.
8014         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8015         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8016         parameter is_32bit in calls to should_apply_static_reloc.
8017         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8018         (check_DATA): Add arm_abs_global.stdout.
8019         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8020         arm_abs_global.stdout): New rules.
8021         (MOSTLLYCLEANFILES): Add arm_abs_global
8022         * Makefile.in: Regenerate.
8023         * testsuite/arm_abs_global.s: New file.
8024         * testsuite/arm_abs_global.sh: Ditto.
8025         * testsuite/arm_abs_lib.s: Ditto.
8026
8027 2010-02-11  Ian Lance Taylor  <iant@google.com>
8028
8029         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8030         Read_relocs task.
8031         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8032         Allocate_commons_task first.
8033         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8034         task, rather than symtab_lock_.
8035         (Gc_process_relocs::~Gc_process_relocs): New function.
8036         (Gc_process_relocs::is_runnable): Check this_blocker_.
8037         (Gc_process_relocs::locks): Use next_blocker_ rather than
8038         blocker_.
8039         (Scan_relocs::~Scan_relocs): New function.
8040         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8041         symtab_lock_.
8042         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8043         next_blocker_.
8044         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8045         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8046         constructor accordingly.
8047         (class Gc_process_relocs): Likewise.
8048         (class Scan_relocs): Likewise.
8049         * common.h (class Allocate_commons_task): Remove symtab_lock_
8050         field, and corresponding constructor parameter.
8051         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8052         symtab_lock_.
8053         (Allocate_commons_task::locks): Likewise.
8054
8055 2010-02-11  Ian Lance Taylor  <iant@google.com>
8056
8057         * gold-threads.h (class Once): Define.
8058         (class Initialize_lock): Rewrite as child of Once.
8059         * gold-threads.cc (class Once_initialize): Define.
8060         (once_pointer_control): New static variable.
8061         (once_pointer, once_arg): New static variables.
8062         (c_run_once): New static function.
8063         (Once::Once, Once::run_once, Once::internal_run): New functions.
8064         (class Initialize_lock_once): Remove.
8065         (initialize_lock_control): Remove.
8066         (initialize_lock_pointer): Remove.
8067         (initialize_lock_once): Remove.
8068         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8069         (Initialize_lock::initialize): Rewrite.
8070         (Initialize_lock::do_run_once): New function.
8071         * archive.cc (Archive::interpret_header): Only clear name if it is
8072         not already empty.
8073         * fileread.cc: Include "gold-threads.h"
8074         (file_counts_lock): New static variable.
8075         (file_counts_initialize_lock): Likewise.
8076         (File_read::release): Only increment counts when using --stats.
8077         Use a lock around the increment.
8078         * parameters.cc (class Set_parameters_target_once): Define.
8079         (set_parameters_target_once): New static variable.
8080         (Parameters::Parameters): Move here from parameters.h.
8081         (Parameters::set_target): Rewrite.
8082         (Parameters::set_target_once): New function.
8083         (Parameters::clear_target): Move here and rewrite.
8084         * parameters.h (class Parameters): Update declarations.  Add
8085         set_parameters_target_once_ field.
8086         (Parameters::Parameters): Move to parameters.cc.
8087         (Parameters::clear_target): Likewise.
8088         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8089         task.
8090         (Start_group::~Start_group): New function.
8091         (Start_group::is_runnable): New function.
8092         (Start_group::locks, Start_group::run): New functions.
8093         (Finish_group::run): Change saw_undefined to size_t.
8094         * readsyms.h (class Start_group): Define.
8095         (class Finish_group): Change saw_undefined_ field to size_t.
8096         (Finish_group::Finish_group): Remove saw_undefined and
8097         this_blocker parameters.  Change all callers.
8098         (Finish_group::set_saw_undefined): New function.
8099         (Finish_group::set_blocker): New function.
8100         * symtab.h (class Symbol_table): Change saw_undefined to return
8101         size_t.  Change saw_undefined_ field to size_t.
8102         * target-select.cc (Set_target_once::do_run_once): New function.
8103         (Target_selector::Target_selector): Initialize set_target_once_
8104         field.  Don't initialize lock_ and initialize_lock_ fields.
8105         (Target_selector::instantiate_target): Rewrite.
8106         (Target_selector::set_target): New function.
8107         * target-select.h (class Set_target_once): Define.
8108         (class Target_selector): Update declarations.  Make
8109         Set_target_once a friend.  Remove lock_ and initialize_lock_
8110         fields.  Add set_target_once_ field.
8111
8112 2010-02-10  Ian Lance Taylor  <iant@google.com>
8113
8114         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8115         queueing any tasks.
8116         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8117         (queue_middle_tasks): Add all blockers before queueing any tasks.
8118         (queue_final_tasks): Likewise.
8119         * token.h (Task_token::add_blockers): New function.
8120         * object.h (Input_objects::number_of_relobjs): New function.
8121
8122 2010-02-10  Ian Lance Taylor  <iant@google.com>
8123
8124         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8125         shared, not if not position independent.
8126         * x86_64.cc (Relocate::relocate_tls): Likewise.
8127         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8128         (tls_pie_pic_test): New target.
8129         * testsuite/Makefile.in: Rebuild.
8130
8131         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8132         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8133         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8134         * testsuite/Makefile.in: Rebuild.
8135
8136 2010-02-09  David S. Miller  <davem@davemloft.net>
8137
8138         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8139         R_SPARC_RELATIVE using ->add_local_relative().
8140         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8141
8142         * output.h (Output_data_dynamic::add_section_size): New method
8143         that takes two Output_data objects.
8144         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8145         entry param.  Handle it in initializers.
8146         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8147         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8148         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8149         arg.
8150         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8151         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8152         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8153         for dynrel_includes_plt.
8154         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8155         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8156         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8157         before .rela.plt
8158         (Target_sparc::do_finalize_sections): Update to pass true for
8159         dynrel_includes_plt.
8160         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8161         output before .rela.plt
8162         (Target_powerpc::do_finalize_sections): Update to pass true for
8163         dynrel_includes_plt when 32-bit.
8164
8165 2010-02-08  Doug Kwan  <dougkwan@google.com>
8166
8167         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8168         method.
8169         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8170         Arm_relobj::scan_section_for_cortex_a8_stubs,
8171         Arm_relobj::do_relocation_section): Instead of calling
8172         Output_section::output_address, use faster
8173         Arm_relobj::simple_input_section_output_address.
8174
8175 2010-02-08  David S. Miller  <davem@davemloft.net>
8176
8177         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8178         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8179         relocation helper function.
8180
8181         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8182         just like R_SPARC_GOT{10,13,22}.
8183         (Target_sparc::Scan::local): Likewise.
8184         (Target_sparc::Relocate:relocate): Likewise.
8185
8186 2010-02-06  Ian Lance Taylor  <iant@google.com>
8187
8188         * configure.ac: Rewrite targetobjs duplicate removal code to use
8189         only shell constructs.
8190         * configure: Rebuild.
8191
8192 2010-02-05  Doug Kwan  <dougkwan@google.com>
8193
8194         PR 11247
8195         * arm.cc (Arm_relobj::section_is_scannable): New method.
8196         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8197         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8198
8199 2010-02-04  Doug Kwan  <dougkwan@google.com>
8200
8201         PR 11247
8202         * arm-reloc-property.cc (cstdio): Include.
8203         * configure.ac (targetobjs): Remove duplicates.
8204         * configure: Regenerate.
8205         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8206         big and little endian version for a given address size.
8207
8208 2010-02-03  Doug Kwan  <dougkwan@google.com>
8209
8210         * arm-reloc-property.cc
8211         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8212         definition.
8213         * arm-reloc-property.h
8214         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8215         New method definition.
8216         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8217         declaration.
8218         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8219         overflow to N.
8220         (GOT_PREL): Change implemented to Y.
8221         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8222         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8223         (Arm_relocate_functions::movw_abs_nc): Remove method.
8224         (Arm_relocate_functions::movt_abs): Ditto.
8225         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8226         (Arm_relocate_functions::thm_movt_abs): Ditto.
8227         (Arm_relocate_functions::movw_rel_nc): Ditto.
8228         (Arm_relocate_functions::movw_rel): Ditto.
8229         (Arm_relocate_functions::movt_rel): Ditto.
8230         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8231         (Arm_relocate_functions:thm_movw_rel): Ditto.
8232         (Arm_relocate_functions:thm_movt_rel): Ditto.
8233         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8234         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8235         New method definitions.
8236         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8237         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8238         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8239         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8240         (Target_arm::Relocate::relocate): Check for non-static or
8241         unimplemented relocation code and exit early.  Change calls to
8242         Target_arm::reloc_uses_thumb_bit and
8243         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8244         instead.  Refactor code to handle similar relocations to increase
8245         code sharing.  Remove check for unsupported relocation code in switch
8246         statement.
8247         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8248         relocation property table to find out size.  Change error message to
8249         print out the name of a relocation code instead of the numeric value.
8250         (Target_arm::scan_reloc_for_stub): Use relocation property table
8251         instead of calling Target_arm::reloc_uses_thumb_bit().
8252
8253 2010-02-02  Doug Kwan  <dougkwan@google.com>
8254
8255         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8256         types of relaxed input section.
8257
8258 2010-02-02  Doug Kwan  <dougkwan@google.com>
8259
8260         * Makefile.am (HFILES): Add arm-reloc-property.h.
8261         (DEFFILES): New.
8262         (TARGETSOURCES): Add arm-reloc-property.cc
8263         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8264         (libgold_a_SOURCES): $(DEFFILES)
8265         * Makefile.in: Regenerate.
8266         * arm-reloc-property.cc: New file.
8267         * arm-reloc-property.h: New file.
8268         * arm-reloc.def: New file.
8269         * arm.cc: Update comments.
8270         (arm-reloc-property.h): New included header.
8271         (arm_reloc_property_table): New global variable.
8272         (Target_arm::do_select_as_default_target): New method definition.
8273         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8274         arm-reloc-property to targ_extra_obj.
8275         * parameters.cc (set_parameters_target): Call
8276         Target::select_as_default_target().
8277         * target.h (Target::select_as_default_target): New method definition.
8278         (Target::do_select_as_default_target): Same.
8279
8280 2010-02-01  Doug Kwan  <dougkwan@google.com>
8281
8282         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8283         first_output_text_section_.
8284         (Arm_exidx_fixup::first_output_text_section): New method definition.
8285         (Arm_exidx_fixup::first_output_text_section_): New data member.
8286         (Arm_exidx_fixup::process_exidx_section): Record the first text
8287         output section seen.
8288         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8289         and entsize in output section header.
8290
8291 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8292
8293         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8294         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8295         (Arm_relocate_functions::thm_alu11): New Method.
8296         (Arm_relocate_functions::thm_pc8): New Method.
8297         (Arm_relocate_functions::thm_pc12): New Method.
8298         (Target_arm::Scan::local): Handle the relocations.
8299         (Target_arm::Scan::global): Likewise.
8300         (Target_arm::Relocate::relocate): Likewise.
8301         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8302
8303 2010-01-29  Doug Kwan  <dougkwan@google.com>
8304
8305         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8306         of relocation types as ld.
8307
8308 2010-01-29  Doug Kwan  <dougkwan@google.com>
8309
8310         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8311         to public.
8312         (Arm_relocate_functions::thumb_branch_common): Ditto.
8313         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8314         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8315         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8316         Arm_relocate_functions::jump24): Remove.
8317         (Target_arm::Relocate::relocate): Adjust code to call
8318         Arm_relocation_functions::arm_branch_common and
8319         Arm_relocation_functions::thumb_branch_common instead of their removed
8320         wrappers.  Merge switch-cases together to reduce source code size.
8321
8322 2010-01-29  Doug Kwan  <dougkwan@google.com>
8323
8324         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8325         output_local_symbol_count_needs_update_.
8326         (Arm_relobj::output_local_symbol_count_needs_update,
8327          Arm_relobj::set_output_local_symbol_count_needs_update,
8328          Arm_relobj::update_output_local_symbol_count): New methods.
8329         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8330         member.
8331         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8332         of pointed function as in a R_ARM_PREL31 relocation.
8333         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8334         for output local symbol count updating.
8335         (Target_arm::do_relax): Update output local symbol counts in objects
8336         if necessary.
8337         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8338
8339 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8340
8341         * arm.cc: Added support for the ARM relocations:
8342         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8343         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8344         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8345         movw_prel_nc).
8346         (Arm_relocate_functions::movw_rel): New method.
8347         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8348         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8349         thm_movw_prel_nc).
8350         (Arm_relocate_functions::thm_movw_rel): New method.
8351         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8352         thm_movt_prel).
8353         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8354         relocations.
8355         (Target_arm::Scan::global): Likewise.
8356         (Target_arm::Relocate::relocate): Likewise.
8357         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8358         Likewise.
8359
8360 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8361
8362         * arm.cc: Added support for ARM group relocations.
8363         (Target_arm::reloc_needs_sym_origin): New method.
8364         (Arm_relocate_functions::calc_grp_kn): New method.
8365         (Arm_relocate_functions::calc_grp_residual): New method.
8366         (Arm_relocate_functions::calc_grp_gn): New method.
8367         (Arm_relocate_functions::arm_grp_alu): New Method.
8368         (Arm_relocate_functions::arm_grp_ldr): New Method.
8369         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8370         (Arm_relocate_functions::arm_grp_ldc): New Method.
8371         (Target_arm::Scan::local): Handle the ARM group relocations.
8372         (Target_arm::Scan::global): Likewise.
8373         (Target_arm::Relocate::relocate): Likewise.
8374         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8375         Likewise.
8376
8377 2010-01-26  Doug Kwan  <dougkwan@google.com>
8378
8379         * arm.cc (set): Include.
8380         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8381         pointer type.
8382         (Arm_output_section::Text_section_list): New type.
8383         (Arm_output_section::append_text_sections_to_list): New method.
8384         (Arm_output_section::fix_exidx_coverage): Ditto.
8385         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8386         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8387         Relobj::set_section_offset() instead of
8388         Sized_relobj::invalidate_section_offset().
8389         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8390         parameter for section headers. Ignore relocation sections for
8391         unallocated sections and EXIDX sections.
8392         (Target_arm::fix_exidx_coverage): New method.
8393         (Target_arm::output_section_address_less_than): New type.
8394         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8395         linked text section instead of the EXIDX section.
8396         (Arm_output_section::create_stub_group): Add an assertion to check
8397         that this is not an EXIDX output section.
8398         (Arm_output_section::append_text_sections_to_list): New method.
8399         (Arm_output_section::fix_exidx_coverage): Ditto.
8400         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8401         Arm_relobj::section_needs_reloc_stub_scanning.
8402         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8403         first pass.
8404         (Target_arm::fix_exidx_coverage): New method.
8405         * object.h (Relobj::set_output_section): New method.
8406         (Sized_relobj::invalidate_section_offset): Remove method.
8407         (Sized_relobj::do_invalidate_section_offset): Remove method.
8408         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8409
8410 2010-01-25  Doug Kwan  <dougkwan@google.com>
8411
8412         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8413         Fix warning due to signed and unsigned comparison on a 32-bit host.
8414
8415 2010-01-22  Doug Kwan  <dougkwan@google.com>
8416
8417         * arm.cc (Target_arm::do_relax): Record an output section for section
8418         offset adjustment it contains any stub table that has changed.
8419         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8420         offsets in an output section if necessary.
8421         * output.cc (Output_section::Output_section): Initialize
8422         section_offsets_need_adjustments_.
8423         (Output_section::add_input_section_for_script): Renamed to
8424         Output_section::add_simple_input_section.
8425         (Output_section::save_states): Add a comment.
8426         (Output_section::discard_states): New method defintion.
8427         (Output_section::adjust_section_offsets): Same.
8428         * output.h (Output_section::add_input_section_for_script): Renamed to
8429         Output_section::add_simple_input_section.
8430         (Output_section::discard_states): New method declaration.
8431         (Output_section::adjust_section_offsets): Same.
8432         (Output_section::section_offsets_need_adjustment,
8433         Output_section::set_section_offsets_need_adjustment): New method
8434         definitions.
8435         (Output_section::section_offsets_need_adjustment_): New data member.
8436         * script-sections.cc
8437         (Output_section_element_input::set_section_address): Adjust code for
8438         renaming of Output_section::add_input_section_for_script.
8439         (Orphan_output_section::set_section_address): Same.
8440
8441 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8442
8443         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8444         Fix_v4bx enum values .
8445         * gold/options.h (General_options): New option definitions.
8446         (General_options::fix_v4bx): New method.
8447         (General_options::Fix_v4bx): New enum.
8448         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8449         (General_options::parse_fix_v4bx_interworking): New method.
8450
8451 2010-01-22  Doug Kwan  <dougkwan@google.com>
8452
8453         * arm.cc (Arm_exidx_fixup): New class.
8454
8455 2010-01-21  Doug Kwan  <dougkwan@google.com>
8456
8457         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8458         classes.
8459         (Arm_exidx_section_offset_map): New type.
8460
8461 2010-01-21  Doug Kwan  <dougkwan@google.com>
8462
8463         * arm.cc (Arm_exidx_input_section): New class.
8464         (Arm_relobj::exidx_input_section_by_link,
8465         Arm_relobj::exidx_input_section_by_shndx,
8466         Arm_relobj::make_exidx_input_section): New methods.
8467         (read_arm_attributes_section): Remove.
8468         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8469         information about them.
8470         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8471         to here.
8472
8473 2010-01-20  Doug Kwan  <dougkwan@google.com>
8474
8475         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8476         Input_section_specifier to Section_id.
8477         (Target_arm::new_arm_input_section: Adjust code for change of key
8478         type.
8479         (Target_arm::find_arm_input_section): Ditto.
8480         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8481         (Section_id): Remove.
8482         (Garbage_collection::Section_id_hash): Remove.
8483         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8484         (Section_id): Remove.
8485         (Icf::Section_id_hash): Remove.
8486         * object.h (Section_id, Const_section_id, Section_id_hash,
8487         Const_section_id_hash): New type definitions.
8488         * output.cc (Output_section::add_relaxed_input_section): Change to
8489         use Const_section_id instead of Input_section_specifier as key type.
8490         (Output_section::add_merge_input_section): Ditto.
8491         (Output_section::build_relaxation_map): Change to use Section_id
8492         instead of Input_section_specifier as key type.
8493         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8494         Ditto.
8495         (Output_section::convert_input_sections_to_relaxed_sections): Change
8496         to use Const_section_id instead of Input_section_specifier as key type.
8497         (Output_section::find_merge_section): Ditto.
8498         (Output_section::find_relaxed_input_section): Ditto.
8499         * output.h (Input_section_specifier): Remove class.
8500         (Output_section::Output_section_data_by_input_section_map): Change
8501         key type to Const_section_id.
8502         (Output_section::Output_relaxed_input_section_by_input_section_map):
8503         Ditto.
8504         (Output_section::Relaxation_map): Change key type to Section_id.
8505
8506 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8507
8508         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8509         (class Arm_v4bx_stub): New class.
8510         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8511         (Stub_factory::make_arm_v4bx_stub): New method.
8512         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8513         (Stub_table::empty): Handle v4bx stubs.
8514         (Stub_table::add_arm_v4bx_stub): New method.
8515         (Stub_table::find_arm_v4bx_stub): New method.
8516         (Arm_relocate_functions::v4bx): New method.
8517         (Target_arm::fix_v4bx): New method.
8518         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8519         (Stub_table::relocate_stubs): Likewise.
8520         (Stub_table::do_write): Likewise.
8521         (Stub_table::update_data_size_and_addralign): Likewise.
8522         (Stub_table::finalize_stubs):  Likewise.
8523         (Target_arm::Scan::local): Likewise.
8524         (Target_arm::Scan::global): Likewise.
8525         (Target_arm::do_finalize_sections): Likewise.
8526         (Target_arm::Relocate::relocate): Likewise.
8527         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8528         Likewise.
8529         (Target_arm::scan_reloc_for_stub): Likewise.
8530         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8531
8532 2010-01-19  Ian Lance Taylor  <iant@google.com>
8533
8534         * output.cc (Output_section_headers::do_sized_write): Write large
8535         segment count to sh_info field.
8536         (Output_file_header::do_sized_write): For large segment count,
8537         write PN_XNUM to e_phnum field.
8538
8539 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8540
8541         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8542         (Arm_relocate_functions::thm_jump8): New function.
8543         (Arm_relocate_functions::thm_jump11): New function.
8544         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8545         R_ARM_THM_JUMP11.
8546         (Target_arm::Scan::global): Likewise.
8547         (Target_arm::Relocate::relocate): Likewise.
8548         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8549         Likewise.
8550
8551 2010-01-14  Doug Kwan  <dougkwan@google.com>
8552
8553         * arm.cc (map, utility): Include headers.
8554         (Target_arm::apply_cortex_a8_workaround): New method.
8555         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8556         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8557         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8558         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8559         the --[no-]fix-cortex-a8 command line options.
8560         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8561         (Target_arm::relocate_stub): Use addend in instruction template.
8562         * options.h (DEFINE_bool): Set the user-set flag.
8563         (General_options): Add --[no-]-fix-cortex options.
8564         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8565         : Update fast look-up map after conversion.
8566
8567 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8568
8569         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8570         in the first pass of do_layout.
8571
8572 2010-01-13  Doug Kwan  <dougkwan@google.com>
8573
8574         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8575         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8576         apparent compiler problem of not folding static constant integral
8577         data members of elfcpp::Elf_sizes<32>.
8578
8579 2010-01-13  Doug Kwan  <dougkwan@google.com>
8580
8581         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8582         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8583         Arm_relobj::scan_section_for_cortex_a8_erratum,
8584         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8585         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8586         sections to scan for relocation stubs into a new method
8587         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8588         relocation and Cortex-A8 stub scanning.
8589         (Target_arm::do_relax): Force stubs to be after stubbed sections
8590         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8591         the beginning of a new relaxation pass.  Update a comment.
8592         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8593
8594 2010-01-12  Ian Lance Taylor  <iant@google.com>
8595
8596         * target-reloc.h (visibility_error): New inline function.
8597         (relocate_section): Call visibility_error.
8598         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8599         (MOSTLYCLEANFILES): Likewise.
8600         (protected_4_pic.o, protected_3.err): New targets.
8601         * testsuite/protected_4.cc: New file.
8602
8603 2010-01-12  Doug Kwan  <dougkwan@google.com>
8604
8605         * arm.cc (Cortex_a8_reloc): New class.
8606         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8607         and cortex_a8_relocs_info_.
8608         (Target_arm::fix_cortex_a8): New method definition.
8609         (Target_arm::Cortex_a8_relocs_info): New type.
8610         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8611         New data member declarations.
8612         (Target_arm::scan_reloc_for_stub): Record information about
8613         relocations for THUMB branches that might be exempted from the
8614         Cortex-A8 workaround.
8615         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8616         at the beginning of a relaxation pass.
8617
8618 2010-01-12  Doug Kwan  <dougkwan@google.com>
8619
8620         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8621         (Arm_relobj::Mapping_symbol_position,
8622          Arm_reloj::Mapping_symbol_position_less,
8623          Arm_relobj::Mapping_symbols_info): New types.
8624         (Target_arm::is_mapping_symbol_name): New method definition.
8625         (Arm_relobj::do_count_local_symbols): Save information about mapping
8626         symbols.
8627
8628 2010-01-11  Doug Kwan  <dougkwan@google.com>
8629
8630         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8631         Arm_relocate_functions::thumb32_branch_upper,
8632         Arm_relocate_functions::thumb32_branch_lower,
8633         Arm_relocate_functions::thumb32_cond_branch_offset,
8634         Arm_relocate_functions::thumb32_cond_branch_upper,
8635         Arm_relocate_functions::thumb32_cond_branch_lower,
8636         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8637         branch offset encoding.
8638         (Arm_relocate_functions::thumb_branch_common): Use new branch
8639         offset encoding methods to avoid code duplication.
8640         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8641         (Stub_addend_reader::operator()): Use new branch encoding method
8642         to avoid code duplication.
8643
8644 2010-01-11  Doug Kwan  <dougkwan@google.com>
8645
8646         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8647         (Target_arm::do_finalize_sections): Define special EXIDX section
8648         symbols only if referenced.
8649         * gc.h (Garbage_collection::add_reference): New method.
8650         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8651         code duplication.
8652
8653 2010-01-11  Ian Lance Taylor  <iant@google.com>
8654
8655         * script.cc (Version_script_info::build_expression_list_lookup):
8656         Change complaing about duplicate wildcard match from error to
8657         warning.
8658
8659         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8660         of 2009-12-30.
8661         (Version_script_info::Version_script_info): Initialize globs_,
8662         default_version_, default_is_global_, and exact_.  Don't
8663         initialize globals_ or locals_.
8664         (Version_script_info::build_lookup_tables): Build local symbols
8665         first.
8666         (Version_script_info::unquote): New function.
8667         (Version_script_info::add_exact_match): New function.
8668         (Version_script_info::build_expression_list_lookup): Remove lookup
8669         parameter.  Add is_global parameter.  Change all callers.  Handle
8670         wildcard pattern specially.  Unquote pattern.  Call
8671         add_exact_match.
8672         (Version_script_info::get_name_to_match): New function.
8673         (Version_script_info::get_symbol_version): New function.
8674         (Version_script_info::get_symbol_version_helper): Remove.
8675         (Version_script_info::check_unmatched_names): Call unquote.
8676         * script.h (class Version_script_info): Change get_symbol_version
8677         to be non-inline and add is_global parameter; change all callers.
8678         Rewrite symbol_is_local.  Update declarations.  Define struct
8679         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8680         Remove globals_ and locals_ members.  Add exact_, globs_,
8681         default_version_, is_global_.
8682         (Version_script_info::Glob): Remove pattern, add expression and
8683         is_global.  Update constructor.  Change all callers.
8684         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8685         default version.
8686         (Versions::symbol_section_contents): If a symbol is undefined, or
8687         defined in a dynamic object, set the version index to
8688         VER_NDX_LOCAL.
8689         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8690         symbol_is_local.
8691         (Symbol_table::add_from_pluginobj): Likewise.
8692         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8693
8694 2010-01-11  Doug Kwan  <dougkwan@google.com>
8695
8696         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8697         (incremental_dump_LDADD): Add linking option for libintl.
8698         * Makefile.in: Regenerate.
8699
8700 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8701
8702         PR gold/11144
8703         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8704         instead of -Ds.
8705         * testsuite/Makefile.in: Regenerated.
8706
8707 2010-01-10  Doug Kwan  <dougkwan@google.com>
8708
8709         * options.h (DEFINE_var): Use parentheses around argument varname__
8710         in macro body to avoid any unintended subsequent substitutions.
8711
8712 2010-01-10  Ian Lance Taylor  <iant@google.com>
8713
8714         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8715         candidates before doing symbol resolution.
8716
8717         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8718         ODR candidates if only one is weak.
8719
8720 2010-01-08  Ian Lance Taylor  <iant@google.com>
8721
8722         * script.cc (Version_script_info::build_expression_list_lookup):
8723         Don't warn about ambiguous version, just record the ambiguity.
8724         (Version_script_info::get_symbol_version_helper): Give error if
8725         version is ambiguous.
8726
8727 2010-01-08  Doug Kwan  <dougkwan@google.com>
8728
8729         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8730         prev_data_size_ and prev_addralign_.  Remove initializer for
8731         deleted data member has_been_changed_.
8732         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8733         to determine if the table is empty.
8734         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8735         Remove.
8736         (Stub_table::add_reloc_stub): Define method in class definition
8737         instead of just declaring it there.
8738         (Stub_table::add_cortex_a8_stub): New method definition.
8739         (Stub_table::update_data_size_and_addralign): Ditto.
8740         (Stub_table::finalize_stubs): Ditto.
8741         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8742         (Stub_table::do_addralign_): Return address alignment in the
8743         (Stub_table::do_reset_address_and_file_offset): Define method in
8744         class definition instead of declaring it there.  Set current data
8745         size to be the data size of the previous pass.
8746         (Stub_table::set_final_data_size): Use current data size as the
8747         final data size.
8748         (Stub_table::relocate_stub): Change parameter type of stub from
8749         Reloc_stub pointer to Stub pointer.
8750         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8751         (Stub_table::Cortex_a8_stub_list): New typedef.
8752         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8753          Stub_table::prev_addralign_): New data member.
8754         (Arm_relobj::Arm_relobj): Initialize data member
8755         section_has_cortex_a8_workaround_.
8756         (Arm_relobj::section_has_cortex_a8_workaround,
8757          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8758          definitions.
8759         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8760         declarations.
8761         (Target_arm::relocate_stub): Change parameter type of stub from
8762         Reloc_stub pointer to Stub pointer.
8763         (Insn_template::size, Insn_template::alignment): Handle
8764         THUMB16_SPECIAL_TYPE.
8765         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8766          Stub_table::update_data_size_and_addralign,
8767          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8768         definitions.
8769         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8770         (Stub_table::do_write): Ditto.
8771         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8772
8773 2010-01-08  Ian Lance Taylor  <iant@google.com>
8774
8775         PR 11108
8776         * symtab.h (class Symbol): Remove fields is_target_special_ and
8777         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8778         (Symbol::is_defined_in_discarded_section): New function.
8779         (Symbol::set_is_defined_in_discarded_section): New function.
8780         (Symbol::has_plt_offset): Rewrite.
8781         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8782         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8783         Don't initialize is_target_special_ or has_plt_offset_.
8784         Initialize is_defined_in_discarded_section_.
8785         (Symbol_table::add_from_relobj): If appropriate, set
8786         is_defined_in_discarded_section.
8787         * resolve.cc (Symbol::override_base_with_special): Don't test
8788         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8789         * target-reloc.h (relocate_section): Do special handling for
8790         symbols defined in discarded sections for global symbols as well
8791         as local symbols.
8792
8793 2010-01-08  Ian Lance Taylor  <iant@google.com>
8794
8795         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8796         the SHT_SYMTAB case.
8797
8798 2010-01-08  Ian Lance Taylor  <iant@google.com>
8799
8800         * object.cc (Sized_relobj::do_layout): Don't get confused if
8801         layout_eh_frame returns NULL.
8802
8803 2010-01-08  Ian Lance Taylor  <iant@google.com>
8804
8805         PR 11084
8806         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8807         dynamic symbol table, use the normal symbol table.
8808         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8809         symbol table.
8810
8811 2010-01-08  Ian Lance Taylor  <iant@google.com>
8812
8813         PR 11072
8814         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8815         sections.
8816
8817 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8818
8819         * version.cc (print_version): Change to "Copyright 2010".
8820
8821 2010-01-08  Ian Lance Taylor  <iant@google.com>
8822
8823         PR 10287
8824         PR 11063
8825         * i386.cc (class Target_i386): Change return type of plt_section
8826         to be non-const.
8827         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8828         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8829         tls_desc_rel_ field.
8830         (Output_data_plt_i386::rel_tls_desc): New function.
8831         (Target_i386::rel_tls_desc_section): New function.
8832         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8833         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8834         R_386_TLS_DESC reloc in rel_tls_desc_section.
8835         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8836         Define struct Tlsdesc_info.
8837         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8838         (Target_x86_64::do_reloc_symbol_index): New function.
8839         (Target_x86_64::add_tlsdesc_info): New function.
8840         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8841         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8842         tlsdesc_rel_ field.
8843         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8844         all callers.
8845         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8846         (Target_x86_64::rela_tlsdesc_section): New function.
8847         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8848         handling.
8849         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8850         (Target_x86_64::do_reloc_addend): New function.
8851         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8852         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8853         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8854         (Output_reloc::type): New function.
8855         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8856         (Output_reloc::is_target_specific): New function.
8857         (Output_reloc::target_arg): New function.
8858         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8859         absolute relocs and target specific relocs.
8860         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8861         add_target_specific.
8862         (class Output_data_reloc) [SHT_RELA]: Likewise.
8863         * output.cc (Output_reloc::Output_reloc): Add four new versions
8864         for absolute relocs and target specific relocs.
8865         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8866         (Output_reloc::get_symbol_index): Likewise.
8867         (Output_reloc::local_section_offset): Check that local_sym_index_
8868         is not TARGET_CODE or 0.
8869         (Output_reloc::symbol_value): Likewise.
8870         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8871         reloc.
8872         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8873         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8874         functions.
8875         * layout.cc (add_target_dynamic_tags): Use output section for
8876         DT_PLTRELSZ and DT_JMPREL.
8877
8878 2010-01-07  Ian Lance Taylor  <iant@google.com>
8879
8880         PR 11061
8881         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8882         function.
8883         (class Output_data_reloc_generic): Define.
8884         (class Output_data_reloc_base): Change base class to
8885         Output_data_reloc_generic.  Change add() method to call
8886         bump_relative_reloc_count for a relative reloc.  Remove
8887         sort_relocs_ field.
8888         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8889         to sort_relocs().
8890         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8891         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8892         appropriate.
8893         * layout.h (class Layout): Update declaration.
8894
8895 2010-01-07  Ian Lance Taylor  <iant@google.com>
8896
8897         * output.h (class Output_data): Add const version of
8898         output_section and do_output_section.
8899         (class Output_section_data): Add const version of
8900         do_output_section.
8901         (class Output_section): Likewise.
8902         * layout.cc (Layout::add_target_dynamic_tags): New function.
8903         * layout.h (class Layout): Update declarations.
8904         * arm.cc (Target_arm::do_finalize_sections): Use
8905         add_target_dynamic_tags.
8906         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8907         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8908         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8909         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8910
8911 2010-01-07  Ian Lance Taylor  <iant@google.com>
8912
8913         PR 11042
8914         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8915         object as needed.
8916
8917 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8918             Ian Lance Taylor  <iant@google.com>
8919
8920         PR 11019
8921         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8922         Xindex::read_symtab_xindex.
8923
8924 2010-01-07  Doug Kwan  <dougkwan@google.com>
8925
8926         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8927         (Insn_template::thumb16_bcond_insn): New method declaration.
8928         (Insn_template): Fix spelling.
8929         (Stub::thumb16_special): New method declaration.
8930         (Stub::do_write): Define virtual method which was previously pure
8931         virtual.
8932         (Stub::do_thumb16_special): New method declaration.
8933         (Stub::do_fixed_endian_write): New template member.
8934         (Reloc_stub::do_write): Remove.
8935         (Reloc_stub::do_fixed_endian_write): Remove.
8936         (Cortex_a8_stub): New class definition.
8937         (Stub_factory::make_cortex_a8_stub): New method definition.
8938         (Stub_factory::Stub_factory): Add missing static storage class
8939         qualifier for elf32_arm_stub_a8_veneer_blx.
8940
8941 2010-01-07  Ian Lance Taylor  <iant@google.com>
8942
8943         PR 10980
8944         * options.h (class General_options): Add --warn-unresolved-symbols
8945         and --error-unresolved-symbols.
8946         * errors.cc (Errors::undefined_symbol): Implement
8947         --warn-unresolved-symbols.
8948
8949         * options.h (class General_options): Add -z text and -z textoff.
8950         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8951
8952 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8953
8954         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8955         (Garbage_collection::cident_sections): New function.
8956         (Garbage_collection::add_cident_section): New function.
8957         (Garbage_collection::cident_sections_): New member.
8958         (gc_process_relocs): Add references to sections whose names are C
8959         identifiers.
8960         * gold.h (cident_section_start_prefix): New constant.
8961         (cident_section_stop_prefix): New constant.
8962         (is_cident): New function.
8963         * layout.cc (Layout::define_section_symbols): Replace string constants
8964         with the newly defined constants.
8965         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8966         C identifiers.
8967         * testsuite/Makefile.am: Add gc_orphan_section_test.
8968         * testsuite/Makefile.in: Regenerate.
8969         * testsuite/gc_orphan_section_test.cc: New file.
8970         * testsuite/gc_orphan_section_test.sh: New file.
8971
8972 2010-01-06  Ian Lance Taylor  <iant@google.com>
8973
8974         PR 10980
8975         * options.h (class General_options): Add --warn-shared-textrel.
8976         * layout.cc (Layout::finish_dynamic_section): Implement
8977         --warn-shared-textrel.
8978
8979         PR 10980
8980         * options.h (class General_options): Add --warn-multiple-gp.
8981
8982 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8983
8984         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8985         $(THREADSLIB) and $(LIBDL).
8986         * Makefile.in: Rebuild.
8987
8988 2010-01-06  Ian Lance Taylor  <iant@google.com>
8989
8990         PR 10980
8991         * options.cc (General_options::parse_section_start): New function.
8992         (General_options::section_start): New function.
8993         (General_options::General_options): Initialize all members.
8994         * options.h: Include <map>
8995         (class General_options): Add --section-start.  Add section_starts_
8996         member.
8997         * layout.cc (Layout::attach_allocated_section_to_segment): If
8998         --section-start was used, set the address of the segment.  Remove
8999         local sort_sections.
9000         (Layout::relaxation_loop_body): If the address of the load segment
9001         has been set by --section-start, don't use it.
9002         * output.h (Output_segment::update_flags_for_output_section): New
9003         function.
9004         * output.cc (Output_segment::add_output_section): Call
9005         update_flags_for_output_section.
9006
9007 2010-01-05  Ian Lance Taylor  <iant@google.com>
9008
9009         PR 10980
9010         * options.h (class General_options): Add --undefined-version.
9011         * script.cc (struct Version_expression): Add was_matched_by_symbol
9012         field.
9013         (Version_script_info::matched_symbol): New function.
9014         (Version_script_info::get_symbol_version_helper): Call
9015         matched_symbol.
9016         (Version_script_info::check_unmatched_names): New function.
9017         * script.h (class Version_script_info): Update declarations.
9018         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9019
9020         * options.h (class General_options): Use DEFINE_bool_alias for
9021         allow_multiple_definition.
9022         * resolve.cc (Symbol_table::should_override): Don't test
9023         allow_multiple_definition.
9024
9025         PR 10980
9026         * options.h (class General_options): Add --cref.
9027         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9028         until after printing cref table.
9029         * cref.cc: Include "symtab.h".
9030         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9031         (Cref_table_compare::operator()): New function.
9032         (Cref_inputs::gather_cref): New function.
9033         (filecol): New static const.
9034         (Cref_inputs::print_cref): New function.
9035         (Cref::print_cref): New function.
9036         * cref.h: Include <cstdio>.
9037         (class Cref): Update declarations.
9038         * mapfile.h (Mapfile::file): New function.
9039         * object.h (class Object): Define Symbols.  Declare virtual
9040         do_get_global_symbols.
9041         (Object::get_global_symbols): New function.
9042         * object.cc (Input_objects::add_object): Pass object to cref_ if
9043         --cref.
9044         (Input_objects::archive_start): Likewise.
9045         (Input_objects::archive_stop): Likewise.
9046         (Input_objects::print_cref): New function.
9047         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9048         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9049         --cref.
9050         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9051         function.
9052         * plugin.h (class Sized_pluginobj): Update declarations.
9053
9054 2010-01-05  Ian Lance Taylor  <iant@google.com>
9055
9056         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9057         to is_default_version.  Rename insdef to insdefault.
9058         (Symbol_table::add_from_relobj): Rename def to is_default_version
9059         and local to is_forced_local.
9060         (Symbol_table::add_from_pluginobj): Likewise.
9061         (Symbol_table::add_from_dynobj): Likewise.
9062         (Symbol_table::define_special_symbol): Rename insdef to
9063         insdefault.
9064
9065 2010-01-04  Ian Lance Taylor  <iant@google.com>
9066
9067         PR 10980
9068         * options.h (class General_options): Add
9069         --allow-multiple-definition and -z muldefs.
9070         * resolve.cc (Symbol_table::should_override): Don't warn about a
9071         multiple symbol definition if --allow-multiple-definition or -z
9072         muldefs.
9073
9074         PR 10980
9075         * options.h (class General_options): Add --add-needed and
9076         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9077         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9078         error if --copy-dt-needed-entries aka --add-needed is used and
9079         would cause a change in behaviour.
9080
9081         PR 10980
9082         * options.h (class General_options): Add -G as a short version of
9083         --shared.  Add no-op options -assert, -g, and -i.
9084
9085 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9086
9087         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9088         check for .text or .gnu.linkonce.t sections.
9089         * icf.cc (Icf::find_identical_sections): Ditto.
9090         Change the detection for mangled function name within the section
9091         name.
9092         * icf.h (is_section_foldable_candidate): New function.
9093
9094 2009-12-30  Ian Lance Taylor  <iant@google.com>
9095
9096         PR 10980
9097         * options.h (class General_options): Permit two dashes with
9098         --retain-symbols-file.
9099
9100 2009-12-30  Ian Lance Taylor  <iant@google.com>
9101
9102         PR 10979
9103         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9104         don't put the file header and segment headers in the text
9105         segment.
9106
9107         PR 10979
9108         * common.cc (Sort_commons::operator()): Stabilize sort when both
9109         entries are NULL.
9110         (Symbol_table::do_allocate_commons_list): When allocating common
9111         symbols, skip a symbol which is no longer common.
9112         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9113         an object before checking its type.
9114         * testsuite/common_test_2.c: New file.
9115         * testsuite/common_test_3.c: New file.
9116         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9117         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9118         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9119         (common_test_2_pic.o, common_test_2.so): New targets.
9120         (common_test_3_pic.o, common_test_3.so): New targets.
9121         * testsuite/Makefile.in: Rebuild.
9122
9123         PR 10979
9124         * script.cc (read_input_script): If we see a new SECTIONS clause,
9125         and we have added an input section, give an error.
9126         * layout.h (class Layout): Add have_added_input_section function.
9127         Add have_added_input_section_ field.
9128         * layout.cc (Layout::Layout): Initialize
9129         have_added_input_section_.
9130         (Layout::layout): Set have_added_input_section_.
9131         (Layout::layout_eh_frame): Likewise.
9132
9133 2009-12-30  Ian Lance Taylor  <iant@google.com>
9134
9135         PR 10931
9136         * options.h (class General_options): Add --sort-common option.
9137         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9138         * common.cc (Sort_common): Add sort_order parameter to
9139         constructor.  Add sort_order_ field.
9140         (Sort_commons::operator): Check sort_order_.
9141         (Symbol_table::allocate_commons): Determine the sort order.
9142         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9143         Change all callers.
9144         (Symbol_table::do_allocate_commons_list): Likewise.
9145
9146 2009-12-30  Ian Lance Taylor  <iant@google.com>
9147
9148         PR 10916
9149         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9150         symbols from this object, don't change the visibility of an
9151         undefined symbol.
9152         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9153
9154 2009-12-30  Ian Lance Taylor  <iant@google.com>
9155
9156         PR 10861
9157         * script.h (class Version_script_info): Define Language enum.
9158         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9159         new fields globals_, locals_, and is_finalized_.
9160         * script.cc: Various formatting fixes.
9161         (class Parser_closure): Change language_stack_ from a vector of
9162         std::string to one of Version_script_info::Language.  Adjust all
9163         uses accordingly.
9164         (class Lazy_demangler): Remove.
9165         (struct Version_expression): Change language from std::string to
9166         Version_script_info::Language.
9167         (Version_script_info::Version_script_info): New function.
9168         (Version_script_info::~Version_script_info): Don't call clear.
9169         (Version_script_info::finalize): New function.
9170         (Version_script_info::build_lookup_tables): New function.
9171         (Version_script_info::build_expression_list_lookup): New
9172         function.
9173         (Version_script_info::get_symbol_version_helper): Rewrite to use
9174         lookup tables.
9175         (Version_script_info::print_expression_list): Adjust to use
9176         Version_script_info::Language.
9177         (script_push_lex_into_version_mode): Check that the version script
9178         has not been finalized.
9179         (version_script_push_lang): Change language string to
9180         Version_script_info::Language.
9181         * options.cc (Command_line::version_script): New function.
9182         * options.h (class General_options): Add finalize_dynamic_list
9183         function.  Change version_script from declaration to definition.
9184         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9185         * testsuite/version_script.map: Remove duplicate def of foo.
9186         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9187         version_script.map.
9188         * testsuite/Makefile.in: Rebuild.
9189
9190 2009-12-30  Ian Lance Taylor  <iant@google.com>
9191
9192         PR 10843
9193         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9194         if the input symbol index is 0, make the output symbol index 0.
9195
9196 2009-12-30  Ian Lance Taylor  <iant@google.com>
9197
9198         PR 10670
9199         * options.h (class General_options): Add -x/--discard-all.
9200         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9201         --discard-all.  If the local symbol needs a dynamic entry, check
9202         that before handling --discard-locals.
9203
9204 2009-12-30  Ian Lance Taylor  <iant@google.com>
9205
9206         PR 10450
9207         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9208         flags to PF_R.
9209         (Output_segment::add_output_section): Don't change the flags if
9210         the type is PT_TLS.
9211
9212         PR 10450
9213         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9214         GNU hash table if they need a dynamic value.  Otherwise, don't add
9215         them if they are defined in a dynamic object or are forced local.
9216
9217 2009-12-29  Ian Lance Taylor  <iant@google.com>
9218
9219         PR 10450
9220         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9221         .gnu.hash table for a 32-bit target.
9222
9223         PR 10450
9224         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9225         regular and a dynamic object only needs a dynamic symbol table
9226         entry if it is externally visible.
9227
9228         PR 10450
9229         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9230         constructor.  Add global_offset_table_ field.
9231         (Target_i386::got_section): Set global_offset_table_.
9232         (Target_i386::do_finalize_sections): Set global_offset_table_
9233         size.
9234         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9235         in constructor.  Add global_offset_table_ field.
9236         (Target_x86_64::got_section): Set global_offset_table_.
9237         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9238         size.
9239
9240         * layout.cc (Layout::Layout): Initialize increase_relro_.
9241         (Layout::get_output_section): Add is_relro, is_last_relro, and
9242         is_first_non_relro parameters.  Change all callers.
9243         (Layout::choose_output_section): Likewise.
9244         (Layout::add_output_section_data): Likewise.
9245         (Layout::make_output_section): Likewise.
9246         (Layout::set_segment_offsets): Clear increase_relro when using a
9247         linker script.
9248         * layout.h (class Layout): Add increase_relro method.  Add
9249         increase_relro_ field.  Update declarations.
9250         * output.cc (Output_section::Output_section): Initialize
9251         is_last_relro_ and is_first_non_relro_.
9252         (Output_segment::add_output_section): Group relro sections is
9253         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9254         (Output_segment::maximum_alignment): Remove relro handling.
9255         (Output_segment::set_section_addresses): Add increase_relro
9256         parameter.  Change all callers.  Add initial alignment to align
9257         relro sections on separate page.  Remove old relro handling.
9258         (Output_segment::set_section_list_addresses): Remove in_relro
9259         parameter.  Change all callers.
9260         (Output_segment::set_offset): Add increase parameter.  Change all
9261         callers.  Remove old relro handling.
9262         * output.h (class Output_section): Add new methods: is_last_relro,
9263         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9264         Add is_last_relro_ and is_first_non_relro_ fields.
9265         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9266         Create separate .got.plt section.  Call increase_relro.
9267         * x86_64.cc (Target_x86_64::got_section): Likewise.
9268         * testsuite/relro_script_test.t: Add .got.plt.
9269
9270         PR 10450
9271         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9272         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9273         (Layout::finalize): Call set_dynamic_symbol_size.
9274         (Layout::set_dynamic_symbol_size): New function.
9275         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9276         set_dynamic_symbol_size.
9277
9278         PR 10450
9279         * output.h (class Output_section): Add is_entsize_zero_ field.
9280         * output.cc (Output_section::Output_section): Initialize
9281         is_entsize_zero_.
9282         (Output_section::set_entsize): If two different entsizes are
9283         requested, force it to zero.
9284         (Output_section::add_input_section): Set flags for .debug_str
9285         before updating section flags.  Set entsize.
9286         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9287         and SHF_STRING if all input sections have those flags.
9288
9289 2009-12-29   Rafael Espindola  <espindola@google.com>
9290
9291         * main.cc (main): Fix the sys time reporting.
9292         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9293         reporting.
9294
9295 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9296
9297         * options.cc (General_options::parse_version): Allow -v to exit
9298         without an error if there is nothing to link.
9299
9300 2009-12-29  Ian Lance Taylor  <iant@google.com>
9301
9302         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9303         using a version of gcc before 4.1.
9304         * configure: Rebuild.
9305
9306 2009-12-28  Chris Demetriou  <cgd@google.com>
9307
9308         * attributes.cc (Output_attributes_section_data::do_write): Use
9309         std::vector::front rather than std::vector::data.
9310
9311 2009-12-28  Ian Lance Taylor  <iant@google.com>
9312
9313         * symtab.h (class Symbol_table): Add enum Defined.
9314         * resolve.cc (Symbol_table::should_override): Add defined
9315         parameter.  Change all callers.  Test whether object is NULL
9316         before calling a method on it.
9317         (Symbol_table::report_resolve_problem): Add defined parameter.
9318         Change all callers.
9319         (Symbol_table::should_override_with_special): Likewise.
9320         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9321         parameter.  Change all callers.
9322         (Symbol_table::do_define_in_output_data): Likewise.
9323         (Symbol_table::define_in_output_segment): Likewise.
9324         (Symbol_table::do_define_in_output_segment): Likewise.
9325         (Symbol_table::define_as_constant): Likewise.
9326         (Symbol_table::do_define_as_constant): Likewise.
9327         * script.h (class Symbol_assignment): Add is_defsym parameter to
9328         constructor; change all callers.
9329         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9330         parameter.  Change all callers.  Add is_defsym_ field.
9331         (class Parser_closure): Add parsing_defsym parameter to
9332         constructor; change all callers.  Add parsing_defsym accessor
9333         function.  Add parsing_defsym_ field.
9334
9335 2009-12-28  Ian Lance Taylor  <iant@google.com>
9336
9337         * gold.cc (queue_middle_tasks): Fix formatting.
9338         * object.cc (Relobj::is_section_name_included): Likewise.
9339
9340 2009-12-23  Ian Lance Taylor  <iant@google.com>
9341
9342         * i386.cc (Target_i386::do_calls_non_split): Recognize
9343         -fsplit-stack prologue for a function with a static chain.
9344         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9345         -fsplit-stack prologue when using %r11.
9346
9347 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9348
9349         * options.cc (General_options::parse_version): Make -v continue and do
9350         the link like GNU ld does.
9351
9352 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9353
9354         * Makefile.am (CCFILES): Add timer.cc.
9355         (HFILES): Add timer.h.
9356         * configure.ac: Check for sysconf and times.
9357         * main.cc: include timer.h.
9358         (main): Use Timer instead of get_run_time.
9359         * timer.cc: New.
9360         * timer.h: New.
9361         * workqueue.cc: include timer.h.
9362         (Workqueue::find_and_run_task):
9363         Report user, sys and wall time.
9364         * Makefile.in: Regenerate.
9365         * config.in: Regenerate.
9366         * configure: Regenerate.
9367
9368 2009-12-16  Doug Kwan  <dougkwan@google.com>
9369
9370         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9371         sections.
9372         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9373         relaxed input sections.
9374         * output.cc (Output_section::find_relaxed_input_section): Change
9375         return type to Output_relaxed_input_section pointer.  Adjust code
9376         for new type of relaxed_input_section_map_.
9377         * output.h (Output_section::find_relaxed_input_section): Change
9378         return type to Output_relaxed_input_section pointer.
9379         (Output_section::Output_relaxed_input_section_by_input_section_map):
9380         New type.
9381         (Output_section::relaxed_input_section_map_): Change type to
9382         Output_section::Output_relaxed_input_section_by_input_section_map.
9383         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9384         input section.
9385
9386 2009-12-15  Ian Lance Taylor  <iant@google.com>
9387
9388         * layout.cc (Layout::create_shstrtab): Only write out after input
9389         sections if we are compressing debug sections.
9390
9391 2009-12-15  Ian Lance Taylor  <iant@google.com>
9392
9393         * archive.cc (Archive::add_symbols): Only look up a symbol without
9394         a version if there is, in fact, a version.
9395
9396 2009-12-14  Ian Lance Taylor  <iant@google.com>
9397
9398         Revert -Wshadow changes, all changes from:
9399         2009-12-11  Doug Kwan  <dougkwan@google.com>
9400         2009-12-11  Nick Clifton  <nickc@redhat.com>
9401         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9402
9403 2009-12-11  Doug Kwan  <dougkwan@google.com>
9404
9405         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9406         due to -Wshadow.
9407         * attributes.cc (Object_attribute::size): Ditto.
9408         (Attributes_section_data::size): Ditto.
9409         (Attributes_section_data::Attributes_section_data): Ditto.
9410         (Output_attributes_section_data::do_write): Ditto.
9411         * attributes.h (Object_attribute::set_type): Ditto.
9412         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9413
9414 2009-12-11  Nick Clifton  <nickc@redhat.com>
9415
9416         * archive.cc: Fix shadowed variable warnings.
9417         * arm.cc: Likewise.
9418         * compressed_output.cc: Likewise.
9419         * compressed_output.h: Likewise.
9420         * configure: Likewise.
9421         * dwarf_reader.cc: Likewise.
9422         * dynobj.cc: Likewise.
9423         * dynobj.h: Likewise.
9424         * ehframe.cc: Likewise.
9425         * ehframe.h: Likewise.
9426         * errors.cc: Likewise.
9427         * expression.cc: Likewise.
9428         * fileread.cc: Likewise.
9429         * fileread.h: Likewise.
9430         * freebsd.h: Likewise.
9431         * i386.cc: Likewise.
9432         * icf.cc: Likewise.
9433         * incremental.h: Likewise.
9434         * layout.cc: Likewise.
9435         * layout.h: Likewise.
9436         * mapfile.cc: Likewise.
9437         * merge.cc: Likewise.
9438         * merge.h: Likewise.
9439         * object.cc: Likewise.
9440         * object.h: Likewise.
9441         * options.h: Likewise.
9442         * output.cc: Likewise.
9443         * output.h: Likewise.
9444         * parameters.cc: Likewise.
9445         * plugin.cc: Likewise.
9446         * powerpc.cc: Likewise.
9447         * reduced_debug_output.cc: Likewise.
9448         * reduced_debug_output.h: Likewise.
9449         * reloc.cc: Likewise.
9450         * reloc.h: Likewise.
9451         * resolve.cc: Likewise.
9452         * script-sections.cc: Likewise.
9453         * script.cc: Likewise.
9454         * script.h: Likewise.
9455         * sparc.cc: Likewise.
9456         * symtab.cc: Likewise.
9457         * symtab.h: Likewise.
9458         * target-select.cc: Likewise.
9459         * target-select.h: Likewise.
9460         * token.h: Likewise.
9461         * workqueue.cc: Likewise.
9462         * workqueue.h: Likewise.
9463         * x86_64.cc: Likewise.
9464
9465 2009-12-10  Doug Kwan  <dougkwan@google.com>
9466
9467         * arm.cc (attributes.h): New include.
9468         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9469         (Arm_relobj::~Arm_relobj): Delete object pointed by
9470         attributes_section_data_.
9471         (Arm_relobj::attributes_section_data): New method definition.
9472         (Arm_relobj::attributes_section_data_): New data member declaration.
9473         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9474         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9475         attributes_section_data_.
9476         (Arm_dynobj::attributes_section_data): New method definition.
9477         (Arm_dynobj::attributes_section_data_): New data member declaration.
9478         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9479         initialization value of may_use_blx_ to false.
9480         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9481         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9482         object attributes to compute results instead of hard-coding.
9483         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9484         Target_arm::get_secondary_compatible_arch,
9485         Target_arm::set_secondary_compatible_arch
9486         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9487         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9488         New method declarations.
9489         (Target_arm::get_aeabi_object_attribute): New method definition.
9490         (Target_arm::attributes_section_data_): New data member declaration.
9491         (read_arm_attributes_section): New template definition.
9492         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9493         (Arm_dynobj::do_read_symbols): Ditto.
9494         (Target_arm::do_finalize_sections): Merge attributes sections from
9495         input.  Check for BLX use after attributes section merging.
9496         Fix __exidx_start and __exidx_end visibility.  Create an
9497         .ARM.attributes section if necessary.
9498         (Target_arm::get_secondary_compatible_arch,
9499         Target_arm::set_secondary_compatible_arch,
9500         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9501         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9502         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9503         New method definitions.
9504
9505 2009-12-09  Ian Lance Taylor  <iant@google.com>
9506
9507         * plugin.cc (Plugin::load): Don't cast from void* to a function
9508         pointer.
9509
9510 2009-12-09  Ian Lance Taylor  <iant@google.com>
9511
9512         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9513         information fields.
9514
9515 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9516
9517         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9518         Replace two_file_shared_1.so with two_file_shared_2.so.
9519         * testsuite/Makefile.in: Regenerated.
9520
9521 2009-12-08  Doug Kwan  <dougkwan@google.com>
9522
9523         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9524         (HFILES): Add attributes.h and int_encoding.h.
9525         * Makefile.in: Regenerate.
9526         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9527         function definitions to int_encoding.cc
9528         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9529         prototypes to int_encoding.h
9530         * reduced_debug_output.cc (int_encoding.h): New include.
9531         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9532         function definitions to int_encoding.cc
9533         (insert_into_vector, read_from_pointer): Move template definitions to
9534         int_encoding.h
9535         * attributes.cc: New file.
9536         * attributes.h: New file.
9537         * int_encoding.cc: New file.
9538         * int_encoding.h: New file.
9539
9540 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9541
9542         PR gold/11055
9543         * incremental-dump.cc (dump_incremental_inputs): New.
9544         (main): Use dump_incremental_inputs.
9545
9546 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9547
9548         PR gold/10893
9549         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9550         checking elfcpp::STT_FUNC.
9551         (Target_i386::Relocate::relocate): Likewise.
9552         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9553
9554         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9555         symbols from shared libraries into normal FUNC symbols.
9556
9557         * symtab.h (Symbol): Add is_func and use it.
9558
9559 2009-12-05  Doug Kwan  <dougkwan@google.com>
9560
9561         * arm.cc (Target_arm::arm_info): Initialize new fields
9562         attributes_section and attributes_vendor.
9563         * i386.cc (Target_i386::i386_info): Same.
9564         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9565         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9566         fields attributes_section and attributes_vendor.
9567         * sparc.cc (Target_sparc::sparc_info): Same.
9568         * target.h (Target::attributes_section, Target::attributes_vendor,
9569         Target::is_attributes_section, Target::attribute_arg_type,
9570         Target::attributes_order): New method definitions.
9571         (Target::Target_info::attributes_section,
9572         Target::Target_info::attributes_vendor): New fields.
9573         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9574         virtual method definitions.
9575         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9576         attributes_section and attributes_vendor.
9577         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9578
9579 2009-12-05  Doug Kwan  <dougkwan@google.com>
9580
9581         * arm.cc: Update comments about interworking and stub generation.
9582         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9583         considered as non-PIC.
9584         (Arm_relocate_functions::base_abs): Fix formatting.
9585         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9586         of function to use GOT entry address instead of offset.
9587         (Target_arm::Scan::global): Issue an error if a symbol would need a
9588         PLT does not get one because it is untyped.  Remove code to create
9589         dynamic symbols for relative branches.
9590         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9591         takes unsigned integer instead of boolean.
9592
9593 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9594
9595         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9596         (two_file_test_LDADD): Likewise.
9597         (common_test_1_LDADD): Likewise.
9598         (exception_test_LDADD) Likewise.
9599         (weak_test_LDADD): Likewise.
9600         (many_sections_test_LDADD): Likewise.
9601         (initpri1_LDADD): Likewise.
9602         (script_test_1_LDADD): Likewise.
9603         (script_test_2_LDADD): Likewise.
9604         (justsyms_LDADD): Likewise.
9605         (binary_test_LDADD): Likewise.
9606         (large_LDADD): Likewise.
9607         * testsuite/Makefile.in: Regenerated.
9608
9609 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9610
9611         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9612         (Symbol_table::override_with_special): Likewise.
9613         (Symbol_table::add_from_object): Likewise.
9614
9615 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9616
9617         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9618         Don't set the data_offset twice.
9619
9620 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9621
9622         * testsuite/Makefile.in: Regenerate.
9623
9624 2009-12-03  Doug Kwan  <dougkwan@google.com>
9625
9626         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9627         (Target_arm::do_finalize_sections): Add parameter for symbol table
9628         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9629         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9630         parameter for symbol table pointer.
9631         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9632         an additional parameter for a pointer to symbol table.
9633         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9634         parameter for a symbol table pointer.
9635         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9636         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9637         Ditto.
9638         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9639         parameter for a symbol table pointer.
9640
9641 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9642
9643         * incremental.cc (Incremental_inputs_header)
9644         (Incremental_inputs_header_write, Incremental_inputs_entry)
9645         (Incremental_inputs_entry_write): Move ...
9646         * incremental.h (Incremental_inputs_header)
9647         (Incremental_inputs_header_write, Incremental_inputs_entry)
9648         (Incremental_inputs_entry_write): here.
9649
9650 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9651
9652         * incremental.cc (make_sized_incremental_binary): Set the target.
9653         Error if it is incompatible.
9654         * output.h (Output_file): Add filename method.
9655
9656 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9657
9658         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9659         from the get_* methods.
9660
9661 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9662
9663         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9664         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9665         Write 0 for the data_offset of scripts.
9666
9667 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9668
9669         * testsuite/Makefile.am: Add the incremental_test.sh test.
9670         * testsuite/incremental_test.sh: New.
9671         * testsuite/incremental_test_1.c: New.
9672         * testsuite/incremental_test_2.c: New.
9673
9674 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9675
9676         * incremental-dump.cc (main): Fix typos.
9677
9678 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9679
9680         PR gold/11025
9681         * incremental-dump.cc (main): Use llu to print 64 bit values.
9682
9683 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9684             H.J. Lu  <hongjiu.lu@intel.com>
9685
9686         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9687         $(LIBDL).
9688         (incremental_dump_LDADD): Likewise.
9689         * Makefile.in: Regenerated.
9690
9691 2009-11-25  Doug Kwan  <dougkwan@google.com>
9692
9693         Revert:
9694
9695         2009-11-25  Doug Kwan  <dougkwan@google.com>
9696
9697                 * arm.cc (Target_arm::Target_arm): Move method definition
9698                 outside of class definition.  Add code to handle
9699                 --target1-rel, --target1-abs and --target2= options.
9700                 (Target_arm::get_reloc_reloc_type): Change method to be
9701                 non-static and const.
9702                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9703                 New data member declaration.
9704                 (Target_arm::Scan::local, Target_arm::Scan::global,
9705                 Target_arm::Relocate::relocate,
9706                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9707                 Adjust call to Target_arm::get_real_reloc_type.
9708                 (Target_arm::get_real_reloc_type): Use command line options
9709                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9710                 * options.h (--target1-rel, --target1-abs, --target2): New
9711                 ARM-only options.
9712
9713 2009-11-25  Doug Kwan  <dougkwan@google.com>
9714
9715         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9716         class definition.  Add code to handle --target1-rel, --target1-abs
9717         and --target2= options.
9718         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9719         and const.
9720         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9721         member declaration.
9722         (Target_arm::Scan::local, Target_arm::Scan::global,
9723         Target_arm::Relocate::relocate,
9724         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9725         call to Target_arm::get_real_reloc_type.
9726         (Target_arm::get_real_reloc_type): Use command line options to
9727         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9728         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9729         options.
9730
9731 2009-11-25  Doug Kwan  <dougkwan@google.com>
9732
9733         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9734         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9735         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9736         formatting.
9737         (Arm_relocate_functions::thm_call): Replace body with a call to
9738         Arm_relocate_functions::thumb_branch_common.
9739         (Arm_relocate_functions::thm_jump24,
9740         Arm_relocate_functions::thm_xpc22): New method definitions.
9741         (Arm_relocate_functions::thumb_branch_common): New method definition.
9742         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9743         operator.
9744         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9745         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9746
9747 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9748
9749         * Makefile.am: Build incremental-dump
9750         * Makefile.in: Regenerate.
9751         * incremental-dump.cc: New.
9752         * incremental.cc (Incremental_inputs_header_data,
9753         Incremental_inputs_entry_data): Move to incremental.h
9754         * incremental.h: (Incremental_inputs_header_data,
9755         Incremental_inputs_entry_data): Move from incremental.cc
9756
9757 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9758
9759         * incremental.cc (Incremental_inputs_header,
9760         Incremental_inputs_header_write, Incremental_inputs_entry,
9761         Incremental_inputs_entry_write): Add a typedef with the data type.
9762
9763 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9764
9765         * incremental.cc (Incremental_inputs_header,
9766         Incremental_inputs_header_write, Incremental_inputs_entry,
9767         Incremental_inputs_entry_write): Update comment about which
9768         type has the filed descriptions.
9769
9770 2009-11-15  Doug Kwan  <dougkwan@google.com>
9771
9772         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9773         (Arm_relocate_functions::arm_branch_common): Change method defintion
9774         in class definition to a method declaration and update list of formal
9775         parameters.
9776         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9777         Arm_relocation_functions::jump24): Adjust call to
9778         Arm_relocate_functions::arm_branch_common.  Update list of formal
9779         parameters.
9780         (Arm_relocate_functions::xpc25): New method definition.
9781         (Arm_relocate_functions::arm_branch_common): Move method defintion
9782         out from class definition.  Use stubs for mode-switching and extending
9783         branch ranges.
9784         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9785         specially.  Change code to enable use of stubs in ARM branches.
9786
9787 2009-11-10  Doug Kwan  <dougkwan@google.com>
9788
9789         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9790         in method declaration.
9791         (Target_arm::relocate_stub): New method declaration.
9792         (Target_arm::default_target): Change to return a pointer instead of
9793         a const reference.
9794         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9795         Target_arm::default_target.
9796         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9797         method definition.
9798         (Target_arm::relocate_section): Adjust view.
9799         (Target_arm::relocate_stub): New method definition.
9800
9801 2009-11-10  Doug Kwan  <dougkwan@google.com>
9802
9803         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9804         a format warning.
9805         * incremental.cc (open_incremental_binary): Initialized local
9806         variables to avoid warnings.
9807         * object.cc (make_elf_object): Ditto.
9808         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9809         a format warning.
9810
9811 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9812
9813         PR gold/10930
9814         * testsuite/plugin_test.c: Include "config.h".
9815
9816 2009-11-09  Doug Kwan  <dougkwan@google.com>
9817
9818         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9819         (arm_symbol_value): Remove.
9820         (Arm_relocate_functions::arm_branch_common,
9821         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9822         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9823         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9824         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9825         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9826         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9827         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9828         Arm_relocate_functions::thm_mobw_abs_nc,
9829         Arm_relocate_functions::thm_mov_abs,
9830         Arm_relocate_functions::movw_prel_nc,
9831         Arm_relocate_functions::thm_movt_abs,
9832         Arm_relocate_functions::movt_prel,
9833         Arm_relocate_functions::thm_movw_prel_nc,
9834         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9835         (Target_arm::Relocate::relocate): Only decompose address into two
9836         parts if relocation type uses the thumb-bit and pass the actual
9837         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9838         calls to methods in Arm_relocate_functions for this change.
9839
9840 2009-11-08  Ian Lance Taylor  <iant@google.com>
9841
9842         PR 10925
9843         * reloc.cc: Instantiate
9844         Sized_relobj::initialize_input_to_output_maps and
9845         Sized_relobj:free_input_to_output_maps.
9846
9847 2009-11-06  Ian Lance Taylor  <iant@google.com>
9848
9849         PR 10876
9850         * defstd.cc (in_segment): Set only_if_ref true for "end".
9851
9852 2009-11-06  Doug Kwan  <dougkwan@google.com>
9853
9854         * arm.cc (class Reloc_stub): Correct a comment.
9855         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9856         (Target_arm::scan_section_for_stubs): New method declaration.
9857         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9858         Change methods from private to protected.
9859         (Target_arm::do_may_relax): New method definition.
9860         (Target_arm::do_relax, Target_arm::group_sections,
9861         Target_arm::scan_reloc_for_stub,
9862         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9863         (Target_arm::arm_input_section_map_): New data member declaration.
9864         (Target_arm::scan_reloc_for_stub,
9865         Target_arm::scan_reloc_section_for_stubs,
9866         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9867         Target_arm::do_relax): New method definitions.
9868
9869 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9870
9871         * configure.ac: Check for (struct stat)::st_mtim
9872         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9873         * config.in: Regenerate.
9874         * configure: Regenerate.
9875
9876 2009-11-05  Ian Lance Taylor  <iant@google.com>
9877
9878         PR 10910
9879         * output.cc (Output_segment::add_output_section): Add missing
9880         return statement.
9881
9882 2009-11-04  Ian Lance Taylor  <iant@google.com>
9883
9884         PR 10880
9885         * object.h (class Object): Add is_needed and set_is_needed
9886         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9887         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9888         defined in a dynamic object and referenced by a regular object,
9889         set is_needed for the dynamic object.
9890         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9891         if the file is marked with as_needed and it is not needed.
9892
9893 2009-11-04  Ian Lance Taylor  <iant@google.com>
9894
9895         PR 10887
9896         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9897         tags if data is discarded by linker script.
9898         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9899         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9900         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9901         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9902
9903 2009-11-04  Ian Lance Taylor  <iant@google.com>
9904
9905         * layout.cc (Layout::get_output_section): Add is_interp and
9906         is_dynamic_linker_section parameters.  Change all callers.
9907         (Layout::choose_output_section): Likewise.
9908         (Layout::make_output_section): Likewise.
9909         (Layout::add_output_section_data): Add is_dynamic_linker_section
9910         parameter.  Change all callers.
9911         * layout.h (class Layout): Update declarations.
9912         * output.h (class Output_section): Add is_interp, set_is_interp,
9913         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9914         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9915         generate_code_fills_at_write_ to a bitfield.
9916         * output.cc (Output_section::Output_sections): Initialize new
9917         fields.
9918         (Output_segment::add_output_section): Add do_sort parameter.
9919         Change all callers.
9920
9921 2009-11-03  Ian Lance Taylor  <iant@google.com>
9922
9923         PR 10860
9924         * options.h (class General_options): Add --warn-common.
9925         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9926         merging two common symbols.
9927         (Symbol_table::should_override): Handle --warn-common when merging
9928         a common symbol with a defined symbol.  Use report_resolve_problem
9929         for multiple definitions.
9930         (Symbol_table::report_resolve_problem): New function.
9931         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9932
9933 2009-11-03  Doug Kwan  <dougkwan@google.com>
9934
9935         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9936         stub_factory_.
9937         (Target_arm::stub_factory): New method definition.
9938         (Target_arm::new_arm_input_section,
9939         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9940         Target_arm::reloc_uses_thumb_bit): New method declarations.
9941         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9942         New type definitions.
9943         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9944         member declarations.
9945         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9946         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9947         New method definitions.
9948
9949 2009-11-03  Ian Lance Taylor  <iant@google.com>
9950
9951         * options.h (class General_options): Add --warn_constructors.
9952
9953 2009-11-03  Ian Lance Taylor  <iant@google.com>
9954
9955         PR 10893
9956         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9957         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9958
9959 2009-11-03  Ian Lance Taylor  <iant@google.com>
9960
9961         PR 10895
9962         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9963         --msgid-bugs-address.
9964         (install-pdf): New target.
9965         (install-data_yes): Look up one directory to find mkinstalldirs.
9966
9967 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9968
9969         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9970         tree.
9971
9972 2009-10-30  Doug Kwan  <dougkwan@google.com>
9973
9974         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9975
9976 2009-10-30  Doug Kwan  <dougkwan@google.com>
9977
9978         * arm.cc (Stub_addend_reader): New struct template definition
9979         and partial specializations.
9980         (Stub_addend_reader::operator()): New method definition for a
9981         partially specialized template.
9982
9983 2009-10-30  Doug Kwan  <dougkwan@google.com>
9984
9985         * arm.cc (Arm_relobj::processor_specific_flags): New method
9986         definition.
9987         (Arm_relobj::do_read_symbols): New method declaration.
9988         (Arm_relobj::processor_specific_flags_): New data member declaration.
9989         (Arm_dynobj): New class definition.
9990         (Target_arm::do_finalize_sections): Add input_objects parameter.
9991         (Target_arm::do_adjust_elf_header): New method declaration.
9992         (Target_arm::are_eabi_versions_compatible,
9993         (Target_arm::merge_processor_specific_flags): New method declaration.
9994         (Target_arm::do_make_elf_object): New overloaded method definitions
9995         and declaration.
9996         (Arm_relobj::do_read_symbols): New method definition.
9997         (Arm_dynobj::do_read_symbols): Ditto.
9998         (Target_arm::do_finalize_sections): Add input_objects parameters.
9999         Merge processor-specific flags from all input objects.
10000         (Target_arm::are_eabi_versions_compatible,
10001         Target_arm::merge_processor_specific_flags,
10002         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10003         New method definitions.
10004         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10005         Input_objects pointer type parameter.
10006         * layout.cc (Layout::finalize): Pass input objects to target's.
10007         finalize_sections function.
10008         * output.cc (Output_file_header::do_sized_write): Set ELF file
10009         header's processor-specific flags.
10010         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10011         Input_objects pointer type parameter.
10012         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10013         * target.h (Input_objects): New forward class declaration.
10014         (Target::processor_specific_flags,
10015         Target::are_processor_specific_flags_sect): New method definitions.
10016         (Target::finalize_sections): Add input_objects parameter.
10017         (Target::Target): Initialize processor_specific_flags_ and
10018         are_processor_specific_flags_set_.
10019         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10020         parameter.
10021         (Target::set_processor_specific_flags): New method definition.
10022         (Target::processor_specific_flags_,
10023         Target::are_processor_specific_flags_set_): New data member
10024         declarations.
10025         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10026         Input_objects pointer type parameter.
10027
10028 2009-10-30  Doug Kwan  <dougkwan@google.com>
10029
10030         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10031
10032 2009-10-28  Ian Lance Taylor  <iant@google.com>
10033
10034         * object.h (class Relobj): Drop options parameter from
10035         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10036         do_scan_relocs, do_relocate.  Change all callers.
10037         (class Sized_relobj): Drop options parameters from
10038         do_gc_process_relocs, do_scan_relocs, do_relocate,
10039         do_relocate_sections, relocate_sections, emit_relocs_scan,
10040         emit_relocs_scan_reltype.  Change all callers.
10041         (struct Relocate_info): Remove options field and all references to
10042         it.
10043         * reloc.h (class Read_relocs): Remove options constructor
10044         parameter and options_ field.  Change all callers.
10045         (class Gc_process_relocs, class Scan_relocs): Likewise.
10046         (class Relocate_task): Likewise.
10047         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10048         all callers.
10049         (scan_relocatable_relocs): Likewise.
10050         * target.h (class Sized_target): Remove options parameter from
10051         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10052         all callers.
10053         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10054         callers.
10055         * arm.cc: Update functions to remove options parameters.
10056         * i386.cc: Likewise.
10057         * powerpc.cc: Likewise.
10058         * sparc.cc: Likewise.
10059         * x86_64.cc: Likewise.
10060         * testsuite/testfile.cc: Likewise.
10061
10062 2009-10-28  Doug Kwan  <dougkwan@google.com>
10063
10064         * arm.cc (Arm_relobj): New class definition.
10065         (Arm_relobj::scan_sections_for_stubs,
10066         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10067         New method definitions.
10068
10069 2009-10-28  Cary Coutant  <ccoutant@google.com>
10070
10071         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10072         (Plugin::cleanup_done_): New member.
10073         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10074         (Plugin_manager::cleanup_done_): Remove.
10075         (Plugin_manager::add_input_file): Edit error message.
10076         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10077         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10078
10079 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10080
10081         * fileread.cc: (File_read::View::~View): Use the new
10082         data_ownership_ filed.
10083         (File_read::~File_read): Dispose the new whole_file_view_.
10084         (File_read::open): Mmap the whole file if needed.
10085         (File_read::open): Use whole_file_view_ instead of contents_.
10086         (File_read::find_view): Use whole_file_view_ if applicable.
10087         (File_read::do_read): Use whole_file_view_ instead of contents_.
10088         (File_read::make_view): Use whole_file_view_ instead of contents_,
10089         update File_read::View::View call.
10090         (File_read::find_or_make_view): Update File_read::View::View
10091         call.
10092         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10093         remove contents_
10094         (File_read::View::Data_ownership): New enum.
10095         (File_read::View::View): Replace bool mapped_ with Data_ownership
10096         argument.
10097         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10098         (File_read::View::data_ownership_): New field.
10099         (File_read::contents_): Remove (replaced by whole_file_view_).
10100         (File_read::whole_file_view_): New field.
10101         * options.h (class General_options): Add --keep-files-mapped.
10102
10103 2009-10-27  Cary Coutant  <ccoutant@google.com>
10104
10105         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10106         * testsuite/Makefile.am (plugin_test_5): New test case.
10107         * testsuite/Makefile.in: Regenerate.
10108
10109 2009-10-25  Doug Kwan  <dougkwan@google.com>
10110
10111         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10112         from private to protected to allow access by child class.
10113         (Sized_relobj::do_relocate_sections): New method declaration.
10114         (Sized_relobj::relocate_sections): Virtualize.
10115         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10116         Sized_relobj::relocate_sections.  Instantiate template explicitly
10117         for different target sizes and endianity.
10118
10119 2009-10-24  Doug Kwan  <dougkwan@google.com>
10120
10121         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10122         (Arm_input_section::as_arm_input_section): New method.
10123         (Arm_output_section): New class definition.
10124         (Arm_output_section::create_stub_group,
10125         Arm_output_section::group_sections): New method definitions.
10126
10127 2009-10-22  Doug Kwan  <dougkwan@google.com>
10128
10129         * arm.cc (Arm_input_section): New class definition.
10130         (Arm_input_section::init, Arm_input_section:do_write,
10131         Arm_input_section::set_final_data_size,
10132         Arm_input_section::do_reset_address_and_file_offset): New method
10133         definitions.
10134
10135 2009-10-21  Doug Kwan  <dougkwan@google.com>
10136
10137         * arm.cc (Stub_table, Arm_input_section): New forward class
10138         declarations.
10139         (Stub_table): New class defintion.
10140         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10141         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10142         New method definition.
10143
10144 2009-10-21  Doug Kwan  <dougkwan@google.com>
10145
10146         * arm.cc: Update copyright comments.
10147         (Target_arm): New forward class template declaration.
10148         (Arm_address): New type.
10149         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10150         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10151         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10152         constants.
10153         (Insn_template): Same.
10154         (DEF_STUBS): New macro.
10155         (Stub_type): New enum type.
10156         (Stub_template): New class definition.
10157         (Stub): Same.
10158         (Reloc_stub): Same.
10159         (Stub_factory): Same.
10160         (Target_arm::Target_arm): Initialize may_use_blx_ and
10161         should_force_pic_veneer_.
10162         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10163         Target_arm::should_force_pic_veneer,
10164         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10165         Target_arm::using_thumb_only, Target_arm:;default_target): New
10166         method defintions.
10167         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10168         New data member declarations.
10169         (Insn_template::size, Insn_template::alignment): New method defintions.
10170         (Stub_template::Stub_template): New method definition.
10171         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10172         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10173         (Stub_factory::Stub_factory): New method definition.
10174         * gold.h (string_hash): New template.
10175         * output.h (Input_section_specifier::hash_value): Use
10176         gold::string_hash.
10177         (Input_section_specifier::string_hash): Remove.
10178         * stringpool.cc (Stringpool_template::string_hash): Use
10179         gold::string_hash.
10180
10181 2009-10-20  Doug Kwan  <dougkwan@google.com>
10182
10183         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10184         symbols of relaxed input sections.
10185         * output.h (Output_section::find_relaxed_input_section): Make
10186         method public.
10187
10188 2009-10-16  Doug Kwan  <dougkwan@google.com>
10189
10190         * dynobj.cc (Versions::Versions): Initialize version_script_.
10191         Only insert base version symbol definition for a shared object
10192         if version script defines any version versions.
10193         (Versions::define_base_version): New method definition.
10194         (Versions::add_def): Check that base version is not needed.
10195         (Versions::add_need): Define base version lazily.
10196         * dynobj.h (Versions::define_base_version): New method declaration.
10197         (Versions::needs_base_version_): New data member declaration.
10198         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10199         (check_DATA): Add no_version_test.stdout.
10200         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10201         New make rules.
10202         * testsuite/Makefile.in: Regenerate.
10203         * testsuite/no_version_test.c: New file.
10204         * testsuite/no_version_test.sh: Ditto.
10205
10206 2009-10-16  Doug Kwan  <dougkwan@google.com>
10207
10208         * expression.cc (class Segment_start_expression): New class definition.
10209         (Segment_start_expression::value): New method definition.
10210         (script_exp_function_segment_start): Return a new
10211         Segment_start_expression.
10212         * gold/script-c.h (script_saw_segment_start_expression): New function
10213         prototype.
10214         * script-sections.cc (Script_sections::Script_sections): Initialize
10215         SAW_SEGMENT_START_EXPRESSION_ to false.
10216         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10217         and -Tbbs options to specify section addresses if given in
10218         command line and no SEGMENT_START expression is seen in a script.
10219         * script-sections.h (Script_sections::saw_segment_start_expression,
10220         Script_sections::set_saw_segment_start_expression): New method
10221         definition.
10222         (Script_sections::saw_segment_start_expression_): New data member
10223         declaration.
10224         * script.cc (script_saw_segment_start_expression): New function.
10225         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10226         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10227         script_test_7.sh and script_test_8.sh.
10228         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10229         script_test_8.stdout.
10230         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10231         (script_test_6, script_test_6.stdout, script_test_7,
10232         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10233         * Makefile.in: Regenerate.
10234         * testsuite/script_test_6.sh: New file.
10235         * testsuite/script_test_6.t: Same.
10236         * testsuite/script_test_7.sh: Same.
10237         * testsuite/script_test_7.t: Same.
10238         * testsuite/script_test_8.sh: Same.
10239
10240 2009-10-16  Doug Kwan  <dougkwan@google.com>
10241
10242         * output.cc (Output_segment::set_section_list_address): Cast
10243         expressions to unsigned long long type to avoid format warnings.
10244
10245 2009-10-15  Ian Lance Taylor  <iant@google.com>
10246
10247         * script.cc (Script_options::add_symbol_assignment): Always add a
10248         dot assignment to script_sections_.
10249         * script-sections.cc (Script_sections::add_dot_assignment):
10250         Initialize if necessary.
10251
10252         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10253         program headers with no load segment if there is a linker script.
10254
10255         * layout.cc (Layout::set_segment_offsets): Align the file offset
10256         to the segment aligment for -N or -n with no load segment.
10257         * output.cc (Output_segment::add_output_section): Don't crash if
10258         the first section is a TLS section.
10259         (Output_segment::set_section_list_addresses): Print an error
10260         message if the address moves backward in a linker script.
10261         * script-sections.cc
10262         (Output_section_element_input::set_section_addresses): Don't
10263         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10264         (Orphan_output_section::set_section_addresses): Likewise.
10265
10266 2009-10-15  Doug Kwan  <dougkwan@google.com>
10267
10268         * layout.cc (Layout::finish_dynamic_section): Generate tags
10269         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10270         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10271         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10272
10273 2009-10-14  Ian Lance Taylor  <iant@google.com>
10274
10275         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10276         fields.
10277         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10278         data_shdr fields of relinfo.
10279         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10280         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10281         R_386_TLS_LDO_32, adjust based on section flags.
10282         (Target_i386::Relocate::fix_up_ldo): Remove.
10283
10284 2009-10-13  Ian Lance Taylor  <iant@google.com>
10285
10286         Add support for -pie.
10287         * options.h (class General_options): Add -pie and
10288         --pic-executable.
10289         (General_options::output_is_position_independent): Test -pie.
10290         (General_options::output_is_executable): Return true if not shared
10291         and not relocatable.
10292         (General_options::output_is_pie): Remove.
10293         * options.cc (General_options::finalize): Reject incompatible uses
10294         of -pie.
10295         * gold.cc (queue_middle_tasks): A -pie link is not static.
10296         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10297         * symtab.cc (Symbol::final_value_is_known): Return false if
10298         output_is_position_independent.
10299         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10300         output_is_position_independent.
10301         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10302         output_is_position_independent.
10303         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10304         output_is_position_independent.
10305         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10306         two_file_pie_test.
10307         (basic_pie_test.o, basic_pie_test): New targets.
10308         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10309         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10310         (two_file_pie_test): New target.
10311         * testsuite/Makefile.in: Rebuild.
10312         * README: Remove note saying that -pie is not supported.
10313
10314 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10315
10316         * options.h (class General_options): Add -init and -fini.
10317         * layout.cc (Layout::finish_dynamic_section): Emit
10318         given init and fini functions.
10319
10320 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10321
10322         * gc.h (gc_process_relocs): Check if icf is enabled using new
10323         function.
10324         * gold.cc (queue_initial_tasks): Likewise.
10325         (queue_middle_tasks): Likewise.
10326         * object.cc (do_layout): Likewise.
10327         * symtab.cc (is_section_folded): Likewise.
10328         * main.cc (main): Likewise.
10329         * reloc.cc (Read_relocs::run): Likewise.
10330         (Sized_relobj::do_scan_relocs): Likewise.
10331         * icf.cc (is_function_ctor_or_dtor): New function.
10332         (Icf::find_identical_sections): Check if function is ctor or dtor when
10333         safe icf is chosen.
10334         * options.h (General_options::icf): Change option to be an enum.
10335         (Icf_status): New enum.
10336         (icf_enabled): New method.
10337         (icf_safe_folding): New method.
10338         (set_icf_status): New method.
10339         (icf_status_): New variable.
10340         * (options.cc) (General_options::finalize): Set icf_status_.
10341         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10342         icf_test and icf_keep_unique_test to use the --icf enum flag.
10343         * testsuite/icf_safe_test.sh: New file.
10344         * testsuite/icf_safe_test.cc: New file.
10345
10346 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10347
10348         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10349         includes to gc.h and icf.h.
10350         * arm.cc: Include gc.h.
10351         * gold.cc: Likewise.
10352         * i386.cc: Likewise.
10353         * powerpc.cc: Likewise.
10354         * sparc.cc: Likewise.
10355         * x86_64.cc: Likewise.
10356         * gc.h: Include icf.h.
10357
10358 2009-10-11  Ian Lance Taylor  <iant@google.com>
10359
10360         * plugin.cc: Include "gold.h" before other header files.
10361
10362 2009-10-10  Chris Demetriou  <cgd@google.com>
10363
10364         * options.h (Input_file_argument::Input_file_type): New enum.
10365         (Input_file_argument::is_lib_): Replace with...
10366         (Input_file_argument::type_): New member.
10367         (Input_file_argument::Input_file_argument): Take Input_file_type
10368         'type' rather than boolean 'is_lib' as second argument.
10369         (Input_file_argument::is_lib): Use type_.
10370         (Input_file_argument::is_searched_file): New function.
10371         (Input_file_argument::may_need_search): Handle is_searched_file.
10372         * options.cc (General_options::parse_library): Support -l:filename.
10373         (General_options::parse_just_symbols): Update for Input_file_argument
10374         changes.
10375         (Command_line::process): Likewise.
10376         * archive.cc (Archive::get_file_and_offset): Likewise.
10377         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10378         * script.cc (read_script_file, script_add_file): Likewise.
10379         * fileread.cc (Input_file::Input_file): Likewise.
10380         (Input_file::will_search_for): Handle is_searched_file.
10381         (Input_file::open): Likewise.
10382         * readsyms.cc (Read_symbols::get_name): Likewise.
10383         * testsuite/Makefile.am (searched_file_test): New test.
10384         * testsuite/Makefile.in: Regenerate.
10385         * testsuite/searched_file_test.cc: New file.
10386         * testsuite/searched_file_test_lib.cc: New file.
10387
10388 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10389             Ian Lance Taylor  <iant@google.com>
10390
10391         * descriptor.cc: Include <cstdio> and "binary-io.h".
10392         (Descriptors::open): Open the files in binary mode always.
10393         * script.cc (Lex::get_token): Treat \r as whitespace.
10394
10395 2009-10-09  Ian Lance Taylor  <iant@google.com>
10396
10397         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10398
10399 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10400             Ian Lance Taylor  <iant@google.com>
10401
10402         * configure.ac: Check for readv function also.
10403         * fileread.cc (readv): Define if not HAVE_READV.
10404         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10405         does not exist.
10406         * config.in: Regenerate.
10407         * configure: Regenerate.
10408
10409 2009-10-09  Doug Kwan  <dougkwan@google.com>
10410
10411         * layout.cc (Layout::make_output_section): Call target hook to make
10412         ordinary output section.
10413         (Layout::finalize): Adjust parameter list of call the
10414         Target::may_relax().
10415         * layout.h (class Layout::section_list): New method.
10416         * merge.h (Output_merge_base::entsize): Change visibility to public.
10417         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10418         New methods.
10419         (Output_merge_string::do_is_string): New method.
10420         * object.cc (Sized_relobj::do_setup): renamed from
10421         Sized_relobj::set_up.
10422         * object.h (Sized_relobj::adjust_shndx,
10423         Sized_relobj::initializ_input_to_output_maps,
10424         Sized_relobj::free_input_to_output_maps): Change visibilities to
10425         protected.
10426         (Sized_relobj::setup): Virtualize.
10427         (Sized_relobj::do_setup): New method declaration.
10428         (Sized_relobj::invalidate_section_offset,
10429         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10430         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10431         * options.cc (parse_int): New function.
10432         * options.h (parse_int): New declaration.
10433         (DEFINE_int): New macro.
10434         (stub_group_size): New option.
10435         * output.cc (Output_section::Output_section): Initialize memebers
10436         merge_section_map_, merge_section_by_properties_map_,
10437         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10438         (Output_section::add_input_section): Handled deferred code-fill
10439         generation and remove an old comment.
10440         (Output_section::add_relaxed_input_section): New method definition.
10441         (Output_section::add_merge_input_section): Use merge section by
10442         properties map to speed to search.  Update merge section maps
10443         as appropriate.
10444         (Output_section::build_relaxation_map): New method definition.
10445         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10446         Same.
10447         (Output_section::relax_input_section): Renamed to
10448         Output_section::convert_input_sections_to_relaxed_sections and change
10449         interface to take a vector of pointers to relaxed sections.
10450         (Output_section::find_merge_section,
10451         Output_section::find_relaxed_input_section): New method definitions.
10452         (Output_section::is_input_address_mapped,
10453         Output_section::output_offset, Output_section::output_address):
10454         Use output section data maps to speed up searching.
10455         (Output_section::find_starting_output_address): Add comments.
10456         (Output_section::do_write,
10457         Output_section::write_to_postprocessing_buffer): Do code-fill
10458         generation as appropriate.
10459         (Output_section::get_input_sections): Invalidate relaxed input section
10460         map.
10461         (Output_section::restore_states): Adjust type of checkpoint .
10462         Invalidate relaxed input section map.
10463         * output.h (Output_merge_base): New class declaration.
10464         (Input_section_specifier): New class defintion.
10465         (class Output_relaxed_input_section) Change base class to
10466         Output_section_data_build.
10467         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10468         base class initializer.
10469         (Output_section::add_relaxed_input_section): New method declaration.
10470         (Output_section::Input_section): Change visibility to protected.
10471         (Output_section::Input_section::relobj,
10472         Output_section::Input_section::shndx): Handle relaxed input sections.
10473         Output_section::input_sections) Change visibility to protected.  Also
10474         define overload to return a non-const pointer.
10475         (Output_section::Merge_section_properties): New class defintion.
10476         (Output_section::Merge_section_by_properties_map,
10477         Output_section::Output_section_data_by_input_section_map,
10478         Output_section::Relaxation_map): New types.
10479         (Output_section::relax_input_section): Rename method to
10480         Output_section::convert_input_sections_to_relaxed_sections and change
10481         interface to take a vector of relaxed section pointers.
10482         (Output_section::find_merge_section,
10483         Output_section::find_relaxed_input_section,
10484         Output_section::build_relaxation_map,
10485         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10486         New method declarations.
10487         (Output_section::merge_section_map_
10488         Output_section::merge_section_by_properties_map_,
10489         Output_section::relaxed_input_section_map_,
10490         Output_section::is_relaxed_input_section_map_valid_,
10491         Output_section::generate_code_fills_at_write_): New data members.
10492         * script-sections.cc
10493         (Output_section_element_input::set_section_addresses): Call
10494         current_data_size and addralign methods of relaxed input sections.
10495         (Orphan_output_section::set_section_addresses): Call current_data_size
10496         and addralign methods of relaxed input sections.
10497         * symtab.cc (Symbol_table::compute_final_value): Extract template
10498         from the body of Symbol_table::sized_finalize_symbol.
10499         (Symbol_table::sized_finalized_symbol): Call
10500         Symbol_table::compute_final_value.
10501         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10502         (Symbol_table::compute_final_value): New templated method declaration.
10503         * target.cc (Target::do_make_output_section): New method defintion.
10504         * target.h (Target::make_output_section): New method declaration.
10505         (Target::relax): Add more parameters for input objects, symbol table
10506         and layout.  Adjust call to do_relax.
10507         (Target::do_make_output_section): New method declaration.
10508         (Target::do_relax): Add parameters for input objects, symbol table
10509         and layout.
10510
10511 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10512
10513         * pread.c: Include stdio.h.
10514
10515 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10516
10517         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10518         defined.
10519
10520 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10521
10522         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10523         Change read_shndx type to unsigned int.
10524         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10525         int.
10526         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10527         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10528         Change read_shndx type to unsigned int.
10529         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10530         int.
10531         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10532         * layout.cc (Layout::create_symtab_sections): Cast the result of
10533         local_symcount * symsize to off_t in the gold_assert.
10534
10535 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10536
10537         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10538         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10539         R_ARM_BASE_ABS.
10540         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10541         (Arm_relocate_functions::thm_abs5): New function.
10542         (Arm_relocate_functions::abs12): New function.
10543         (Arm_relocate_functions::abs16): New function.
10544         (Arm_relocate_functions::base_abs): New function.
10545         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10546         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10547         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10548         R_ARM_BASE_ABS.
10549         (Scan::global): Likewise.
10550         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10551         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10552         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10553         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10554         R_ARM_BASE_ABS.
10555
10556 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10557
10558         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10559         (Arm_relocate_functions::movt_prel): New function.
10560         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10561         (Arm_relocate_functions::thm_movt_prel): New function.
10562         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10563         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10564         (Scan::global, Relocate::relocate): Likewise.
10565         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10566
10567 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10568
10569         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10570         Incremental_checker.
10571         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10572         unsigned int.
10573         (class Incremental_inputs_header): New class.
10574         (Incremental_inputs_header_writer): Edit comment.
10575         (Incremental_inputs_entry): New class.
10576         (Incremental_inputs_entry_writer): Edit comment.
10577         (Sized_incremental_binary::do_find_incremental_inputs_section):
10578         Add *strtab_shndx parameter, fill it.
10579         (Sized_incremental_binary::do_check_inputs): New method.
10580         (Incremental_checker::can_incrementally_link_output_file): Use
10581         Sized_incremental_binary::check_inputs.
10582         (Incremental_inputs::report_command_line): Save command line in
10583         command_line_.
10584         * incremental.h:
10585         (Incremental_binary::find_incremental_inputs_section): New
10586         method.
10587         (Incremental_binary::do_find_incremental_inputs_section): Add
10588         strtab_shndx parameter.
10589         (Incremental_binary::do_check_inputs): New pure virtual method.
10590         (Sized_incremental_binary::do_check_inputs): Declare.
10591         (Incremental_checker::Incremental_checker): Add incremental_inputs
10592         parameter, use it to initialize incremental_inputs_.
10593         (Incremental_checker::incremental_inputs_): New field.
10594         (Incremental_checker::command_line): New method.
10595         (Incremental_checker::inputs): New method.
10596         (Incremental_checker::command_line_): New field.
10597
10598 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10599
10600         * incremental.cc: Include <cstdarg> and "target-select.h".
10601         (vexplain_no_incremental): New function.
10602         (explain_no_incremental): New function.
10603         (Incremental_binary::error): New method.
10604         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10605         method.
10606         (make_sized_incremental_binary): New function.
10607         (open_incremental_binary): New function.
10608         (can_incrementally_link_file): Add checks if output is ELF and has
10609         inputs section.
10610         * incremental.h: Include "elfcpp_file.h" and "output.h".
10611         (Incremental_binary): New class.
10612         (Sized_incremental_binary): New class.
10613         (open_incremental_binary): Declare.
10614         * object.cc (is_elf_object): Use
10615         elfcpp::Elf_recognizer::is_elf_file.
10616         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10617         * output.h (Output_file::filesize): New method.
10618
10619 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10620
10621         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10622         New function.
10623         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10624         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10625         function.
10626         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10627         function.
10628         (Arm_relocate_functions::movw_abs_nc): New function.
10629         (Arm_relocate_functions::movt_abs): New function.
10630         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10631         (Arm_relocate_functions::thm_movt_abs): New function.
10632         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10633         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10634         (Scan::global): Likewise.
10635         (Relocate::relocate): Likewise.
10636         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10637
10638 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10639
10640         * arm.cc (Arm_relocate_functions::got_prel) New function.
10641         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10642         (Relocate::relocate): Likewise.
10643         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10644
10645 2009-10-06  Ian Lance Taylor  <iant@google.com>
10646
10647         * options.h (class General_options): Define
10648         split_stack_adjust_size parameter.
10649         * object.h (class Object): Add uses_split_stack_ and
10650         has_no_split_stack_ fields.  Add uses_split_stack and
10651         has_no_split_stack accessor functions.  Declare
10652         handle_split_stack_section.
10653         (class Reloc_symbol_changes): Define.
10654         (class Sized_relobj): Define Function_offsets.  Declare
10655         split_stack_adjust, split_stack_adjust_reltype, and
10656         find_functions.
10657         * object.cc (Object::handle_split_stack_section): New function.
10658         (Sized_relobj::do_layout): Call handle_split_stack_section.
10659         * dynobj.cc (Sized_dynobj::do_layout): Call
10660         handle_split_stack_section.
10661         * reloc.cc (Sized_relobj::relocate_sections): Call
10662         split_stack_adjust for executable sections in split_stack
10663         objects.  Pass reloc_map to relocate_section.
10664         (Sized_relobj::split_stack_adjust): New function.
10665         (Sized_relobj::split_stack_adjust_reltype): New function.
10666         (Sized_relobj::find_functions): New function.
10667         * target-reloc.h: Include "object.h".
10668         (relocate_section): Add reloc_symbol_changes parameter.  Change
10669         all callers.
10670         * target.h (class Target): Add calls_non_split method.  Declare
10671         do_calls_non_split virtual method.  Declare match_view and
10672         set_view_to_nop.
10673         * target.cc: Include "elfcpp.h".
10674         (Target::do_calls_non_split): New function.
10675         (Target::match_view): New function.
10676         (Target::set_view_to_nop): New function.
10677         * gold.cc (queue_middle_tasks): Give an error if mixing
10678         split-stack and non-split-stack objects with -r.
10679         * i386.cc (Target_i386::relocate_section): Add
10680         reloc_symbol_changes parameter.
10681         (Target_i386::do_calls_non_split): New function.
10682         * x86_64.cc (Target_x86_64::relocate_section): Add
10683         reloc_symbol_changes parameter.
10684         (Target_x86_64::do_calls_non_split): New function.
10685         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10686         parameter.
10687         * powerpc.cc (Target_powerpc::relocate_section): Add
10688         reloc_symbol_changes parameter.
10689         * sparc.cc (Target_sparc::relocate_section): Add
10690         reloc_symbol_changes parameter.
10691         * configure.ac: Call AM_CONDITIONAL for the default target.
10692         * configure: Rebuild.
10693         * testsuite/Makefile.am (TEST_AS): New variable.
10694         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10695         (check_DATA): Add split_i386 and split_x86_64 files.
10696         (SPLIT_DEFSYMS): Define.
10697         (split_i386_[1234n].o): New targets.
10698         (split_i386_[124]): New targets.
10699         (split_i386_[1234r].stdout): New targets.
10700         (split_x86_64_[1234n].o): New targets.
10701         (split_x86_64_[124]): New targets.
10702         (split_x86_64_[1234r].stdout): New targets.
10703         (MOSTLYCLEANFILES): Add new executables.
10704         * testsuite/split_i386.sh: New file.
10705         * testsuite/split_x86_64.sh: New file.
10706         * testsuite/split_i386_1.s: New file.
10707         * testsuite/split_i386_2.s: New file.
10708         * testsuite/split_i386_3.s: New file.
10709         * testsuite/split_i386_4.s: New file.
10710         * testsuite/split_i386_n.s: New file.
10711         * testsuite/split_x86_64_1.s: New file.
10712         * testsuite/split_x86_64_2.s: New file.
10713         * testsuite/split_x86_64_3.s: New file.
10714         * testsuite/split_x86_64_4.s: New file.
10715         * testsuite/split_x86_64_n.s: New file.
10716         * testsuite/testfile.cc (Target_test): Update relocation_section
10717         function.
10718         * testsuite/Makefile.in: Rebuild.
10719
10720 2009-10-06  Ian Lance Taylor  <iant@google.com>
10721
10722         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10723         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10724         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10725         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10726         the address on ldo_addrs_.
10727         (Target_i386::Relocate::fix_up_ldo): New function.
10728
10729 2009-10-06   Rafael Espindola  <espindola@google.com>
10730
10731         * plugin.cc (add_input_library): New.
10732         (Plugin::load): Add add_input_library to tv.
10733         (Plugin_manager::add_input_file): Add the is_lib argument.
10734         (add_input_file): Update call to Plugin_manager::add_input_file.
10735         (add_input_library): New.
10736         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10737
10738 2009-09-30  Doug Kwan  <dougkwan@google.com>
10739
10740         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10741         symbol and call Symbol::may_need_copy_reloc to determine if
10742         a copy reloc is needed.
10743         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10744         nocopyreloc is given in command line.
10745         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10746         given in command line.
10747         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10748         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10749         of the removed Target_i386::may_need_copy_reloc.
10750         * options.h (copyreloc): New option with default value false.
10751         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10752         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10753         instead of the removed Target_powerpc::may_need_copy_reloc.
10754         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10755         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10756         instead of the removed Target_sparc::may_need_copy_reloc.
10757         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10758         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10759         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10760         instead of the removed Target_x86_64::may_need_copy_reloc.
10761
10762 2009-09-30  Ian Lance Taylor  <iant@google.com>
10763
10764         * object.h (class Object): Remove target_ field, and target,
10765         sized_target, and set_target methods.
10766         (Object::sized_target): Remove.
10767         (class Sized_relobj): Update declarations.  Remove sized_target.
10768         * object.cc (Sized_relobj::setup): Remove target parameter.
10769         Change all callers.
10770         (Input_objects::add_object): Don't do anything with the target.
10771         (make_elf_sized_object): Add punconfigured parameter.  Change all
10772         callers.  Set or test parameter target.
10773         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10774         Change all callers.
10775         * parameters.cc (Parameters::set_target): Change parameter type to
10776         be non-const.
10777         (Parameters::default_target): Remove.
10778         (set_parameters_target): Change parameter type to be non-const.
10779         (parameters_force_valid_target): New function.
10780         (parameters_clear_target): New function.
10781         * parameters.h (class Parameters): Update declarations.  Remove
10782         default_target method.  Add sized_target and clear_target
10783         methods.  Change target_ to be non-const.
10784         (set_parameters_target): Update declaration.
10785         (parameters_force_valid_target): Declare.
10786         (parameters_clear_target): Declare.
10787         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10788         as NULL if we aren't searching.
10789         (Add_symbols::run): Don't check for compatible target.
10790         * fileread.cc (Input_file::open_binary): Call
10791         parameters_force_valid_target.
10792         * gold.cc (queue_middle_tasks): Likewise.
10793         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10794         set_target on object.
10795         * dynobj.h (class Sized_dynobj): Update declarations.
10796         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10797         make_elf_object returns NULL.
10798         (Archive::include_member): Don't check whether object target is
10799         compatible.
10800         * output.cc (Output_section::add_input_section): Get target from
10801         parameters.
10802         (Output_section::relax_input_section): Likewise.
10803         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10804         parameters.
10805         (Sized_relobj::do_scan_relocs): Likewise.
10806         (Sized_relobj::relocate_sections): Likewise.
10807         * resolve.cc (Symbol_table::resolve): Likewise.
10808         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10809         parameter.  Change all callers.
10810         (Symbol_table::add_from_object): Get target from parameters.
10811         (Symbol_table::add_from_relobj): Don't check object target.
10812         (Symbol_table::add_from_dynobj): Likewise.
10813         (Symbol_table::define_special_symbol): Get target from
10814         parameters.
10815         * symtab.h (class Symbol_table): Update declaration.
10816         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10817         parameter.  Change all callers.  Clear parameter target.
10818         (Binary_test): Test target here.
10819         * testsuite/object_unittest.cc (gold_testsuite): Remove
10820         target_test_pointer parameter.  Change all callers.
10821         (Object_test): Test target here.
10822
10823 2009-09-26  Ian Lance Taylor  <iant@google.com>
10824
10825         * testsuite/initpri1.c: Don't try to use constructor priorities if
10826         compiling with gcc before 4.3.
10827
10828 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10829
10830         * testsuite/retain_symbols_file_test.sh (check_present): Change
10831         output file name to retain_symbols_file_test.stdout.
10832         (check_absent): Likewise.
10833
10834 2009-09-18  Craig Silverstein  <csilvers@google.com>
10835
10836         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10837         * options.cc: Include <cerrno> and <fstream>.
10838         (General_options::finalize): Parse -retain-symbols-file tag.
10839         * options.h: New flag.
10840         (General_options): New method should_retain_symbol, new
10841         variable symbols_to_retain.
10842         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10843         should_retain_symbol map.
10844         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10845         * testsuite/Makefile.in: Regenerate.
10846         * testsuite/retain_symbols_file_test.sh: New file.
10847
10848 2009-09-18  Nick Clifton  <nickc@redhat.com>
10849
10850         * po/es.po: Updated Spanish translation.
10851
10852 2009-09-17  Doug Kwan  <dougkwan@google.com>
10853
10854         * debug.h (DEBUG_RELAXATION): New constant.
10855         (DEBUG_ALL): Add DEBUG_RELAXATION.
10856         (debug_string_to_enum): Add relaxation debug option.
10857         * layout.cc
10858         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10859         Layout::Relaxation_debug_check::read_sections,
10860         Layout::Relaxation_debug_check::read_sections): New method definitions.
10861         (Layout::Layout): Initialize data members
10862         record_output_section_data_from_scrips_,
10863         script_output_section_data_list_ and relaxation_debug_check_.
10864         (Layout::save_segments, Layout::restore_segments,
10865         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10866         Layout::relaxation_loop_body): New method definitions.
10867         (Layout::finalize): Support relaxation.  Move section layout code to
10868         Layout::relaxation_loop_body.
10869         (Layout::set_asection_address_from_script): Move code for orphan
10870         section placement out.
10871         (Layout::place_orphan_sections_in_script): New method definition.
10872         * layout.h (Output_segment_headers, Output_file_header):
10873         New forward class declarations.
10874         (Layout::~Layout): Define.
10875         (Layout::new_output_section_data_from_script): New method definition.
10876         (Layout::place_orphan_sections_in_script): New method declaration.
10877         (Layout::Segment_states): New type declaration.
10878         (Layout::save_segments, Layout::restore_segments,
10879         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10880         Layout::relaxation_loop_body): New method declarations.
10881         (Layout::Output_section_data_list): New type declaration.
10882         (Layout::Relaxation_debug_check): New class definition.
10883         (Layout::record_output_section_data_from_script_,
10884         Layout::script_output_section_data_list_, Layout::segment_states_,
10885         Layout::relaxation_debug_check_): New data members.
10886         * output.cc: (Output_section_headers::do_size): New method definition.
10887         (Output_section_headers::Output_section_headers): Move size
10888         computation to Output_section_headers::do_size.
10889         (Output_segment_headers::do_size): New method definition.
10890         (Output_file_header::Output_file_header): Move size computation to
10891         Output_file_header::do_size and call it.
10892         (Output_file_header::do_size): New method definition.
10893         (Output_data_group::Output_data_group): Adjust call to
10894         Output_section_data.
10895         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10896         (Output_symtab_xindex::do_write): Add array bound check.
10897         (Output_section::Input_section::print_to_mapfile): Handle
10898         RELAXED_INPUT_SECTION_CODE.
10899         (Output_section::Output_section): Initialize data member checkpoint_.
10900         (Output_section::~Output_section): Delete checkpoint object pointed
10901         by checkpoint_.
10902         (Output_section::add_input_section): Always add an Input_section if
10903         relaxing.
10904         (Output_section::add_merge_input_section): Add assert.
10905         (Output_section::relax_input_section): New method definition.
10906         (Output_section::set_final_data_size): Set load address to zero for
10907         an unallocated section.
10908         (Output_section::do_address_and_file_offset_have_reset_values):
10909         New method definition.
10910         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10911         Handle relaxed input section.
10912         (Output_section::sort_attached_input_sections): Checkpoint input
10913         section list lazily.
10914         (Output_section::get_input_sections): Change type of input_sections to
10915         list of Simple_input_section pointers.  Checkpoint input section list
10916         lazily.  Also handle relaxed input sections.
10917         (Output_section::add_input_section_for_script): Take a reference to
10918         a Simple_input_section object instead of Relobj pointer and section
10919         index as parameter.  Handle relaxed input sections.
10920         (Output_section::save_states, Output_section::restore_states): New
10921         method definitions.
10922         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10923         (Output_data::is_data_size_fixed): New method definition.
10924         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10925         if it is fixed.
10926         (Output_data::address_and_file_offset_have_reset_values): New method
10927         definition.
10928         (Output_data::do_address_and_file_offset_have_reset_values): New method
10929         definition.
10930         (Output_data::set_data_size): Check that data size is not fixed.
10931         (Output_data::fix_data_size): New method definition.
10932         (Output_data::is_data_size_fixed_): New data member.
10933         (Output_section_headers::set_final_data_size): New method definition.
10934         (Output_section_headers::do_size): New method declaration.
10935         (Output_segment_headers::set_final_data_size): New method definition.
10936         (Output_segment_headers::do_size): New method declaration.
10937         (Output_file_header::set_final_data_size)::New method definition.
10938         (Output_file_header::do_size)::New method declaration.
10939         (Output_section_data::Output_section_data): Add new parameter
10940         is_data_size_fixed and use it to fix data size.
10941         (Output_data_const::Output_data_const): Adjust call to base class
10942         constructor and fix data size.
10943         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10944         base class constructor and fix data size.
10945         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10946         base class constructor and fix data size.
10947         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10948         class constructor and fix data size.
10949         (Output_data_group::set_final_data_size): New method definition.
10950         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10951         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10952         class constructor and fix data size.
10953         (Output_relaxed_input_section): New class definition.
10954         (Output_section::Simple_input_section): New class definition.
10955         (Output_section::get_input_sections): Adjust parameter list.
10956         (Output_section::add_input_section_for_script): Same.
10957         (Output_section::save_states, Output_section::restore_states,
10958         Output_section::do_address_and_file_offset_have_reset_values,
10959         (Output_section::Input_section::Input_section): Handle
10960         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10961         Output_relaxed_input_section.
10962         (Output_section::Input_section::is_input_section,
10963         Output_section::Input_section::set_output_section): Handle relaxed
10964         input section.
10965         (Output_section::Input_section::is_relaxed_input_section,
10966         Output_section::Input_section::output_section_data,
10967         Output_section::Input_section::relaxed_input_section): New method
10968         definitions.
10969         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10970         value.
10971         (Output_section::Input_section::u1_): Update comments.
10972         (Output_section::Input_section::u2_): Add new union member poris.
10973         (Output_section::Checkpoint_output_section): New classs definition.
10974         (Output_section::relax_input_section): New method declaration.
10975         (Output_section::checkpoint_): New data member.
10976         (Output_segment): Update comments.
10977         (Output_segment::Output_segment): Un-privatize copy constructor.
10978         (Output_segment::operator=): Un-privatize.
10979         * script-sections.cc (Output_section_element::Input_section_list):
10980         Change element type to Output_section::Simple_input_section.
10981         (Output_section_element_dot_assignment::set_section_addresses):
10982         Register output section data for relaxation clean up.
10983         (Output_data_exression::Output_data_expression): Adjust call to base
10984         constructor to fix data size.
10985         (Output_section_element_data::set_section_addresses): Register
10986         Output_data_expression object for relaxation clean up.
10987         (struct Input_section_info): Replace Relobj pointer and section index
10988         pair with Output_section::Simple_input_section and Convert struct to a
10989         class.
10990         (Input_section_sorter::operator()): Adjust access to
10991         Input_section_info data member to use accessors.
10992         (Output_section_element_input::set_section_addresses): Use layout
10993         parameter.  Adjust code to use Output_section::Simple_input_section
10994         and Input_secction_info classes.  Register filler for relaxation
10995         clean up.
10996         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10997         and section index pair with Output_section::Simple_input_section
10998         class.  Adjust code accordingly.
10999         (Phdrs_element::release_segment): New method definition.
11000         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11001         segment list.
11002         (Script_sections::release_segments): New method definition.
11003         * gold/script-sections.h (Script_sections::release_segments): New
11004         method declaration.
11005         * gold/target.h (Target::may_relax, Target::relax,
11006         Target::do_may_relax, Target::do_relax): New method definitions.
11007
11008 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11009
11010         * arm.cc (has_signed_unsigned_overflow): New function.
11011         (Arm_relocate_functions::abs8): New function.
11012         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11013         (Target_arm::Scan::global): Likewise.
11014         (Target_arm::relocate::relocate): Likewise.
11015         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11016         Likewise.
11017
11018 2009-09-16  Cary Coutant  <ccoutant@google.com>
11019
11020         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11021         * testsuite/Makefile.in: Regenerate.
11022
11023 2009-09-11  Nick Clifton  <nickc@redhat.com>
11024
11025         * po/gold.pot: Updated by the Translation project.
11026
11027 2009-09-08  Cary Coutant  <ccoutant@google.com>
11028
11029         * output.cc (Output_file::open): Add execute permission to empty file.
11030         * testsuite/Makefile.am (permission_test): New test.
11031         * testsuite/Makefile.in: Regenerate.
11032
11033 2009-09-02  Ian Lance Taylor  <iant@google.com>
11034
11035         * output.cc (Output_file::resize): Call map_no_anonymous rather
11036         than map.
11037
11038 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11039
11040         * gold.cc: Include "incremental.h".
11041         (queue_initial_tasks): Call Incremental_checker methods.
11042         * incremental.cc: Include "output.h".
11043         (Incremental_checker::can_incrementally_link_output_file): New
11044         method.
11045         * incremental.h (Incremental_checker): New class.
11046
11047         * output.cc (Output_file::open_for_modification): New method.
11048         (Output_file::map_anonymous): Changed return type to bool.  Record
11049         map in base_ field.
11050         (Output_file::map_no_anonymous): New method, broken out of map.
11051         (Output_file::map): Use map_no_anonymous and map_anonymous.
11052         * output.h (class Output_file): Update declarations.
11053
11054 2009-08-24  Cary Coutant  <ccoutant@google.com>
11055
11056         * options.h (Command_line::Pre_options): New class.
11057         (Command_line::pre_options): New member.
11058         * options.cc (gold::options::ready_to_register): New variable.
11059         (One_option::register_option): Do nothing if not registering options.
11060         Assert if same short option registered twice.
11061         (General_options::General_options): Turn off option registration when
11062         done constructing.
11063         (Command_line::Pre_options::Pre_options): New constructor.
11064
11065 2009-08-24  Cary Coutant  <ccoutant@google.com>
11066
11067         * options.h (General_options::no_keep_memory): Remove incorrect
11068         short option.
11069
11070 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11071
11072         * Makefile.am (am__skiplex, am__skipyacc): New.
11073         * Makefile.in: Regenerate.
11074
11075 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11076
11077         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11078         (INCLUDES): ... this.
11079         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11080         (AM_CPPFLAGS): Renamed from ...
11081         (INCLUDE): ... this.
11082         * Makefile.in, testsuite/Makefile.in: Regenerate.
11083
11084         * Makefile.in: Regenerate.
11085         * aclocal.m4: Likewise.
11086         * config.in: Likewise.
11087         * configure: Likewise.
11088         * testsuite/Makefile.in: Likewise.
11089
11090         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11091         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11092         * Makefile.in: Regenerate.
11093         * testsuite/Makefile.in: Regenerate.
11094
11095 2009-08-19  Cary Coutant  <ccoutant@google.com>
11096
11097         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11098         symbols in shared libraries overridden by hidden or internal symbols
11099         in the main program.
11100
11101 2009-08-19  Chris Demetriou  <cgd@google.com>
11102
11103         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11104         checking source file names in error messages.
11105
11106 2009-08-18  Doug Kwan  <dougkwan@google.com>
11107
11108         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11109         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11110         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11111         an elfcpp::Ehdr as parameter.
11112         * object.cc (Object::set_target): Remove the version that looks up
11113         a target and sets it.
11114         (Sized_relobj::setup): Take a Target object instead of
11115         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11116         (make_elf_sized_object): Find target and ask target to
11117         make an ELF object.
11118         * object.h: (Object::set_target): Remove the version that looks up
11119         a target and sets it.
11120         (Sized_relobj::setup): Take a Target object instead of
11121         an elfcpp:Ehdr as parameter.
11122         * target.cc: Include dynobj.h.
11123         (Target::do_make_elf_object_implementation): New.
11124         (Target::do_make_elf_object): New.
11125         * target.h (Target::make_elf_object): New template declaration.
11126         (Target::do_make_elf_object): New method declarations.
11127         (Target::do_make_elf_object_implementation): New template declaration.
11128
11129 2009-08-14  Ian Lance Taylor  <iant@google.com>
11130
11131         * gold.h (FUNCTION_NAME): Define.
11132         (gold_unreachable): Use FUNCTION_NAME.
11133
11134 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11135
11136         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11137         symbol in the --keep-unique list is not found.
11138
11139 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11140
11141         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11142         been maked as --keep-unique.
11143         (Icf::unfold_section): New function.
11144         * icf.h (Icf::unfold_section): New function.
11145         * options.h (General_options::keep_unique): New option.
11146         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11147         * testsuite/Makefile.in: Regenerate.
11148         * testsuite/icf_keep_unique_test.sh: New file.
11149         * testsuite/icf_keep_unique_test.cc: New file.
11150
11151 2009-08-12  Cary Coutant  <ccoutant@google.com>
11152
11153         PR 10471
11154         * resolve.cc (Symbol_table::resolve): Check for references from
11155         dynamic objects to hidden and internal symbols.
11156         * testsuite/Makefile.am (hidden_test.sh): New test.
11157         * testsuite/Makefile.in: Regenerate.
11158         * testsuite/hidden_test.sh: New script.
11159         * testsuite/hidden_test_1.c: New test source.
11160         * testsuite/hidden_test_main.c: New test source.
11161
11162 2009-08-11  Doug Kwan  <dougkwan@google.com>
11163
11164         * arm.cc: Update comments.
11165         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11166         segment to locate the .ARM.exidx section if present.
11167
11168 2009-08-09  Doug Kwan  <dougkwan@google.com>
11169
11170         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11171         patch.
11172
11173 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11174         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11175         compiler warnings.
11176
11177 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11178
11179         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11180         valid tls_segment only for non-debug-section relocations.
11181         * testsuite/Makefile.am: Add gc_tls_test.
11182         * testsuite/Makefile.in: Regenerate.
11183         * testsuite/gc_tls_test.cc: New file.
11184         * testsuite/gc_tls_test.sh: New file.
11185
11186 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11187
11188         * icf.cc: New file.
11189         * icf.h: New file.
11190         * Makefile.am (CCFILES): Add icf.cc.
11191         (HFILES): Add icf.h
11192         * Makefile.in: Regenerate.
11193         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11194         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11195         section, symbol and addend information for the relocs.
11196         * gold.cc (queue_middle_tasks): Call identical code folding.
11197         * gold.h: Add defines for multimap.
11198         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11199         to the call of finalize_local_symbols.
11200         * main.cc (main): Create object of class Icf.
11201         * object.cc (Sized_relobj::do_layout): Allow this function to be
11202         called twice during icf.
11203         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11204         to sections marked as identical by icf.
11205         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11206         when available.
11207         (Sized_relobj::do_section_entsize): New function.
11208         * object.h (Object::section_entsize): New function.
11209         (Object::do_section_entsize): New pure virtual function.
11210         (Relobj::finalize_local_symbols): Add new parameter.
11211         (Relobj::do_section_entsize): New function.
11212         * options.h (General_options::icf): New option.
11213         (General_options::icf_iterations): New option.
11214         (General_options::print_icf_sections): New option.
11215         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11216         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11217         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11218         icf.
11219         * symtab.cc (Symbol_table::is_section_folded): New function.
11220         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11221         to sections marked as identical by icf.
11222         * symtab.h (Symbol_table::set_icf): New function.
11223         (Symbol_table::icf): New function.
11224         (Symbol_table::is_section_folded): New function.
11225         (Symbol_table::icf_): New data member.
11226         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11227         * testsuite/Makefile.am: Add commands to build icf_test.
11228         * testsuite/Makefile.in: Regenerate.
11229         * testsuite/icf_test.sh: New file.
11230         * testsuite/icf_test.cc: New file.
11231
11232 2009-07-24  Chris Demetriou  <cgd@google.com>
11233
11234         * layout.cc (is_compressible_debug_section): Fix incorrect
11235         comment about compressed section names.
11236
11237 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11238
11239         PR 10419
11240         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11241
11242 2009-07-16  Ian Lance Taylor  <iant@google.com>
11243
11244         PR 10400
11245         * layout.h: #include <map>.
11246         (class Kept_section): Change from struct to class.  Add accessors
11247         and setters.  Add section size to Comdat_group mapping.  Change
11248         Comdat_group to std::map.  Add is_comdat_ field.  Add
11249         linkonce_size field in union.
11250         (class Layout): Update declaration of find_or_add_kept_section.
11251         Don't declare find_kept_object.
11252         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11253         parameter.  Add object, shndx, is_comdat, and is_group_name
11254         parameters.  Change all callers.  Adjust for new Kept_section.
11255         (Layout::find_kept_object): Remove.
11256         * object.cc (Sized_relobj::include_section_group): Update use of
11257         Kept_section.  Rename secnum to shndx.  Only record
11258         Kept_comdat_section if sections are the same size.
11259         (Sized_relobj::include_linkonce_section): Update use of
11260         Kept_section.  Only record Kept_comdat_section if sections are the
11261         same size.  Set size of linkonce section.
11262         (Sized_relobj::map_to_kept_section): Update call to
11263         get_kept_comdat_section.
11264         * object.h (class Sized_relobj): Rename fields in
11265         Kept_comdat_section to drop trailing underscores; change object
11266         field to Relobj*.  Change Kept_comdat_section_table to store
11267         struct rather than pointer.
11268         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11269         Add kept_object and kept_shndx parameters.  Change all callers.
11270         (Sized_relobj::get_kept_comdat_section): Change return type to
11271         bool.  Add kept_object and kept_shndx parameters.  Change all
11272         callers.
11273         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11274         Layout::find_or_add_kept_section.
11275
11276 2009-07-09  Ian Lance Taylor  <iant@google.com>
11277
11278         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11279         Reserve space in the hash table.
11280
11281 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11282
11283         * fileread.cc (File_read::get_mtime): New method.
11284         * fileread.h (Timespec): New structure.
11285         (File_read::get_mtime): New method.
11286         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11287         Renamed from timestamp_nsec.
11288         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11289         Elf_Xword.
11290         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11291         timestamp_nsec.
11292         (Incremental_inputs::report_archive): Save mtime; style fix.
11293         (Incremental_inputs::report_obejct): Save mtime; style fix.
11294         (Incremental_inputs::report_script): Save mtime; style fix.
11295         (Incremental_inputs::finalize_inputs): Style fix.
11296         (Incremental_inputs::finalize): Style fix.
11297         (Incremental_inputs::create_input_section_data): Store inputs
11298         mtime.
11299         * incremental.h (Incremental_inputs::report_script): Add mtime
11300         argument.
11301         (Incremental_inputs::Input_info::Input_info): Intialize only one
11302         union member.
11303         (Incremental_inputs::Input_info::archive): Move to nameless
11304         union.
11305         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11306         (Incremental_inputs::Input_info::script): Move to nameless union.
11307         (Incremental_inputs::mtime): New field.
11308         * script.cc (read_input_script): Pass file mtime to
11309         Incremental_input.
11310         * script.h (Script_info::inputs): Style fix.
11311
11312 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11313
11314         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11315         instead of 32.
11316
11317 2009-06-24  Ian Lance Taylor  <iant@google.com>
11318
11319         PR 10156
11320         * layout.cc (Layout::choose_output_section): If we find an
11321         existing section, update the flags.
11322         (Layout::create_notes): New function, broken out of
11323         Layout::finalize.
11324         (Layout::finalize): Don't create note sections.
11325         (Layout::create_note): Don't crash if linker script discards
11326         section.
11327         (Layout::create_gold_note): Likewise.
11328         (Layout::create_build_id): Likewise.  Don't set
11329         after_input_sections on the section.
11330         (Layout::create_executable_stack_info): Remove target parameter.
11331         Change caller.
11332         * layout.h (class Layout): Declare create_notes.  Update
11333         declaration of create_executable_stack_info.
11334         * gold.cc (queue_middle_tasks): Call create_notes.
11335         * output.cc (Output_section::update_flags_for_input_section): Move
11336         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11337         invalid.
11338         * output.h (Output_data::mark_address_invalid): New function.
11339         (class Output_section): Only declare, not define,
11340         update_flags_for_input_section.  Remove set_flags.
11341
11342 2009-06-24  Ian Lance Taylor  <iant@google.com>
11343
11344         * script-sections.cc (Output_section_definition::
11345         set_section_addresses): Rename shadowing local load_address to
11346         laddr.
11347
11348 2009-06-24  Ian Lance Taylor  <iant@google.com>
11349
11350         PR 10244
11351         * reloc.cc (relocate_sections): Skip empty relocation sections.
11352
11353 2009-06-23  Ian Lance Taylor  <iant@google.com>
11354
11355         PR 10156
11356         * layout.cc (Layout::create_note): Use choose_output_section
11357         rather than make_output_section.
11358
11359 2009-06-23  Ian Lance Taylor  <iant@google.com>
11360
11361         PR 10237
11362         * options.cc (General_options::parse_V): Set printed_version_.
11363         (General_options::General_options): Initialize printed_version_.
11364         * options.h (class General_options): Add printed_version_ field.
11365         * gold.cc (queue_initial_tasks): If there are no input files,
11366         don't give a fatal error if we printed the version information.
11367         (queue_middle_tasks): If using -r with a shared object, give a
11368         fatal error rather than an ordinary error.
11369
11370 2009-06-23  Ian Lance Taylor  <iant@google.com>
11371
11372         PR 10219
11373         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11374         (Layout::make_output_section): Set have_stabstr_section_ if we see
11375         a .stab*str section.
11376         (Layout::finalize): Call link_stabs_sections.
11377         (Layout::link_stabs_sections): New file.
11378         * layout.h (class Layout): Add have_stabstr_section_ field.
11379         Declare link_stabs_sections.
11380
11381 2009-06-23  Doug Kwan  <dougkwan@google.com>
11382
11383         * Makefile.am (libgold_a_LIBADD): New.
11384         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11385         * Makefile.in: Regenerate.
11386         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11387         * configure: Regenerate.
11388         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11389         * fileread.cc: Include sys/state.h
11390         * gold.h: Declare memmem and strndup if found missing.
11391         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11392
11393 2009-06-23  Ian Lance Taylor  <iant@google.com>
11394
11395         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11396         * configure: Rebuild.
11397
11398 2009-06-23  Ian Lance Taylor  <iant@google.com>
11399
11400         PR 10147
11401         * object.cc (Object::section_contents): Don't try to get a view if
11402         the section has length zero.
11403         (Object::handle_gnu_warning_section): If the section is empty, use
11404         the name of the section as the warning.
11405
11406 2009-06-23  Ian Lance Taylor  <iant@google.com>
11407
11408         PR 10133
11409         * stringpool.h (class Stringpool_template): Add optimize_ field.
11410         (Stringpool_template::set_optimize): New function.
11411         * stringpool.cc (Stringpool_template::Stringpool_template):
11412         Initialize optimize_ field.
11413         (Stringpool_template::set_string_offsets): Test local optimize
11414         fild rather than parameter.
11415         * layout.cc (Layout::Layout): Call set_optimize on the section
11416         name stringpool.
11417
11418 2009-06-22  Ian Lance Taylor  <iant@google.com>
11419
11420         PR 10030
11421         * yyscript.y: Parse TARGET.
11422         * script.cc (script_set_target): New function.
11423         * script-c.h (script_set_target): Declare.
11424         * options.cc (General_options::string_to_object_format): Rename
11425         from string_to_object_format in anonymous namespace.  Change
11426         callers.
11427         * options.h (class General_options): Declare
11428         string_to_object_format.
11429
11430 2009-06-22  Ian Lance Taylor  <iant@google.com>
11431
11432         * script-sections.cc (Script_sections::create_segments): Don't put
11433         program headers in a PT_LOAD segment if -n or -N.
11434
11435 2009-06-22  Ian Lance Taylor  <iant@google.com>
11436
11437         PR 10141
11438         * options.h (class General_options): Add -z lazy and -z now.  Sort
11439         -z options into alphabetical order.
11440         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11441
11442 2009-06-21  Ian Lance Taylor  <iant@google.com>
11443
11444         * layout.cc (Layout::make_output_section): Call
11445         Target::new_output_section.
11446         (Layout::attach_allocated_section_to_segment): Put large section
11447         sections in a separate load segment with the large segment flag
11448         set.
11449         (Layout::segment_precedes): Sort large data segments after other
11450         load segments.
11451         (align_file_offset): New static function.
11452         (Layout::set_segment_offsets): Use align_file_offset.
11453         * output.h (class Output_section): Add is_small_section_ and
11454         is_large_section_ fields.
11455         (Output_section::is_small_section): New function.
11456         (Output_section::set_is_small_section):  New function.
11457         (Output_section::is_large_section): New function.
11458         (Output_section::set_is_large_section): New function.
11459         (Output_section::is_large_data_section): New function.
11460         (class Output_segment): Add is_large_data_segment_ field.
11461         (Output_segment::is_large_data_segment): New function.
11462         (Output_segment::set_is_large_data_segment): New function.
11463         * output.cc (Output_section::Output_section): Initialize new
11464         fields.
11465         (Output_segment::Output_segment): Likewise.
11466         (Output_segment::add_output_section): Add assertion that large
11467         data sections always go in large data segments.  Force small data
11468         sections to the end of the list of data sections.  Force small BSS
11469         sections to the start of the list of BSS sections.  For large BSS
11470         sections to the end of the list of BSS sections.
11471         * symtab.h (class Symbol): Declare is_common_shndx.
11472         (Symbol::is_defined): Check Symbol::is_common_shndx.
11473         (Symbol::is_common): Likewise.
11474         (class Symbol_table): Define enum Commons_section_type.  Update
11475         declarations.  Add small_commons_ and large_commons_ fields.
11476         * symtab.cc (Symbol::is_common_shndx): New function.
11477         (Symbol_table::Symbol_table): Initialize new fields.
11478         (Symbol_table::add_from_object): Put small and large common
11479         symbols in the right list.
11480         (Symbol_table::sized_finalized_symbol): Check
11481         Symbol::is_common_shndx.
11482         (Symbol_table::sized_write_globals): Likewise.
11483         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11484         common symbol lists.  Don't call do_allocate_commons_list if the
11485         list is empty.
11486         (Symbol_table::do_allocate_commons_list): Remove is_tls
11487         parameter.  Add comons_section_type parameter.  Change all
11488         callers.  Handle small and large common symbols.
11489         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11490         Symbol::is_common_shndx.
11491         * resolve.cc (symbol_to_bits): Likewise.
11492         * target.h (Target::small_common_shndx): New function.
11493         (Target::small_common_section_flags): New function.
11494         (Target::large_common_shndx): New function.
11495         (Target::large_common_section_flags): New function.
11496         (Target::new_output_section): New function.
11497         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11498         small_common_section_flags, and large_common_section_flags
11499         fields.
11500         (Target::do_new_output_section): New virtual function.
11501         * arm.cc (Target_arm::arm_info): Initialize new fields.
11502         * i386.cc (Target_i386::i386_info): Likewise.
11503         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11504         Likewise.
11505         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11506         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11507         (Target_x86_64::do_new_output_section): New function.
11508         * configure.ac: Define conditional MCMODEL_MEDIUM.
11509         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11510         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11511         (large_LDFLAGS): Define.
11512         * testsuite/large.c: New file.
11513         * testsuite/testfile.cc (Target_test::test_target_info):
11514         Initialize new fields.
11515         * configure, testsuite/Makefile.in: Rebuild.
11516
11517 2009-06-05  Doug Kwan  <dougkwan@google.com>
11518
11519         * Makefile.am (CCFILES): Add target.cc.
11520         * Makefile.in: Regenerate.
11521         * i386.cc (class Target_i386): Define new virtual method to
11522         override do_is_local_label_name in parent.
11523         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11524         local symbols if --discard-locals or -X is given.
11525         * options.h (class General_options): Declare new options
11526         '--discard-locals' and '-X' for discarding locals.
11527         * target.h (class Target): Define new methods is_local_label_name.
11528         Declare new virtual method do_is_local_label_name.
11529         * target.cc: New file.
11530         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11531         (check_SCRIPTS): Add discard_locals_test.sh.
11532         (check_DATA): Add discard_local_tests.syms.
11533         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11534         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11535         * testsuite/Makefile.in: Regenerate.
11536         * testsuite/discard_locals_test.c: New file.
11537         * testsuite/discard_locals_test.sh: Same.
11538
11539 2009-06-05  Doug Kwan  <dougkwan@google.com>
11540
11541         * object.cc (Sized_relobj::Sized_relobj): Initialize
11542         discarded_eh_frame_shndx_ to -1U.
11543         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11544         section.
11545         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11546         a discarded .eh_frame section.
11547         (Sized_relobj::do_finalize_local_symbols): Ditto.
11548         * object.h (class Sized_relobj): Declare new member
11549         discarded_eh_frame_shndx_.
11550         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11551         (local_labels_test.o, local_labels_test): New rules.
11552         * testsuite/Makefile.in: Regenerate.
11553
11554 2009-06-04  Doug Kwan  <dougkwan@google.com>
11555
11556         * layout.cc (Layout::section_name_mapping): Add mapping for
11557         special ARM sections.
11558
11559 2009-06-03  Doug Kwan  <dougkwan@google.com>
11560
11561         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11562         (utils::has_overflow): Same.
11563
11564 2009-06-03  Ian Lance Taylor  <iant@google.com>
11565
11566         * layout.cc (Layout::section_name_mapping): New array, replacing
11567         Layout::linkonce_mapping.
11568         (Layout::section_name_mapping_count): New variable, replacing
11569         Layout::linkonce_mapping_count.
11570         (Layout::linkonce_output_name): Remove.
11571         (Layout::output_section_name): Rewrite.
11572         * layout.h (class Layout): Rename Linkonce_mapping to
11573         Section_name_mapping, linkonce_mapping to section_name_mapping,
11574         linkonce_mapping_count to section_name_mapping_count.  Don't
11575         declare linkonce_output_name.
11576
11577 2009-06-03  Doug Kwan  <dougkwan@google.com>
11578
11579         * gold/arm.cc (namespace utils): New.
11580         (Target_arm::reloc_is_non_pic): Define new method.
11581         (class Arm_relocate_functions): New.
11582         (Target_arm::Relocate::relocate): Handle relocation types used by
11583         Android.
11584
11585 2009-06-03  Ian Lance Taylor  <iant@google.com>
11586
11587         * arm.cc (Target_arm::scan::global): Use || instead of |.
11588
11589 2009-06-02  Doug Kwan  <dougkwan@google.com>
11590
11591         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11592         issued_non_pic_error_.
11593         (class Target_arm::Scan): Declare new method check_non_pic.
11594         Define new method symbol_needs_plt_entry.
11595         Declare new data member issued_non_pic_error_.
11596         (class Target_arm::Relocate): Declare new method
11597         should_apply_static_reloc.
11598         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11599         (Target_arm::Scan::check_non_pic): Define new method.
11600         (Target_arm::Scan::local): Handle a small subset of reloc types used
11601         by Android.
11602         (Target_arm::Scan::local): Same.
11603         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11604
11605 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11606
11607         * incremental.cc (Incremental_inputs::report_command_line): Filter
11608         out --incremental-* options.
11609
11610 2009-05-29  Doug Kwan  <dougkwan@google.com>
11611
11612         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11613         template class.
11614         (class Target_arm): Update comment.
11615         (Target_arm::Target_arm): Initialize new data members GOT_,
11616         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11617         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11618         and Target_arm::rel_dyn_section.
11619         Declare new_enum Target_arm::Got_type.
11620         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11621         and DYNBSS_.
11622         Update commments for member do_dynsym_value.
11623         (Target_arm::got_size, Target_arm::plt_section,
11624         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11625         new methods inside class defintion.
11626         (Target_arm::got_section): Define new method.
11627         (Target_arm::rel_dyn_section): Same.
11628         (Output_data_plt_arm): New template class.
11629         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11630         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11631         (Output_data_plt_arm::add_entry): Same.
11632         (Output_data_plt_arm::first_plt_entry): Define new
11633         static data member for PLT instruction template.
11634         (Output_data_plt_arm::plt_entry): Same.
11635         (Output_data_plt_arm::do_write): Define new method.
11636         (Target_arm::make_plt_entry): Same.
11637         (Target_arm::do_finalize_sections): Same.
11638         (Target_arm::do_dynsym_value): Same.
11639
11640 2009-05-28  Doug Kwan  <dougkwan@google.com>
11641
11642         * Makefile.am (TARGETSOURCES): Add arm.cc.
11643         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11644         * Makefile.in: Regenerate.
11645         * arm.cc: New file.
11646         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11647
11648 2009-05-26  Doug Kwan  <dougkwan@google.com>
11649
11650         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11651         (General_options::check_excluded_libs): Strip off directories in
11652         archive name before matching like GNU ld does.
11653         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11654         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11655         (exclude_libs_test_LDFLAGS): Add linker option
11656         -Wl,--exclude-libs,libexclude_libs_test_3
11657         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11658         an explicit archive without using -l.
11659         (alt/libexclude_libs_test_3.a): New make rule.
11660         * testsuite/Makefile.in: Regenerate.
11661         * testsuite/exclude_libs_test.c : Declare lib3_default().
11662         (main): Call it.
11663         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11664         * exclude_libs_test_3.c: New file.
11665
11666 2009-05-26  Nick Clifton  <nickc@redhat.com>
11667
11668         * po/id.po: New Indonesian translation.
11669         * po/gold.pot: Updated template file.
11670
11671 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11672
11673         * testsuite/Makefile.am: Add -ffunction-sections to compile
11674         gc_comdat_test files.  Add -Wl,--gc-sections to build
11675         gc_comdat_test.
11676         * testsuite/Makefile.in: Regenerate.
11677         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11678
11679 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11680
11681         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11682         kept comdat section was garbage collected.
11683         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11684         * testsuite/Makefile.in: Regenerate.
11685         * testsuite/gc_comdat_test.sh: New file.
11686         * testsuite/gc_comdat_test_1.cc: New file.
11687         * testsuite/gc_comdat_test_2.cc: New file.
11688
11689 2009-05-19  Doug Kwan  <dougkwan@google.com>
11690
11691         * archive.cc (Archive::Archive): Move constructor from archive.h
11692         to here.  Initialize no_export_.
11693         (Archive::get_elf_object_for_member): Set no_export flag of object.
11694         * archive.h (Archive::Archive): Move constructor body to
11695         archive.cc.
11696         (Archive::no_export): New method.
11697         (Archive::no_export_): New field.
11698         * object.h (Object::Object): Initialize no_export_ to false.
11699         (Object::no_export, Object::set_no_export): New methods.
11700         (Object::no_export_): New field.
11701         * options.cc (General_options::parse_exclude_libs): New method.
11702         (General_options::check_excluded_libs) Same.
11703         * options.h (exclude_libs): New option.
11704         (General_options::check_excluded_libs): New method declaration.
11705         (General_options::excluded_libs_): New field.
11706         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11707         default or protected visibility if an object has no-export flag set.
11708         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11709         (check_SCRIPTS): Add exclude_libs_test.sh.
11710         (check_DATA): Add exclude_libs_test.syms.
11711         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11712         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11713         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11714         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11715         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11716         libexclude_libs_test_2.a): New rules.
11717         * testsuite/Makefile.in: Regenerate.
11718         * testsuite/exclude_libs_test.c: New file.
11719         * testsuite/exclude_libs_test.sh: Ditto.
11720         * testsuite/exclude_libs_test_1.c: Ditto.
11721         * testsuite/exclude_libs_test_2.c: Ditto.
11722
11723 2009-05-15  Ian Lance Taylor  <iant@google.com>
11724
11725         * configure.ac: Check for declarations for cases where libiberty.h
11726         checks HAVE_DECL_xxx.
11727         * configure, config.in: Rebuild.
11728
11729 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11730
11731         * gold.h (Incremental_argument_list): Remove (invalid) forward
11732         declaration.
11733         * incremental.cc (Incremental_inputs::report_achive): New method.
11734         (Incremental_inputs::report_object): New method.
11735         (Incremental_inputs::report_script): New method.
11736         (Incremental_inputs::finalize_inputs): New method.
11737         (Incremental_inputs::finalize): Call finalize_inputs().
11738         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11739         Create inputs entries.
11740         * incremental.h (Incremental_input_type): New enum.
11741         (Incremental_inputs::Incremental_input): Initialize new fields.
11742         (Incremental_inputs::report_inputs): New method.
11743         (Incremental_inputs::report_achive): New method.
11744         (Incremental_inputs::report_object): New method.
11745         (Incremental_inputs::report_script): New method.
11746         (Incremental_inputs::finalize_inputs): New method.
11747         (Incremental_inputs::Input_info): New struct.
11748         (Incremental_inputs::Input_info_map): New typedef.
11749         (Incremental_inputs::lock_): New field.
11750         (Incremental_inputs::Inputs_): New field.
11751         (Incremental_inputs::Inputs_map): New field.
11752         * main.cc (main): Call Incremental_input::report_inputs.
11753         * options.h (Input_argument_list): Typedef moved from
11754         Input_arguments.
11755         (Input_file_group::Files): Remove, use ::Input_argument_list.
11756         (Input_file_group::Input_argument_list): Remove, use
11757         ::Input_argument_list.
11758         * plugin.cc (Plugin_manager::add_input_file): Add error in
11759         incremental build.
11760         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11761         functions.
11762         * script.cc (read_input_script): Call
11763         Incremental_input::report_script.
11764         * script.h (Script_info): New class.
11765
11766 2009-04-27  Ian Lance Taylor  <iant@google.com>
11767
11768         * x86_64.cc (do_adjust_output_section): Set entsize to
11769         plt_entry_size.
11770
11771 2009-04-23  Elliott Hughes  <enh@google.com>
11772
11773         * output.cc (Output_file::close): After short writes, continue
11774         writing from the correct offset in the buffer being written.
11775
11776 2009-04-23  Chris Demetriou  <cgd@google.com>
11777
11778         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11779         * configure: Regenerate.
11780         * config.in: Regenerate.
11781         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11782         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11783
11784 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11785
11786         * incremental.cc (Incremental_inputs_header_data): Renamed from
11787         Incremental_input_header_data.
11788         (Incremental_inputs_header_data::data_size): New field.
11789         (Incremental_inputs_header_data::put_input_file_count): Renamed
11790         from input_file_count.
11791         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11792         from command_line_offset.
11793         (Incremental_inputs_header_data::put_reserved): Renamed from
11794         put_reserved.
11795         (Incremental_inputs_entry_data): Renamed from
11796         Incremental_input_entry_data.
11797         (Incremental_inputs_entry_data::data_size): New field.
11798         (Incremental_inputs::report_command_line): New method.
11799         (Incremental_inputs::finalize): New method.
11800         (Incremental_inputs::create_incremental_inputs_data): New method.
11801         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11802         * incremental.h: New file.
11803         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11804         (Layout::finalize): Create incremental inputs section in
11805         incremental builds.
11806         (Layout::create_incremental_info_sections): New method.
11807         * layout.h (Layout::incremental_inputs): New method.
11808         (Layout::create_incremental_info_sections): New method.
11809         (Layout::incremental_inputs_): New field.
11810         * main.cc (main): Notify Incremental_input of the command line.
11811
11812 2009-04-01  Ian Lance Taylor  <iant@google.com>
11813             Mikolaj Zalewski  <mikolajz@google.com>
11814
11815         * gold.h (reserve_unordered_map): Define, three versions, one for
11816         each version of Unordered_map.
11817         * layout.cc (Layout::Layout): Remove options parameter.  Add
11818         number_of_input_files parameter.  Don't initialize options_.
11819         Initialize number_of_input_files_ and resized_signatures_.  Move
11820         sections_are_attached_.
11821         (Layout::layout_group): Reserve space for group_signatures_.
11822         (Layout::find_or_add_kept_section): Change name parameter to be a
11823         reference.  Resize signatures_ map when it gets large enough.
11824         (Layout::layout_eh_frame): Use parameters->options() instead of
11825         this->options_.
11826         (Layout::make_output_section): Likewise.
11827         (Layout::attach_allocated_section_to_segment): Likewise.
11828         (Layout::finalize, Layout::create_executable_stack): Likewise.
11829         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11830         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11831         * layout.h (class Layout): Update declarations.  Remove options_
11832         field.  Add number_of_input_files_ and resized_signatures_
11833         fields.  Move sections_are_attached_ field.
11834         * main.cc (main): Pass number of input files to Layout
11835         constructor.  Don't pass options.
11836
11837 2009-03-30  Ian Lance Taylor  <iant@google.com>
11838
11839         * ffsll.c (ffsll): Correct implementation.
11840
11841 2009-03-27  Ian Lance Taylor  <iant@google.com>
11842
11843         * ffsll.c: New file.
11844         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11845         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11846         * ftruncate.c (ftruncate): Declare before definition.
11847         * mremap.c (mremap): Likewise.
11848         * pread.c (pread): Likewise.
11849         * configure, Makefile.in, config.in: Rebuild.
11850
11851         * mremap.c: New file.
11852         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11853         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11854         (mremap): Declare if HAVE_MREMAP is not defined.
11855         * configure, Makefile.in, config.in: Rebuild.
11856
11857 2009-03-27  Cary Coutant  <ccoutant@google.com>
11858
11859         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11860         position independent.
11861         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11862         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11863
11864 2009-03-24  Cary Coutant  <ccoutant@google.com>
11865
11866         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11867         an executable.
11868         (needs_dynamic_reloc): Likewise.
11869
11870 2009-03-24  Ian Lance Taylor  <iant@google.com>
11871
11872         * yyscript.y (file_cmd): Recognize EXTERN.
11873         (extern_name_list, extern_name_list_body): New nonterminals.
11874         * script.cc (script_add_extern): Define.
11875         * script-c.h (script_add_extern): Declare.
11876
11877 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11878
11879         * object.cc (is_elf_object): Define.
11880         * object.h (is_elf_object): Declare.
11881         * archive.cc (Archive::get_elf_object_for_member): Call
11882         is_elf_object.
11883         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11884
11885 2009-03-24  Elliott Hughes  <enh@google.com>
11886
11887         * output.cc (Output_file::map_anonymous): Define.
11888         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11889         try an anonymous one.  Report the size if the mmap fails.
11890         * output.h (class Output_file): Declare map_anonymous.
11891
11892 2009-03-24  Ian Lance Taylor  <iant@google.com>
11893
11894         * target-select.cc (instantiate_target): Don't acquire the lock if
11895         the instantiated_target_ field has already been set.
11896
11897 2009-03-23  Ian Lance Taylor  <iant@google.com>
11898
11899         * gold-threads.h (class Initialize_lock): Define.
11900         * gold-threads.cc (class Initialize_lock_once): Define.
11901         (initialize_lock_control): New static variable.
11902         (initialize_lock_pointer): New static variable.
11903         (initialize_lock_once): New static function.
11904         (Initialize_lock::Initialize_lock): Define.
11905         (Initialize_lock::initialize): Define.
11906         * target-select.h: Include "gold-threads.h".
11907         (class Target_selector): Add lock_ and initialize_lock_ fields.
11908         Don't define instantiate_target, just declare it.
11909         * target-select.cc (Target_selector::Target_selector): Initialize
11910         new fields.
11911         (Target_selector::instantiate_target): Define.
11912         * descriptors.h: Include "gold-threads.h".
11913         (class Descriptors): Add initialize_lock_ field.
11914         * descriptors.cc (Descriptors::Descriptors): Initialize new
11915         field.
11916         (Descriptors::open): Use initialize_lock_ field
11917         * errors.h (class Errors): Add initialize_lock_ field.
11918         * errors.cc (Errors::Errors): Initialize new field.
11919         (Errors::initialize_lock): Use initialize_lock_ field.
11920         * powerpc.cc (class Target_selector_powerpc): Remove
11921         instantiated_target_ field.  In do_recognize call
11922         instantiate_target rather than do_instantiate_target.  In
11923         do_instantiate_target just allocate a new target.
11924         * sparc.cc (class Target_selector_sparc): Likewise.
11925
11926         * freebsd.h: New file.
11927         * i386.cc: Include "freebsd.h".
11928         (Target_i386): Derive from Target_freebsd rather than
11929         Sized_target.
11930         (Target_selector_i386): Derive from Target_selector_freebsd rather
11931         than Target_selector.
11932         * x86_64.cc: Include "freebsd.h".
11933         (Target_x86_64): Derive from Target_freebsd rather than
11934         Sized_target.
11935         (Target_selector_x86_64): Derive from Target_selector_freebsd
11936         rather than Target_selector.
11937         * target.h (class Target): Add adjust_elf_header and
11938         do_adjust_elf_header.
11939         * output.cc (Output_file_header:: do_sized_write): Call target
11940         adjust_elf_header routine.
11941         * configure.tgt: Set targ_osabi.
11942         * configure.ac: Define GOLD_DEFAULT_OSABI.
11943         * parameters.cc (Parameters::default_target): Pass
11944         GOLD_DEFAULT_OSABI to select_target.
11945         * target-select.h (class Target_selector): Make instantiate_target
11946         protected rather than private.
11947         * Makefile.am (HFILES): Add freebsd.h.
11948         * configure, Makefile.in, config.in: Rebuild.
11949
11950         * merge.cc (do_add_input_section): Correct pend value.  Change
11951         message about last entry not being null terminated from error to
11952         warning.
11953
11954 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11955
11956         * incremental.cc: New file.
11957         * Makefile.am (CCFILES): Add incremental.cc.
11958         * Makefile.in: Rebuild.
11959
11960 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11961
11962         * layout.cc (Layout::output_section_name): Preserve names
11963         of '.note.' sections.
11964
11965 2009-03-19  Ian Lance Taylor  <iant@google.com>
11966
11967         * descriptors.cc (Descriptors::open): Check that the options are
11968         valid before using them.
11969
11970 2009-03-18  Ian Lance Taylor  <iant@google.com>
11971
11972         * script-sections.h: Include <list>.
11973         (class Script_sections): Change Sections_elements from std::vector
11974         to std::list.  Typedef public Elements_iterator.  Add
11975         orphan_section_placement_, data_segment_align_start_, and
11976         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11977         field.
11978         * script-sections.cc (class Orphan_section_placement): New class.
11979         (class Sections_element): Add virtual functions is_relro and
11980         orphan_section_init.  Remove virtual function place_orphan_here.
11981         (class Output_section_definition): Add is_relro and
11982         orphan_section_init.  Remove place_orphan_here.
11983         (class Orphan_output_section): Likewise.
11984         (Script_sections::Script_sections): Update for field changes.
11985         (Script_sections::data_segment_align): Set saw_data_segment_align_
11986         and data_segment_align_start_, not data_segment_align_index.
11987         (Script_sections::data_segment_relro_end): Check
11988         saw_data_segment_align_.  Use data_segment_align_start_ rather
11989         than data_segment_align_index_.
11990         (Script_sections::place_orphan): Rewrite to use
11991         Orphan_section_placement.
11992
11993 2009-03-17  Ian Lance Taylor  <iant@google.com>
11994
11995         * archive.cc (Archive::add_symbols): Check for a version attached
11996         to the symbol name in the archive map.
11997         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11998         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11999         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12000         (ver_test_11.a): New target.
12001         * testsuite/Makefile.in: Rebuild.
12002
12003         * configure.ac: Check for chsize and posix_fallocate.  Replace
12004         ftruncate.
12005         * ftruncate.c: New file, from gnulib.
12006         * output.cc (posix_fallocate): Define dummy version if not
12007         HAVE_POSIX_FALLOCATE.
12008         (Output_file::map): Call posix_fallocate rather than lseek and
12009         write.
12010         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12011         * configure, Makefile.in, config.in: Rebuild.
12012
12013 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12014
12015         * layout.h (Layout::create_note): Add section_name parameter.
12016         * layout.cc (Layout::create_note): Likewise.
12017         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12018
12019 2009-03-17  Ian Lance Taylor  <iant@google.com>
12020
12021         * descriptors.cc: Include "options.h".
12022         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12023         (Descriptors::open): Always use O_CLOEXEC when opening a new
12024         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12025         then set FD_CLOEXEC.
12026
12027         * sparc.cc (class Target_sparc): Add has_got_section.
12028         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12029         make sure we have a GOT section.
12030
12031         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12032         (Target_sparc::Scan::local): Likewise.
12033         (Target_sparc::Scan::global): Likewise.
12034         (Target_sparc::Relocate::relocate): Likewise.
12035         (Target_sparc::Relocate::relocate_tls): Likewise.
12036
12037         * symtab.cc (Symbol_table::define_default_version): New function,
12038         broken out of add_from_object.
12039         (Symbol_table::add_from_object): Call define_default_version.
12040         (Symbol_table::define_special_symbol): Add resolve_oldsym
12041         parameter.  Change all callers.  If the version for a symbol comes
12042         from a version script, resolve it with the symbol with the same
12043         name with no version.  Also add the symbol without a version if
12044         appropriate.
12045         (do_define_in_output_data): If resolving with oldsym, don't delete
12046         sym.
12047         (do_define_in_output_segment): Likewise.
12048         (do_define_as_constant): Likewise.
12049         * symtab.h (class Symbol_table): Update declarations.
12050
12051 2009-03-13  Ian Lance Taylor  <iant@google.com>
12052
12053         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12054         (Read_symbols::requeue): New function.
12055         (Read_symbols::do_read_symbols): If make_elf_object fails because
12056         the target type is not configured, and the file was searched for,
12057         issue a warning and retry with the next directory.
12058         (Add_symbols::run): If the file has an incompatible format, and
12059         it was searched for, requeue the Read_symbols task.  On error,
12060         release the object.
12061         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12062         dirindex parameter to constructor.  Change all callers.  Declare
12063         incompatible_warning and requeue.
12064         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12065         input_argument_ and input_group_ fields.  Add them to
12066         constructor.  Change all callers.
12067         (class Read_script): Add dirindex_ field.  Add it to constructor.
12068         Change all callers.
12069         * archive.cc (Archive::setup): Remove input_objects parameter.
12070         Change all callers.
12071         (Archive::get_file_and_offset): Likewise.
12072         (Archive::read_all_symbols): Likewise.
12073         (Archive::read_symbols): Likewise.
12074         (Archive::get_elf_object_for_member): Remove input_objects
12075         parameter.  Add punconfigured parameter.  Change all callers.
12076         (Archive::add_symbols): Change return type to bool.  Check return
12077         value of include_member.
12078         (Archive::include_all_members): Likewise.
12079         (Archive::include_member): Change return type to bool.  Return
12080         false if first included object has incompatible target.  Set
12081         included_member_ field.
12082         (Add_archive_symbols::run): If add_symbols returns false, requeue
12083         Read_symbols task.
12084         * archive.h (class Archive): Add included_member_ field.
12085         Initialize it in constructor.  Add input_file and searched_for
12086         methods.  Update declarations.
12087         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12088         input_argument_ fields.  Add them to constructor.  Change all
12089         callers.
12090         * script.cc: Include "target-select.h".
12091         (class Parser_closure): Add skip_on_incompatible_target_ and
12092         found_incompatible_target_ fields.  Add
12093         skip_on_incompatible_target parameter to constructor.  Change all
12094         callers.  Add methods skip_on_incompatible_target,
12095         clear_skip_on_incompatible_target, found_incompatible_target, and
12096         set_found_incompatible_target.
12097         (read_input_script): Add dirindex parameter.  Change all callers.
12098         If parser finds an incompatible target, requeue Read_symbols
12099         task.
12100         (script_set_symbol): Clear skip_on_incompatible_target in
12101         closure.
12102         (script_add_assertion, script_parse_option): Likewise.
12103         (script_start_sections, script_add_phdr): Likewise.
12104         (script_check_output_format): New function.
12105         * script.h (read_input_script): Update declaration.
12106         * script-c.h (script_check_output_format): Declare.
12107         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12108         (ignore_cmd): Remove OUTPUT_FORMAT.
12109         * fileread.cc (Input_file::Input_file): Add explicit this.
12110         (Input_file::will_search_for): New function.
12111         (Input_file::open): Add pindex parameter.  Change all callers.
12112         * fileread.h (class Input_file): Add input_file_argument method.
12113         Declare will_search_for.  Update declarations.
12114         * object.cc (make_elf_object): Add punconfigured parameter.
12115         Change all callers.
12116         * object.h (class Object): Make input_file public.  Add
12117         searched_for method.
12118         (make_elf_object): Update declaration.
12119         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12120         restart search.
12121         * dirsearch.h (class Dirsearch): Update declaration.
12122         * options.h (class General_options): Add --warn-search-mismatch.
12123         * parameters.cc (Parameters::is_compatible_target): New function.
12124         * parameters.h (class Parameters): Declare is_compatible_target.
12125         * workqueue.cc (Workqueue::add_blocker): New function.
12126         * workqueue.h (class Workqueue): Declare add_blocker.
12127
12128         * fileread.cc (Input_file::open): Remove options parameter.
12129         Change all callers.
12130         (Input_file::open_binary): Likewise.
12131         * script.cc (read_input_script): Likewise.
12132         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12133         options parameter from constructor.  Change all callers.
12134         (class Read_script): Likewise.
12135         * fileread.h (class Input_file): Update declarations.
12136         * script.h (read_input_script): Update declaration.
12137
12138 2009-03-10  Nick Clifton  <nickc@redhat.com>
12139
12140         * po/es.po: New Spanish translation.
12141
12142 2009-03-06  Cary Coutant  <ccoutant@google.com>
12143
12144         * options.cc (parse_short_option): Keep dash_z from registering itself.
12145
12146 2009-03-03  Ian Lance Taylor  <iant@google.com>
12147
12148         PR 9918
12149         * target-reloc.h (relocate_section): Pass output_section to
12150         relocate.
12151         * i386.cc (Target_i386::should_apply_static_reloc): Add
12152         output_section parameter.  Change all callers.
12153         (Target_i386::Relocate::relocate): Add output_section parameter.
12154         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12155         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12156         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12157         * testsuite/two_file_shared.sh: New script.
12158         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12159         (check_DATA): Add two_file_shared.dbg.
12160         (two_file_shared.dbg): New target.
12161         * testsuite/Makefile.in: Rebuild.
12162
12163 2009-03-01  Ian Lance Taylor  <iant@google.com>
12164
12165         * configure.ac: Check for byteswap.h.
12166         * configure: Rebuild.
12167         * config.in: Rebuild.
12168
12169 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12170
12171         * layout.cc (Layout::find_or_add_kept_section): New function.
12172         (Layout::add_comdat): Removed.
12173         * layout.h (struct Kept_section): Move out of class Layout.
12174         Remove trailing underscores from field names.  Add group_sections
12175         field.  Rename group_ field to is_group.  Change all uses.
12176         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12177         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12178         comdat_groups_ field.
12179         (Sized_relobj::include_section_group): Use
12180         find_or_add_kept_section and Kept_section::group_sections.
12181         (Sized_relobj::include_linkonce_section): Likewise.
12182         * object.cc (class Sized_relobj): Don't define Comdat_group or
12183         Comdat_group_table.  Remove find_comdat_group and
12184         add_comdat_group.  Remove comdat_groups_ field.
12185         * plugin.cc (include_comdat_group): Use
12186         Layout::find_or_add_kept_section.
12187
12188 2009-02-28  Ian Lance Taylor  <iant@google.com>
12189
12190         * README: --gc-sections and map files are now supported.  Document
12191         some build requirements.
12192
12193         PR 6992
12194         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12195         relocatable link set the value of the section symbol to zero.
12196         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12197         relocatable link don't include the section address in the local
12198         symbol value.
12199
12200 2009-02-27  Ian Lance Taylor  <iant@google.com>
12201
12202         PR 6811
12203         * options.h (class Search_directory): Add is_system_directory.
12204         (class General_options): Declare is_in_system_directory.
12205         * options.cc (get_relative_sysroot): Make static.
12206         (get_default_sysroot): Make static.
12207         (General_optoins::is_in_system_directory): New function.
12208         * fileread.cc (Input_file::is_in_system_directory): New function.
12209         * fileread.h (class Input_file): Declare is_in_system_directory.
12210         * object.h (class Object): Add is_in_system_directory.
12211         (class Input_objects): Remove system_library_directory_ field.
12212         * object.cc (Input_objects::add_object): Don't set
12213         system_library_directory_.
12214         (input_objects::found_in_system_library_directory): Remove.
12215         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12216         parameter.  Change all callers.
12217         (Symbol_table::sized_write_globals): Likewise.
12218         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12219         Call Object::is_in_system_directory.
12220         * symtab.h (class Symbol_table): Update declarations.
12221
12222         PR 5990
12223         * descriptors.h (Open_descriptor): Add is_on_stack field.
12224         * descriptors.cc (Descriptors::open): If the descriptor is on the
12225         top of the stack, remove it.  Initialize is_on_stack field.
12226         (Descriptors::release): Only add pod to stack if it is not on the
12227         stack already.
12228         (Descriptors::close_some_descriptor): Clear stack_next and
12229         is_on_stack fields.
12230
12231         PR 7091
12232         * output.cc (Output_section::find_starting_output_address): Rename
12233         from starting_output_address; add PADDR parameter; change return
12234         type.
12235         * output.h (class Output_section): Declare
12236         find_starting_output_address instead of starting_output_address.
12237         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12238         section symbol for which we can't find a merge section.
12239
12240         PR 9836
12241         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12242         hidden or internal, force the symbol to be local.
12243         * resolve.cc (Symbol::override_visibility): Define.
12244         (Symbol::override_base): Use override_visibility.
12245         (Symbol_table::resolve): Likewise.
12246         (Symbol::override_base_with_special): Likewise.
12247         (Symbol_table::override_with_special): If the visibility is hidden
12248         or internal, force the symbol to be local.
12249         * symtab.h (class Symbol): Add set_visibility and
12250         override_visibility.
12251         * testsuite/ver_test_1.sh: New file.
12252         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12253         (check_DATA): Add ver_test_1.syms.
12254         (ver_test_1.syms): New target.
12255         * testsuite/Makefile.in: Rebuild.
12256
12257 2009-02-25  Cary Coutant  <ccoutant@google.com>
12258
12259         * layout.cc (Layout::choose_output_section): Don't rename sections
12260         when using a linker script that has a SECTIONS clause.
12261         * Makefile.in: Regenerate.
12262
12263         * testsuite/Makefile.am (script_test_5.sh): New test case.
12264         * testsuite/Makefile.in: Regenerate.
12265         * testsuite/script_test_5.cc: New file.
12266         * testsuite/script_test_5.sh: New file.
12267         * testsuite/script_test_5.t: New file.
12268
12269 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12270
12271         * archive.cc (Archive::include_member): Update calls to add_symbols.
12272         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12273         the Layout argument.
12274         * dynobj.h (do_add_symbols): Add the Layout argument.
12275         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12276         Layout argument.
12277         * object.h (Object::add_symbols): Add the Layout argument.
12278         (Object::do_add_symbols): Add the Layout argument.
12279         (Sized_relobj::do_add_symbols): Add the Layout argument.
12280         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12281         Unify the two versions.
12282         (Add_plugin_symbols): Remove.
12283         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12284         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12285         (Add_plugin_symbols): Remove.
12286         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12287         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12288         (Add_symbols::run): Make it work with Pulginobj.
12289
12290 2009-02-06  Ian Lance Taylor  <iant@google.com>
12291
12292         * object.cc (Sized_relobj::do_layout): Make info message start
12293         with lower case letter.
12294
12295 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12296
12297         * binary.cc: Fix file comment.
12298
12299         * options.h (enum Incremental_disposition): Define.
12300         (class General_options): Add new options: --incremental,
12301         --incremental_changed, --incremental_unchanged,
12302         --incremental_unknown.  Add incremental_disposition_ and
12303         implicit_incremental_ fields.
12304         (General_options::incremental_disposition): New function.
12305         (class Position_dependent_options): Add incremental_disposition
12306         option.
12307         (Position_dependent_options::copy_from_options): Set incremental
12308         dispositions.
12309         * options.cc (General_options::parse_incremental_changed): New
12310         function.
12311         (General_options::parse_incremental_unchanged): New function.
12312         (General_options::parse_incremental_unknown): New function.
12313         (General_options::General_options): Initialize new fields
12314         incremental_disposition_ and implicit_incremental_.
12315         (General_options::finalize): Check for uasge of --incremental-*
12316         without --incremental.
12317
12318 2009-02-06  Chris Demetriou  <cgd@google.com>
12319
12320         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12321         pointer and to report location as the file name associated with
12322         the symbol.
12323         (gold_undefined_symbol_at_location): New function to replace the
12324         old gold_undefined_symbol functionality.
12325         * target-reloc.h (relocate_section): Update to use
12326         gold_undefined_symbol_at_location.
12327         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12328         Call gold_undefined_symbol function rather than gold_error.
12329         * errors.h (Errors::undefined_symbol): Take location as a
12330         string, rather than calculating it from a relocation.
12331         * errors.cc (Errors::fatal): Print "fatal error:" before the
12332         formatted message.
12333         (Errors::error, Errors::error_at_location): Print "error: "
12334         before the formatted message.
12335         (Errors::undefined_symbol): Take location as a string, rather
12336         than calculating it from a relocation.
12337         (gold_undefined_symbol_at_location): New function akin to
12338         old gold_undefined_symbol, calculates location from relocation.
12339         (gold_undefined_symbol): Change to take only a Symbol pointer
12340         and to report location as the file name associated with the symbol.
12341         * testsuite/debug_msg.sh: Update for changed error messages.
12342         * testsuite/undef_symbol.sh: Likewise.
12343
12344 2009-02-04  Duncan Sands  <baldrick@free.fr>
12345
12346         PR 9812
12347         * reduced_debug_output.h
12348         (Output_reduced_debug_abbrev_section::failed): Use format for
12349         gold_warning.
12350         (Output_reduced_debug_info_section::faild): Likewise.
12351
12352 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12353
12354         * script.cc (Lazy_demangler): New class.
12355         (Version_script_info::get_symbol_version_helper): Demangle a
12356         symbol only once.
12357
12358 2009-01-29  Cary Coutant  <ccoutant@google.com>
12359
12360         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12361         to __tls_get_addr.
12362         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12363
12364 2009-01-28  Ian Lance Taylor  <iant@google.com>
12365
12366         * version.cc (version_string): Bump to 1.9.
12367
12368         * gold.h: Include <cstring> and <stdint.h>.
12369         * version.cc: Include <cstdio>.
12370         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12371         warning.
12372         * reduced_debug_output.cc (insert_into_vector): Rename from
12373         Insert_into_vector; change all callers.  Use Swap_unaligned to
12374         avoid aliasing issue; remove union since it is unnecessary.
12375
12376 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12377
12378         * Makefile.am (CCFILES): Add gc.cc.
12379         (HFILES): Add gc.h.
12380         * Makefile.in: Regenerate.
12381         * gold.cc (Gc_runner): New class.
12382         (queue_initial_tasks): Call garbage collection related tasks
12383         when corresponding options are invoked.
12384         (queue_middle_gc_tasks): New function.
12385         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12386         processed early before laying out sections during garbage collection.
12387         * gold.h (queue_middle_gc_tasks): New function.
12388         (is_prefix_of): Move from "layout.cc".
12389         * i386.cc (Target_i386::gc_process_relocs): New function.
12390         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12391         * main.cc (main): Create object of class "Garbage_collection".
12392         * object.cc (Relobj::copy_symbols_data): New function.
12393         (Relobj::is_section_name_included): New function.
12394         (Sized_relobj::do_layout): Allow this function to be called twice
12395         during garbage collection and defer layout of section during the
12396         first call.
12397         * object.h (Relobj::get_symbols_data): New function.
12398         (Relobj::is_section_name_included): New function.
12399         (Relobj::copy_symbols_data): New function.
12400         (Relobj::set_symbols_data): New function.
12401         (Relobj::get_relocs_data): New function.
12402         (Relobj::set_relocs_data): New function.
12403         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12404         (Relobj::gc_process_relocs): New function.
12405         (Relobj::do_gc_process_relocs): New pure virtual function.
12406         (Relobj::sd_): New data member.
12407         (Sized_relobj::is_output_section_offset_invalid): New function.
12408         (Sized_relobj::do_gc_process_relocs): New function.
12409         * options.h (General_options::gc_sections): Modify to not be a no-op.
12410         (General_options::print_gc_sections): New option.
12411         * plugin.cc (Plugin_finish::run): Remove function call to
12412         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12413         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12414         * reloc.cc (Read_relocs::run): Add task to process relocs and
12415         determine unreferenced sections when doing garbage collection.
12416         (Gc_process_relocs): New class.
12417         (Sized_relobj::do_gc_process_relocs): New function.
12418         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12419         sections that are garbage collected.
12420         * reloc.h (Gc_process_relocs): New class.
12421         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12422         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12423         symbols whose corresponding sections are garbage collected.
12424         (Symbol_table::Symbol_table): Add new parameter for the garbage
12425         collection object.
12426         (Symbol_table::gc_mark_undef_symbols): New function.
12427         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12428         (Symbol_table::gc_mark_dyn_syms): New function.
12429         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12430         as garbage.
12431         (Symbol_table::add_from_object): Likewise.
12432         (Symbol_table::add_from_relobj): When building shared objects, do not
12433         treat externally visible symbols as garbage.
12434         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12435         table information for static and relocatable links.
12436         * symtab.h (Symbol_table::set_gc): New function.
12437         (Symbol_table::gc): New function.
12438         (Symbol_table::gc_mark_undef_symbols): New function.
12439         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12440         (Symbol_table::gc_mark_dyn_syms): New function.
12441         (Symbol_table::gc_): New data member.
12442         * target.h (Sized_target::gc_process_relocs): New pure virtual
12443         function.
12444         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12445         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12446
12447 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12448
12449         * options.h (General_options::gc_sections): Define as a no-op for now.
12450         (General_options::no_keep_memory): Ditto.
12451         (General_options::Bshareable): Define.
12452         * options.cc (General_options::finalize): Honor -Bshareable.
12453
12454 2009-01-20  Andreas Schwab  <schwab@suse.de>
12455
12456         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12457         read the value in the contents, since we don't use it.  Use the
12458         template endianness when writing.
12459         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12460
12461 2009-01-19  Andreas Schwab  <schwab@suse.de>
12462
12463         * configure.tgt (powerpc64-*): Fix targ_obj.
12464
12465 2009-01-15  Ian Lance Taylor  <iant@google.com>
12466
12467         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12468         local symbols when stripping all symbols.
12469
12470 2009-01-14  Cary Coutant  <ccoutant@google.com>
12471
12472         * output.cc (Output_reloc): Add explicit instantiations.
12473
12474 2009-01-14  Cary Coutant  <ccoutant@google.com>
12475
12476         * archive.cc (Archive::get_elf_object_for_member): Remove call
12477         to File_read::claim_for_plugin.
12478         * descriptors.cc (Descriptors::open): Remove reference to
12479         is_claimed.
12480         (Descriptors::claim_for_plugin): Remove.
12481         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12482         (Descriptors::is_claimed): Remove.
12483         (claim_descriptor_for_plugin): Remove.
12484         * fileread.cc (File_read::claim_for_plugin): Remove.
12485         * fileread.h (File_read::claim_for_plugin): Remove.
12486         (File_read::descriptor): Reopen descriptor if necessary.
12487         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12488         (Plugin_manager::all_symbols_read): Add task parameter. Change
12489         all callers.
12490         (Plugin_manager::get_input_file): New function.
12491         (Plugin_manager::release_input_file): New function.
12492         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12493         corresponding data member.
12494         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12495         and pass to base constructor. Change all callers.
12496         (get_input_file, release_input_file): New functions.
12497         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12498         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12499         (Plugin_manager::all_symbols_read): Add task parameter.
12500         (Plugin_manager::get_input_file): New function.
12501         (Plugin_manager::release_input_file): New function.
12502         (Plugin_manager::task_): New data member.
12503         (Pluginobj::Pluginobj): Add filesize parameter.
12504         (Pluginobj::filename): New function.
12505         (Pluginobj::descriptor): New function.
12506         (Pluginobj::filesize): New function.
12507         (Pluginobj::filesize_): New data member.
12508         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12509         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12510         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12511
12512         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12513         with archive libraries.
12514         * testsuite/Makefile.in: Regenerate.
12515         * testsuite/plugin_test.c (struct sym_info): New type.
12516         (get_input_file, release_input_file): New static variables.
12517         (onload): Capture new transfer vector entries.
12518         (claim_file_hook): Stop reading at end of file according to filesize.
12519         Factor out parsing of readelf output into separate function.
12520         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12521         APIs and get the source file name from the symbol table.  Convert
12522         source file name to corresponding object file name.  Print info
12523         message when adding new input files.
12524         (parse_readelf_line): New function.
12525         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12526         * testsuite/plugin_test_2.sh: Likewise.
12527         * testsuite/plugin_test_3.sh: Likewise.
12528         * testsuite/plugin_test_4.sh: New test case.
12529
12530 2009-01-07  Ian Lance Taylor  <iant@google.com>
12531
12532         * version.cc (version_string): Bump to 1.8.
12533
12534 2008-12-23  Cary Coutant  <ccoutant@google.com>
12535
12536         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12537         * plugin.cc (Plugin_manager::finish): Rename as
12538         layout_deferred_objects.  Move cleanup to separate function.
12539         (Plugin_manager::cleanup): New function.
12540         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12541         separately.
12542         * plugin.h (Plugin_manager::finish): Rename as
12543         layout_deferred_objects.
12544         (Plugin_manager::cleanup): New function.
12545         (Plugin_manager::cleanup_done): New field.
12546
12547 2008-12-23  Cary Coutant  <ccoutant@google.com>
12548
12549         * plugin.cc (is_visible_from_outside): New function.
12550         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12551         so we don't return "IR only" status for exported symbols or -r links.
12552
12553         * testsuite/Makefile.am (plugin_test_3): New test case.
12554         * testsuite/Makefile.in: Regenerate.
12555         * testsuite/plugin_test_3.sh: New file.
12556
12557 2008-12-22  Cary Coutant  <ccoutant@google.com>
12558
12559         * object.cc (Sized_relobj::layout_section): New function.
12560         (Sized_relobj::do_layout): Defer layout of input sections until after
12561         plugin has provided replacement files.
12562         (Sized_relobj::do_layout_deferred_sections): New function.
12563         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12564         (Relobj::layout_deferred_sections): New function.
12565         (Relobj::do_layout_deferred_sections): New function.
12566         (Sized_relobj::do_layout_deferred_sections): New function.
12567         (Sized_relobj::layout_section): New function.
12568         (Sized_relobj::Deferred_layout): New structure.
12569         (Sized_relobj::deferred_layout_): New field.
12570         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12571         Change all callers.  Layout deferred sections.
12572         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12573         references.
12574         (Plugin_hook::run): Move code from do_plugin_hook inline.
12575         (Plugin_hook::do_plugin_hook): Remove.
12576         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12577         (Plugin_manager::finish): Renamed, was cleanup.
12578         (Plugin_manager::should_defer_layout): New function.
12579         (Plugin_manager::add_deferred_layout_object): New function.
12580         (Plugin_manager::Deferred_layout_list): New type.
12581         (Plugin_manager::deferred_layout_objects_): New field.
12582         (Plugin_hook::do_plugin_hook): Remove.
12583
12584 2008-12-17  Ian Lance Taylor  <iant@google.com>
12585
12586         * options.h (class General_options): Add --no case for
12587         --export-dynamic.
12588
12589 2008-12-16  Cary Coutant  <ccoutant@google.com>
12590
12591         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12592         vector.
12593         (Plugin_manager::claim_file): Create plugin object even if
12594         plugin did not call the add_symbols callback.
12595         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12596         asking for more symbols than were added.
12597         * testsuite/Makefile.am (plugin_test_1): Add test case with
12598         no global symbols.
12599         (empty.syms): New target.
12600         * testsuite/Makefile.in: Regenerate.
12601         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12602         message. Don't call add_symbols if no globals.
12603         (all_symbols_read_hook): Don't provide replacement for empty
12604         claimed file.
12605
12606 2008-12-12  Ian Lance Taylor  <iant@google.com>
12607
12608         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12609         r_type == 0 for a local symbol with r_sym == 0.
12610         (scan_relocatable_relocs): Pass r_sym to
12611         local_non_section_strategy.
12612         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12613         r_sym parameter.
12614
12615         * configure.ac: Update test for TLS descriptors: they are
12616         supported as of glibc 2.9.
12617         * configure: Rebuild.
12618
12619 2008-12-11  Ian Lance Taylor  <iant@google.com>
12620
12621         PR 7091
12622         * target-reloc.h (Default_scan_relocatable_relocs): For each
12623         function, map r_type == 0 to RELOC_DISCARD.
12624
12625 2008-12-10  Cary Coutant  <ccoutant@google.com>
12626
12627         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12628         object to override a kept COMDAT group from a plugin object.
12629
12630 2008-12-09  Ian Lance Taylor  <iant@google.com>
12631
12632         PR 7088
12633         * yyscript.y (file_cmd): Handle INPUT.
12634
12635         * testsuite/initpri1.c: Change all declarations to be full
12636         prototypes by adding void, to avoid compiler warnings.
12637
12638 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12639
12640         * options.cc (General_options::parse_plugin_opt): New.
12641         (General_options::add_plugin): The argument now is just the filename.
12642         (General_options::add_plugin_option): New.
12643         * options.h (plugin_opt): New.
12644         (add_plugin): Change argument name.
12645         (add_plugin_option): New.
12646         * plugin.cc (Plugin::load): Don't parse the plugin option.
12647         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12648         (Plugin::add_option): New.
12649         (Plugin::args_): Change type.
12650         (Plugin::filename_): New.
12651         (Plugin_manager::add_plugin_option): New.
12652         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12653         * testsuite/Makefile.in: Regenerate.
12654
12655 2008-12-05  Cary Coutant  <ccoutant@google.com>
12656
12657         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12658         Handle --strip-lto-sections option.
12659         * options.h (strip_lto_sections): New option.
12660
12661 2008-12-01  Cary Coutant  <ccoutant@google.com>
12662
12663         * plugin.cc (ld_plugin_message): Change format parameter to const.
12664         Fix mismatch between new[] and delete.
12665
12666 2008-11-14  Cary Coutant  <ccoutant@google.com>
12667
12668         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12669         instead of -1U.
12670
12671 2008-11-05  Craig Silverstein  <csilvers@google.com>
12672
12673         * options.cc (General_options::parse_dynamic_list): New function.
12674         * options.h (General_options): New flags dynamic_list,
12675         dynamic_list_data, dynamic_list_cpp_new, and
12676         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12677         (General_options::in_dynamic_list): New function.
12678         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12679         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12680         (Lex::can_continue_name): Likewise.
12681         (yylex): Likewise.
12682         (read_script_file): New parameter script_options.
12683         (read_dynamic_list): New function.
12684         (Script_options::define_dynamic_list): New function.
12685         (dynamic_list_keyword_parsecodes): New variable.
12686         (dynamic_list_keywords): New variable.
12687         * script.h (Script_options::define_dynamic_list): New function
12688         prototype.
12689         (read_dynamic_list): New function prototype.
12690         * symtab.cc (strprefix): New macro.
12691         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12692         dynamic_list_data, dynamic_list_cpp_new, and
12693         dynamic_list_cpp_typeinfo.
12694         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12695         (dynamic_list_expr): New rule.
12696         (dynamic_list_nodes): Likewise.
12697         (dynamic_list_node): Likewise.
12698         * testsuite/Makefile.am (dynamic_list): New test.
12699         * testsuite/Makefile.in: Regenerated.
12700         * testsuite/dynamic_list.t: New file.
12701         * testsuite/dynamic_list.sh: New file.
12702
12703 2008-11-05  Craig Silverstein  <csilvers@google.com>
12704
12705         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12706         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12707         (t11_last): Likewise.
12708         * testsuite/ver_test_6.c (main): Likewise.
12709
12710 2008-10-07  Cary Coutant  <ccoutant@google.com>
12711
12712         * options.c (General_options::finalize): Add check for -static and
12713         -shared.
12714         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12715         is not empty.
12716
12717 2008-10-02  Cary Coutant  <ccoutant@google.com>
12718
12719         * plugin.cc (make_sized_plugin_object): Fix conditional
12720         compilation to work when not all targets are enabled.
12721
12722 2008-09-29  Cary Coutant  <ccoutant@google.com>
12723
12724         * archive.cc (Archive::get_file_and_offset): Use filename instead
12725         of name to get library path.
12726         (Archive::include_member): Unlock external member of a thin archive.
12727
12728         * testsuite/Makefile.am (TEST_AR): New variable.
12729         (thin_archive_test_1): New test.
12730         (thin_archive_test_2): New test.
12731         * testsuite/Makefile.in: Regenerate.
12732         * testsuite/thin_archive_main.cc: New file.
12733         * testsuite/thin_archive_test_1.cc: New file.
12734         * testsuite/thin_archive_test_2.cc: New file.
12735         * testsuite/thin_archive_test_3.cc: New file.
12736         * testsuite/thin_archive_test_4.cc: New file.
12737
12738 2008-09-29  Cary Coutant  <ccoutant@google.com>
12739
12740         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12741         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12742         instead of -1U.
12743         (Sized_relobj::do_finalize_local_symbols): Likewise.
12744         (Sized_relobj::map_to_kept_section): Likewise.
12745         * object.h (Sized_relobj::invalid_address): New constant.
12746         (Sized_relobj::do_output_section_offset): Check for invalid_address
12747         and return -1ULL.
12748         * output.cc (Output_reloc::local_section_offset): Use constant
12749         invalid_address instead of -1U.
12750         (Output_reloc::get_address): Likewise.
12751         (Output_section::output_address): Change -1U to -1ULL.
12752         * output.h (Output_reloc::invalid_address): New constant.
12753         * reloc.cc (Sized_relobj::write_sections): Use constant
12754         invalid_address instead of -1U.
12755         (Sized_relobj::relocate_sections): Likewise.
12756         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12757         values for merge sections.
12758         * target-reloc.h (relocate_for_relocatable): Use constant
12759         invalid_address instead of -1U.
12760
12761 2008-09-19  Cary Coutant  <ccoutant@google.com>
12762
12763         Add plugin functionality for link-time optimization (LTO).
12764         * configure.ac (plugins): Add --enable-plugins option.
12765         * configure: Regenerate.
12766         * config.in: Regenerate.
12767         * Makefile.am (LIBDL): New variable.
12768         (CCFILES): Add plugin.cc.
12769         (HFILES): Add plugin.h.
12770         (ldadd_var): Add LIBDL.
12771         * Makefile.in: Regenerate.
12772
12773         * archive.cc: Include "plugin.h".
12774         (Archive::setup): Don't preread archive symbols when using a plugin.
12775         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12776         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12777         files.
12778         (Archive::include_member): Add symbols from plugin objects.
12779         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12780         * descriptors.cc (Descriptors::open): Check for file descriptors
12781         abandoned by plugins.
12782         (Descriptors::claim_for_plugin): New function.
12783         * descriptors.h (Descriptors::claim_for_plugin): New function.
12784         (Open_descriptor::is_claimed): New field.
12785         (claim_descriptor_for_plugin): New function.
12786         * fileread.cc (File_read::claim_for_plugin): New function.
12787         * fileread.h (File_read::claim_for_plugin): New function.
12788         (File_read::descriptor): New function.
12789         * gold.cc: Include "plugin.h".
12790         (queue_initial_tasks): Add task to call plugin hooks for generating
12791         new object files.
12792         * main.cc: Include "plugin.h".
12793         (main): Load plugin libraries.
12794         * object.h (Pluginobj): Declare.
12795         (Object::pluginobj): New function.
12796         (Object::do_pluginobj): New function.
12797         (Object::set_target): New function.
12798         * options.cc: Include "plugin.h".
12799         (General_options::parse_plugin): New function.
12800         (General_options::General_options): Initialize plugins_ field.
12801         (General_options::add_plugin): New function.
12802         * options.h (Plugin_manager): Declare.
12803         (General_options): Add --plugin option.
12804         (General_options::has_plugins): New function.
12805         (General_options::plugins): New function.
12806         (General_options::add_plugin): New function.
12807         (General_options::plugins_): New field.
12808         * plugin.cc: New file.
12809         * plugin.h: New file.
12810         * readsyms.cc: Include "plugin.h".
12811         (Read_symbols::do_read_symbols): Check for archive before checking
12812         for ELF file.  Call plugin hooks to claim files.
12813         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12814         from a real object file; force override when processing replacement
12815         files.
12816         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12817         (Symbol::init_base_object): Likewise.
12818         (Symbol::init_base_output_data): Likewise.
12819         (Symbol::init_base_output_segment): Likewise.
12820         (Symbol::init_base_constant): Likewise.
12821         (Symbol::init_base_undefined): Likewise.
12822         (Symbol::output_section): Assert that object is not a plugin.
12823         (Symbol_table::add_from_pluginobj): New function.
12824         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12825         undefined.
12826         (Symbol_table::sized_write_globals): Likewise.
12827         (Symbol_table::add_from_pluginobj): Instantiate template.
12828         * symtab.h (Sized_pluginobj): Declare.
12829         (Symbol::in_real_elf): New function.
12830         (Symbol::set_in_real_elf): New function.
12831         (Symbol::in_real_elf_): New field.
12832         (Symbol_table::add_from_pluginobj): New function.
12833
12834         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12835         (LIBDL): New variable.
12836         (LDADD): Add LIBDL.
12837         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12838         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12839         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12840         (MOSTLYCLEANFILES): Likewise.
12841         * testsuite/Makefile.in: Regenerate.
12842         * testsuite/plugin_test.c: New file.
12843         * testsuite/plugin_test_1.sh: New file.
12844         * testsuite/plugin_test_2.sh: New file.
12845
12846 2008-09-16  Ian Lance Taylor  <iant@google.com>
12847
12848         * target-reloc.h (relocate_section): Check whether a symbol is
12849         defined by the ABI before reporting an undefined symbol error.
12850         * target.h (Target::is_defined_by_abi): Make parameter const.
12851         (Target::do_is_defined_by_abi): Likewise.
12852         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12853         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12854         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12855         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12856         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12857         * testsuite/Makefile.in: Rebuild.
12858
12859         * fileread.cc (make_view): Add casts to avoid warning.
12860
12861 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12862
12863         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12864         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12865
12866 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12867
12868         * options.h (General_options::output_is_executable): New.
12869         (General_options::output_is_pie): New.
12870         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12871         for shared libraries.
12872         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12873
12874 2008-09-11  Chris Demetriou  <cgd@google.com>
12875
12876         * options.h (origin): New -z option.
12877         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12878         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12879         in DT_FLAGS_1.
12880
12881 2008-09-05  Cary Coutant  <ccoutant@google.com>
12882
12883         * fileread.cc (File_read::make_view): Add check for attempt to map
12884         beyond end of file.
12885
12886 2008-09-05  Cary Coutant  <ccoutant@google.com>
12887
12888         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12889         explicit instantiations.
12890
12891 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12892
12893         PR gold/6858
12894         * options.cc (General_options::finalize): Allow undefined symbols
12895         in shlibs if linking -shared.
12896
12897         PR gold/6859
12898         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12899         symbols as not needing a dynsym entry.
12900
12901 2008-08-20  Craig Silverstein  <csilvers@google.com>
12902
12903         * fileread.cc (File_read::open): Do not lock the file unless it
12904         was successfully opened.
12905
12906 2008-08-14  Cary Coutant  <ccoutant@google.com>
12907
12908         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12909         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12910         * testsuite/tls_test.cc (struct int128): 128-bit struct
12911         for testing TLS relocs with non-zero addend.
12912         (v12): New TLS variable.
12913         (t12): New test.
12914         (t_last): Add check for v12.
12915         * testsuite/tls_test.h (t12): New function.
12916         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12917
12918 2008-08-13  Ian Lance Taylor  <iant@google.com>
12919
12920         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12921         set tls_segment_ or relro_segment_.
12922         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12923         when appropriate.
12924         * output.h (Output_section::clear_is_relro): New function.
12925         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12926         sections specially even when output_data_ is empty.
12927         (Output_segment::maximum_alignment): When first section is relro,
12928         only force alignment for PT_LOAD segments.
12929         * script.cc (script_data_segment_align): New function.
12930         (script_data_segment_relro_end): New function.
12931         * script-c.h (script_data_segment_align): Declare.
12932         (script_data_segment_relro_end): Declare.
12933         * script-sections.h (class Script_sections): Declare
12934         data_segment_align and data_segment_relro_end.  Add fields
12935         segment_align_index_ and saw_relro_end_.
12936         * script-sections.cc (class Sections_element): Add set_is_relro
12937         virtual function.  Add new bool* parameter to place_orphan_here.
12938         Add get_output_section virtual function.
12939         (class Output_section_definition): Add set_is_relro.  Add new
12940         bool* parameter to place_orphan_here.  Add get_output_section.
12941         Add is_relro_ field.
12942         (Output_section_definition::Output_section_definition): Initialize
12943         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12944         and is_relro_ fields.
12945         (Output_section_definition::place_orphan_here): Add is_relro
12946         parameter.
12947         (Output_section_definition::set_section_addresses): Set relro for
12948         output section.
12949         (Output_section_definition::alternate_constraint): Likewise.
12950         (class Orphan_output_section): Add new bool* parameter to
12951         place_orphan_here.  Add get_output_section.
12952         (Orphan_output_section::place_orphan_here): Add is_relro
12953         parameter.
12954         (Script_sections::Script_sections): Initialize
12955         data_segment_align_index_ and saw_relro_end_.
12956         (Script_sections::data_segment_align): New function.
12957         (Script_sections::data_segment_relro_end): New function.
12958         (Script_sections::place_orphan): Set or clear is_relro.
12959         (Script_sections::set_section_addresses): Force alignment of first
12960         TLS section.
12961         * yyscript.y (exp): Call script_data_segment_align and
12962         script_data_segment_relro_end.
12963         * testsuite/relro_script_test.t: New file.
12964         * testsuite/relro_test.cc (using_script): Declare.
12965         (t1, t2): Test using_script.
12966         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12967         (relro_script_test_SOURCES): Define.
12968         (relro_script_test_DEPENDENCIES): Define.
12969         (relro_script_test_LDFLAGS): Define.
12970         (relro_script_test_LDADD): Define.
12971         (relro_script_test.so): New target.
12972         * testsuite/Makefile.in: Rebuild.
12973
12974 2008-08-06  Cary Coutant <ccoutant@google.com>
12975
12976         * archive.cc (Archive::total_archives, Archive::total_members)
12977         (Archive::total_members_loaded): New variables.
12978         (Archive::setup): Add parameter.  Add option to preread
12979         archive symbols.
12980         (Archive::read_armap): Add counter.
12981         (Archive::get_file_and_offset): New function.
12982         (Archive::get_elf_object_for_member): New function.
12983         (Archive::read_all_symbols): New function.
12984         (Archive::read_symbols): New function.
12985         (Archive::add_symbols): Add counters.
12986         (Archive::include_all_members): Use armap to find members if it's
12987         already built.
12988         (Archive::include_member): Skip reading symbols if already read.
12989         Factored code into Archive::get_file_and_offset and
12990         Archive::get_elf_object_for_member.  Changed call to
12991         Mapfile::report_include_archive_member.
12992         (Archive::print_stats): New function.
12993         * archive.h: Declare Object and Read_symbols_data classes.
12994         (Archive::Archive): Add initializers for new members.
12995         (Archive::setup): Add parameter.
12996         (Archive::print_stats): New function.
12997         (Archive::total_archives, Archive::total_members)
12998         (Archive::total_members_loaded): New variables.
12999         (Archive::get_file_and_offset): New function.
13000         (Archive::get_elf_object_for_member): New function.
13001         (Archive::read_all_symbols): New function.
13002         (Archive::read_symbols): New function.
13003         (Archive::Archive_member): New class.
13004         (Archive::members_): New member.
13005         (Archive::num_members_): New member.
13006         * main.cc: Include archive.h.
13007         (main): Call Archive::print_stats.
13008         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13009         archive parameter; member_name is now the fully-decorated name.
13010         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13011         * options.h: (General_options): Add --preread-archive-symbols option.
13012         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13013         Archive::setup.
13014
13015 2008-08-04  Ian Lance Taylor  <iant@google.com>
13016
13017         * symtab.h (Symbol::use_plt_offset): New function.
13018         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13019         * powerpc.cc (Relocate::relocate): Likewise.
13020         * sparc.cc (Relocate::relocate): Likewise.
13021         * x86_64.cc (Relocate::relocate): Likewise.
13022         * testsuite/weak_plt.sh: New test.
13023         * testsuite/weak_plt_main.cc: New test.
13024         * testsuite/weak_plt_shared.cc: New test.
13025         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13026         (check_PROGRAMS): Add weak_plt.
13027         (check_DATA): Add weak_plt_shared.so.
13028         (weak_plt_main_pic.o, weak_plt): New targets.
13029         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13030         * testsuite/Makefile.in: Rebuild.
13031
13032         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13033         gcctestdir/ld.
13034         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13035         * testsuite/Makefile.in: Rebuild.
13036
13037 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13038
13039         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13040         * Makefile.in: Regenerate.
13041         * po/POTFILES.in: Regenerate.
13042
13043 2008-07-29  Ian Lance Taylor  <iant@google.com>
13044
13045         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13046         symbols before other symbols.
13047         * testsuite/script_test_2.cc (test_addr): Declare.
13048         (test_addr_alias): Declare.
13049         (main): Check that test_addr and test_addr_alias have the right
13050         values.
13051         * testsuite/script_test_2.t: Define test_addr_alias and
13052         test_addr.
13053
13054 2008-07-24  Ian Lance Taylor  <iant@google.com>
13055
13056         PR 5990
13057         * descriptors.cc: New file.
13058         * descriptors.h: New file.
13059         * gold-threads.h (class Hold_optional_lock): New class.
13060         * fileread.cc: Include "descriptors.h".
13061         (File_read::~File_read): Release descriptor rather than closing
13062         it.
13063         (File_read::open) [file]: Call open_descriptor rather than open.
13064         Set is_descriptor_opened_.
13065         (File_read::open) [memory]: Assert that descriptor is not open.
13066         (File_read::reopen_descriptor): New function.
13067         (File_read::release): Release descriptor.
13068         (File_read::do_read): Make non-const.  Reopen descriptor.
13069         (File_read::read): Make non-const.
13070         (File_read::make_view): Reopen descriptor.
13071         (File_read::do_readv): Likewise.
13072         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13073         Update declarations.
13074         * layout.cc: Include "descriptors.h".
13075         (Layout::create_build_id): Use open_descriptor rather than open.
13076         * output.cc: Include "descriptors.h".
13077         (Output_file::open): Use open_descriptor rather than open.
13078         * archive.cc (Archive::const_iterator): Change Archive to be
13079         non-const.
13080         (Archive::begin, Archive::end): Make non-const.
13081         (Archive::count_members): Likewise.
13082         * archive.h (class Archive): Update declarations.
13083         * object.h (Object::read): Make non-const.
13084         * Makefile.am (CCFILES): Add descriptors.cc.
13085         (HFILES): Add descriptors.h.
13086         * Makefile.in: Rebuild.
13087
13088         PR 6716
13089         * gold.h: Always include <clocale>.  Add Solaris workarounds
13090         following code in binutils/sysdep.h.
13091
13092         PR 6048
13093         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13094         this->eh_frame_hdr_ is NULL before using it.
13095
13096         * dynobj.cc (Versions::Versions): Update comment.
13097
13098         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13099         the base version name.
13100
13101         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13102         array size plus one.
13103         (Stringpool_template::set_string_offsets): Subtract one from key
13104         before using it as an array index.
13105         (Stringpool_template::get_offset_with_length): Likewise.
13106         (Stringpool_template::write_to_buffer): Likewise.
13107         * stringpool.h (Stringpool_template::get_offset_from_key):
13108         Likewise.
13109
13110 2008-07-23  Ian Lance Taylor  <iant@google.com>
13111
13112         PR 6658
13113         * object.h (Merged_symbol_value::value): Do our best to handle a
13114         negative addend.
13115
13116         PR 6647
13117         * script.cc (Version_script_info::get_versions): Don't add empty
13118         version tag to return value.
13119         (Version_script_info::get_symbol_version_helper): Change return
13120         type to bool.  Add pversion parameter.  Change all callers.
13121         (script_register_vers_node): Don't require a non-NULL tag.
13122         * script.h (class Version_script_info): Update declarations.
13123         (Version_script_info::get_symbol_version): Change return type to
13124         bool.  Add version parameter.  Change all callers.
13125         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13126         handling.  Handle an empty version from a version script.
13127         (Symbol_table::define_special_symbol): Likewise.
13128         * testsuite/ver_test_10.script: New file.
13129         * testsuite/ver_test_10.sh: New file.
13130         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13131         (check_DATA): Add ver_test_10.syms.
13132         (ver_test_10.syms, ver_test_10.so): New target.
13133         * testsuite/Makefile.in: Rebuild.
13134
13135 2008-07-23  Simon Baldwin  <simonb@google.com>
13136
13137         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13138         to zero for undefined symbols from dynamic libraries.
13139
13140 2008-07-23  Ian Lance Taylor  <iant@google.com>
13141
13142         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13143         Change all callers.
13144         * symtab.h (class Symbol_table): Update declaration.
13145         * testsuite/ver_test_9.cc: New file.
13146         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13147         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13148         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13149         (ver_test_9.so, ver_test_9.o): New targets.
13150         * testsuite/Makefile.in: Rebuild.
13151
13152 2008-07-22  Ian Lance Taylor  <iant@google.com>
13153
13154         * options.h (class General_options): Define --check-sections.
13155         * layout.cc (Layout::set_segment_offsets): Handle
13156         --check-sections.
13157
13158         * options.h (class General_options): Define -n/--nmagic and
13159         -N/--omagic.
13160         * options.cc (General_options::finalize): For -n/--nmagic or
13161         -N/--omagic, set -static.
13162         * layout.cc (Layout::attach_allocated_section_to_segment): If
13163         -N/--omagic, don't put read-only and read-write sections in
13164         different segments.
13165         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13166         finding a read-only segment.
13167         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13168         don't set the minimum segment alignment to the common page size,
13169         and don't set the file offset to the address modulo the page size.
13170         * script-sections.cc (Script_sections::create_segments): If
13171         -n/--omagic, don't put read-only and read-write sections in
13172         different segments.
13173
13174         * cref.cc: New file.
13175         * cref.h: New file.
13176         * options.h (class General_options): Add --print-symbol-counts.
13177         * main.cc (main): Issue defined symbol report if requested.
13178         * archive.cc (Archive::interpret_header): Make into a const member
13179         function.
13180         (Archive::add_symbols): Call Input_objects::archive_start and
13181         archive_stop.
13182         (Archive::const_iterator): Define new class.
13183         (Archive::begin, Archive::end): New functions.
13184         (Archive::include_all_members): Rewrite to use iterator.
13185         (Archive::count_members): New function.
13186         * archive.h (class Archive): Update declarations.
13187         (Archive::filename): New function.
13188         * object.cc: Include "cref.h".
13189         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13190         (Sized_relobj::do_get_global_symbol_counts): New function.
13191         (Input_objects::add_object): Add object to cross-referencer.
13192         (Input_objects::archive_start): New function.
13193         (Input_objects::archive_stop): New function.
13194         (Input_objects::print_symbol_counts): New function.
13195         * object.h: Declare Cref and Archive.
13196         (Object::get_global_symbol_counts): New function.
13197         (Object::do_get_global_symbol_counts): New pure virtual function.
13198         (class Sized_relobj): Add defined_count_ field.  Update
13199         declarations.
13200         (class Input_objects): Add cref_ field.  Update constructor.
13201         Update declarations.
13202         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13203         defined_count_.
13204         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13205         symbol counts.
13206         (Sized_dynobj::do_get_global_symbol_counts): New function.
13207         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13208         defined_count_.  Update declarations.  Define Symbols typedef.
13209         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13210         parameter.  Change all callers.
13211         (Symbol_table::add_from_dynobj): Add sympointers and defined
13212         parameters.  Change all callers.
13213         * symtab.h (class Symbol_table): Update declarations.
13214         * Makefile.am (CCFILES): Add cref.cc.
13215         (HFILES): Add cref.h.
13216         * Makefile.in: Rebuild.
13217
13218 2008-07-22  Simon Baldwin  <simonb@google.com>
13219
13220         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13221         to zero when writing undefined symbols.
13222
13223 2008-07-22  Ian Lance Taylor  <iant@google.com>
13224
13225         * output.cc (Output_section::add_input_section): Don't try to
13226         merge empty merge sections.
13227
13228 2008-07-21  Craig Silverstein  <csilvers@google.com>
13229
13230         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13231         Include symbol version in error message.
13232
13233 2008-07-20  Chris Demetriou  <cgd@google.com>
13234
13235         * configure.ac (gold_cv_c_random_seed): New configured variable.
13236         (RANDOM_SEED_CFLAGS): New substituted variable.
13237         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13238         * configure: Rebuild.
13239         * Makefile.in: Likewise.
13240         * testsuite/Makefile.in: Likewise.
13241
13242 2008-07-18  Ian Lance Taylor  <iant@google.com>
13243
13244         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13245         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13246         * testsuite/ver_test_main.cc (main): Call t4.
13247         (t4, t4_2a): Define.
13248         * testsuite/ver_test_2.cc (t4_2): Define.
13249         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13250         * testsuite/ver_test_4.cc (t4_2a): Define.
13251         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13252         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13253
13254 2008-07-17  Ian Lance Taylor  <iant@google.com>
13255
13256         * dynobj.cc (Versions::add_def): If we give an error about a
13257         missing version, go ahead and create the version anyhow.
13258
13259 2008-07-10  Ian Lance Taylor  <iant@google.com>
13260
13261         Handle output sections with more than 0x7fffffff bytes.
13262         * object.h (class Relobj): Change map_to_output_ to
13263         output_sections_, and just keep a section pointer.  Change all
13264         uses.  Move comdat group support to Sized_relobj.
13265         (Relobj::is_section_specially_mapped): Remove.
13266         (Relobj::output_section): Remove poff parameter.  Change all
13267         callers.
13268         (Relobj::output_section_offset): New function.
13269         (Relobj::set_section_offset): Rewrite.
13270         (Relobj::map_to_output): Remove.
13271         (Relobj::output_sections): New function.
13272         (Relobj::do_output_section_offset): New pure virtual function.
13273         (Relobj::do_set_section_offset): Likewise.
13274         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13275         group support from Relobj.  Update declarations.
13276         (Sized_relobj::get_output_section_offset): New function.
13277         (Sized_relobj::do_output_section_offset): New function.
13278         (Sized_relobj::do_set_section_offset): New function.
13279         * object.cc (Relobj::output_section_address): Remove.
13280         (Sized_relobj::Sized_relobj): Initialize new fields.
13281         (Sized_relobj::include_section_group): Cast find_kept_object to
13282         Sized_relobj.
13283         (Sized_relobj::include_linkonce_section): Likewise.
13284         (Sized_relobj::do_layout): Use separate arrays for output section
13285         and output offset.
13286         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13287         output_sections.
13288         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13289         output_sections and section_offsets.
13290         (Sized_relobj::write_local_symbols): Likewise.
13291         (map_to_kept_section): Compute output address directly.
13292         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13293         output_sections and section_offsets.
13294         (Sized_relobj::write_sections): Likewise.
13295         (Sized_relobj::relocate_sections): Likewise.
13296         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13297         * output.h (class Output_reloc): Update declarations.  Change
13298         u2_.relobj to Sized_relobj*.
13299         (class Output_data_reloc): Change add functions to use
13300         Sized_relobj*.
13301         * output.cc (Output_reloc::Output_reloc): Change relobj to
13302         Sized_relobj*.
13303         (Output_reloc::local_section_offset): Change return type to
13304         Elf_Addr.  Use get_output_section_offset.
13305         (Output_reloc::get_address): Likewise.
13306         (Output_section::is_input_address_mapped): Don't call
13307         is_section_specially_mapped.
13308         (Output_section::output_offset): Likewise.
13309         (Output_section::output_address): Likewise.
13310         (Output_section::starting_output_address): Likewise.
13311         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13312         parameter to Sized_relobj*.
13313         (Copy_relocs::need_copy_reloc): Likewise.
13314         (Copy_relocs::save): Likewise.
13315         * copy-relocs.h (class Copy_relocs): Update declarations.
13316         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13317         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13318         * target-reloc.h (relocate_for_relocatable): Change
13319         offset_in_output_section type to Elf_Addr.  Change code that uses
13320         it as well.
13321         * layout.cc (Layout::layout): Always set *off.
13322         * mapfile.cc (Mapfile::print_input_section): Use
13323         output_section_offset.
13324         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13325         Sized_relobj*.
13326         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13327         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13328         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13329
13330 2008-07-03  Ian Lance Taylor  <iant@google.com>
13331
13332         * layout.cc (Layout::include_section): Do not discard unrecognized
13333         SHT_STRTAB sections.
13334
13335 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13336
13337         * script.cc (Lex::can_continue_name): Make '?' allowable in
13338         version-script names.
13339         * testsuite/version_script.map: Change glob pattern to use '?'
13340
13341 2008-06-30  Manish Singh  <yosh@gimp.org>
13342
13343         PR 6585
13344         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13345         Correct typo.
13346
13347 2008-06-30  Ian Lance Taylor  <iant@google.com>
13348
13349         PR 6660
13350         PR 6682
13351         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13352         versions]: Don't try to read the value in the contents, since we
13353         don't use it.  Use the template endianness when writing.
13354
13355 2008-06-25  Cary Coutant  <ccoutant@google.com>
13356
13357         * fileread.cc (File_read::make_view): Assert on zero-length view.
13358         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13359         symbol table when there are no symbols to read.
13360
13361 2008-06-23  Craig Silverstein  <csilvers@google.com>
13362
13363         * version.cc (version_string): Bump to 1.7
13364
13365 2008-06-18  Craig Silverstein  <csilvers@google.com>
13366
13367         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13368         constant 0xFFFF to type Valtype.
13369         (Powerpc_relocate_functions::rel16_ha): Likewise.
13370
13371 2008-06-17  Ian Lance Taylor  <iant@google.com>
13372
13373         * output.h (Output_section::Input_section): Initialize p2align_ to
13374         zero for Output_section_data constructors.
13375         (Output_section::Input_section::addralign): If not an input
13376         section, return the alignment of the Output_section_data.
13377         * testsuite/copy_test.cc: New file.
13378         * testsuite/copy_test_1.cc: New file.
13379         * testsuite/copy_test_2.cc: New file.
13380         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13381         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13382         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13383         (copy_test_1_pic.o, copy_test_1.so): New targets.
13384         (copy_test_2_pic.o, copy_test_2.so): New targets.
13385         * testsuite/Makefile.in: Rebuild.
13386
13387         * script-sections.cc (Script_sections::place_orphan): Initialize
13388         local variable exact.
13389
13390 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13391
13392         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13393
13394 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13395             David S. Miller  <davem@davemloft.net>
13396
13397         * powerpc.cc: New file.
13398         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13399         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13400         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13401         * Makefile.in: Rebuild.
13402
13403 2008-06-09  Ian Lance Taylor  <iant@google.com>
13404
13405         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13406         <exception>.
13407         (throwing, orig_terminate): New static variables.
13408         (terminate_handler): New static function.
13409         (t2): Set terminate handler.
13410
13411 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13412
13413         PR 6584
13414         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13415         alignment.
13416
13417 2008-05-30  Cary Coutant  <ccoutant@google.com>
13418
13419         * archive.cc (Archive::include_all_members) Correct to step
13420         over symbol table and extended name table in thin archives.
13421
13422 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13423
13424         PR 6407
13425         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13426         calculation.
13427
13428 2008-05-28  Caleb Howe  <cshowe@google.com>
13429
13430         * reduced_debug_output.cc: New file.
13431         * reduced_debug_output.h: New file.
13432         * options.h (class General_options): Add --strip-debug-non-line.
13433         * options.cc (General_options::finalize): Add strip_debug_non_line
13434         to the strip heirarchy.
13435         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13436         fields.
13437         * layout.cc: Include "reduced_debug_output.h".
13438         (Layout::Layout): Initialize new fields.
13439         (line_only_debug_sections): New static array.
13440         (is_lines_only_debug_sections): New static inline function.
13441         (Layout::include_section): Handle --strip-debug-non-line.
13442         (Layout::make_output_section): If --strip-debug-non-line, build
13443         new output sections for .debug_abbrev and .debug_info.
13444         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13445         gold.  Warn about possible overflow.
13446         (read_signed_LEB_128): Likewise.
13447         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13448         (read_signed_LEB_128): Declare.
13449         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13450         (HFILES): Add reduced_debug_output.h.
13451         * Makefile.in: Rebuild.
13452
13453 2008-05-21  Ian Lance Taylor  <iant@google.com>
13454
13455         * mapfile.cc: New file.
13456         * mapfile.h: New file.
13457         * options.h (class General_options): Add -M/--print-map and -Map.
13458         * options.cc (General_options::finalize): Make -M equivalent to
13459         -Map -.
13460         * main.cc: Include <cstdio> and "mapfile.h".
13461         (main): Open mapfile if requested.
13462         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13463         constructor.  Change caller.
13464         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13465         (queue_middle_tasks): Likewise.
13466         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13467         declarations.
13468         * archive.cc: Include "mapfile.h".
13469         (Archive::add_symbols): Add mapfile parameter.  Change all
13470         callers.  Pass mapfile, symbol, and reason to include_member.
13471         (Archive::include_all_members): Add mapfile parameter.  Change all
13472         callers.
13473         (Archive::include_member): Add mapfile, sym, and why parameters.
13474         Change all callers.  Report inclusion to map file.
13475         * archive.h: Include "fileread.h".
13476         (class Archive): Update declarations.
13477         (Archive::file): New const method.
13478         (class Add_archive_symbols): Add mapfile_ field.  Update
13479         constructor.  Change all callers.
13480         * readsyms.h (class Read_symbols): Likewise.
13481         (class Finish_group): Likewise.
13482         (class Read_script): Likewise.
13483         * common.cc: Include "mapfile.h".
13484         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13485         all callers.
13486         (Symbol_table::do_allocate_commons): Likewise.
13487         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13488         symbol allocation to mapfile.
13489         * common.h (class Allocate_commons_task): Add mapfile_ field.
13490         Update constructor.  Change all callers.
13491         * symtab.h (class Symbol_table): Update declarations.
13492         * layout.cc: Include "mapfile.h".
13493         (Layout_task_runner::run): Print information to mapfile.
13494         (Layout::create_gold_note): Change Output_data_fixed_space to
13495         Output_data_zero_fill.
13496         (Layout::create_build_id): Likewise.
13497         (Layout::print_to_mapfile): New function.
13498         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13499         constructor.  Change caller.
13500         (class Layout): Declare print_to_mapfile.
13501         * output.cc (Output_section::Input_section::print_to_mapfile): New
13502         function.
13503         (Output_section::add_input_section): If producing a map, always
13504         add to input_sections_ list.
13505         (Output_section::do_print_to_mapfile): New function.
13506         (Output_segment::print_sections_to_mapfile): New function.
13507         (Output_segment::print_section_list_to_mapfile): New function.
13508         * output.h: Include "mapfile.h".
13509         (Output_data::print_to_mapfile): New function.
13510         (Output_data::do_print_to_mapfile): New virtual function.
13511         (Output_segment_headers::do_print_to_mapfile): New function.
13512         (Output_file_header::do_print_to_mapfile): New function.
13513         (Output_data_const::do_print_to_mapfile): New function.
13514         (class Output_data_const_buffer): Add map_name_ field.  Update
13515         constructor.  Change all callers.  Add do_print_to_mapfile
13516         function.
13517         (class Output_data_fixed_space): Likewise.
13518         (class Output_data_space): Likewise.
13519         (class Output_data_zero_fill): New class.
13520         (Output_data_strtab::do_print_to_mapfile): New function.
13521         (Output_data_reloc_base::do_print_to_mapfile): New function.
13522         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13523         (Output_data_group::do_print_to_mapfile): New function.
13524         (Output_data_got::do_print_to_mapfile): New function.
13525         (Output_data_dynamic::do_print_to_mapfile): New function.
13526         (Output_symtab_xindex::do_print_to_mapfile): New function.
13527         (class Output_section): Declare do_print_to_mapflie.  Declare
13528         print_to_mapfile in Input_section.
13529         (class Output_segment): Declare new functions.
13530         * object.h (Sized_relobj::symbol_count): New function.
13531         * script-sections.cc
13532         (Output_section_element_dot_assignment::set_section_addresses):
13533         Change Output_data_fixed_space to Output_data_zero_fill.
13534         (Output_data_expression::do_print_to_mapfile): New function.
13535         * script.cc (read_input_script): Add mapfile parameter.  Change
13536         all callers.
13537         * script.h (read_input_script): Update declaration.
13538         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13539         (Eh_frame::do_print_to_mapfile): New function.
13540         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13541         (Output_merge_string::do_print_to_mapfile): New function.
13542         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13543         function.
13544         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13545         function.
13546         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13547         function.
13548         * Makefile.am (CCFILES): Add mapfile.cc.
13549         (HFILES): Add mapfile.h.
13550         * Makefile.in: Rebuild.
13551
13552 2008-05-19  Ian Lance Taylor  <iant@google.com>
13553
13554         * options.h (class General_options): Add -z relro.
13555         * layout.cc (Layout::Layout): Initialize relro_segment_.
13556         (Layout::add_output_section_data): Return the output section.
13557         (Layout::make_output_section): Rcognize relro sections and mark
13558         them appropriately.
13559         (Layout::attach_allocated_section_to_segment): Put relro sections
13560         in a PT_GNU_RELRO segment.
13561         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13562         section as relro.
13563         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13564         PT_TLS segments.
13565         (Layout::linkonce_mapping): Map d.rel.ro.local to
13566         .data.rel.ro.local.
13567         (Layout::output_section_name): Us .data.rel.ro.local for any
13568         section which begins with that.
13569         * layout.h (class Layout): Update add_output_section_data
13570         declaration.  Add relro_segment_ field.
13571         * output.cc (Output_section::Output_section): Initialize is_relro_
13572         and is_relro_local_ fields.
13573         (Output_segment::add_output_section): Group relro sections.
13574         (Output_segment::is_first_section_relro): New function.
13575         (Output_segment::maximum_alignment): If there is a relro section,
13576         align the segment to the common page size.
13577         (Output_segment::set_section_addresses): Track whether we are
13578         looking at relro sections.  If the last section is a relro
13579         section, align to the common page size.
13580         (Output_segment::set_section_list_addresses): Add in_relro
13581         parameter.  Change all callers.  Align to the page size when
13582         moving from relro to non-relro section.
13583         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13584         segment.
13585         * output.h (class Output_section): Add is_relro_ and
13586         is_relro_local_ fields.
13587         (Output_section::is_relro): New function.
13588         (Output_section::set_is_relro): New function.
13589         (Output_section::is_relro_local): New function.
13590         (Output_section::set_is_relro_local): New function.
13591         (class Output_segment): Update declarations.
13592         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13593         * sparc.cc (Target_sparc::got_section): Likewise.
13594         * x86_64.cc (Target_x86_64::got_section): Likewise.
13595         * testsuite/relro_test_main.cc: New file.
13596         * testsuite/relro_test.cc: New file.
13597         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13598         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13599         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13600         (relro_test.so, relro_test_pic.o): New targets.
13601         * testsuite/Makefile.in: Rebuild.
13602
13603 2008-05-16  Ian Lance Taylor  <iant@google.com>
13604
13605         * output.cc (Output_segment::add_output_section): Remove front
13606         parameter.
13607         * output.h (class Output_segment): Remove
13608         add_initial_output_section and overloaded add_output_section.
13609         Update declaration of remaining add_output_section.
13610         * layout.cc (Layout::create_interp): Call add_output_section
13611         rather than add_initial_output_section.
13612         (Layout::finish_dynamic_section): Likewise.
13613
13614         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13615         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13616         know the dynamic type.
13617         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13618         field.  Initialize it in constructor.
13619         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13620         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13621         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13622         reloc.
13623
13624         * output.cc (Output_reloc::get_address): Change return type to
13625         Elf_Addr.
13626         * output.h (class Output_reloc): Update get_address declaration.
13627         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13628         for section addresses.
13629
13630 2008-05-09  Ian Lance Taylor  <iant@google.com>
13631
13632         PR 6493
13633         * gold.cc (gold_nomem): Use return value of write.
13634
13635 2008-05-08  Ian Lance Taylor  <iant@google.com>
13636
13637         * symtab.c (Symbol::init_base_output_data): Add version
13638         parameter.  Change all callers.
13639         (Symbol::init_base_output_segment): Likewise.
13640         (Symbol::init_base_constant): Likewise.
13641         (Symbol::init_base_undefined): Likewise.
13642         (Sized_symbol::init_output_data): Likewise.
13643         (Sized_symbol::init_output_segment): Likewise.
13644         (Sized_symbol::init_constant): Likewise.
13645         (Sized_symbol::init_undefined): Likewise.
13646         (Symbol_table::do_define_in_output_data): If the new symbol has a
13647         version, mark it as the default.
13648         (Symbol_table::do_define_in_output_segment): Likewise.
13649         (Symbol_table::do_define_as_constant): Likewise.
13650         * symtab.h (class Symbol): Update declarations.
13651         (class Sized_symbol): Likewise.
13652         * resolve.cc (Symbol::override_version): New function.
13653         (Symbol::override_base): Call override_version.
13654         (Symbol::override_base_with_special): Likewise.
13655         * testsuite/ver_script_8.script: New file.
13656         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13657         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13658         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13659         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13660
13661 2008-05-06  Ian Lance Taylor  <iant@google.com>
13662
13663         PR 6049
13664         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13665         functions.
13666         (class General_options): Remove existing --undefined, and add
13667         --no-undefined instead.  Add new --undefined as synonym for -u.
13668         * archive.cc (Archive::add_symbols): Check whether symbol was
13669         named with -u.
13670         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13671         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13672         all uses.  Add IS_UNDEFINED.  Update declarations to split
13673         different versions of init_base.  Declare init_base_undefined.
13674         (Symbol::is_defined): Handle IS_UNDEFINED.
13675         (Symbol::is_undefined): Likewise.
13676         (Symbol::is_weak_undefined): Call is_undefined.
13677         (Symbol::is_absolute): Handle IS_CONSTANT.
13678         (class Sized_symbol): Update declarations to split different
13679         versions of init.  Declare init_undefined.
13680         (class Symbol_table): Declare new functions.
13681         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13682         Change all callers.
13683         (Symbol::init_base_output_data): Likewise.
13684         (Symbol::init_base_output_segment): Likewise.
13685         (Symbol::init_base_constant): Likewise.
13686         (Symbol::init_base_undefined): New function.
13687         (Sized_symbol::init_object): Rename from init.  Change all
13688         callers.
13689         (Sized_symbol::init_output_data): Likewise.
13690         (Sized_symbol::init_output_segment): Likewise.
13691         (Sized_symbol::init_constant): Likewise.
13692         (Sized_symbol::init_undefined): New function.
13693         (Symbol_table::add_undefined_symbols_from_command_line): New
13694         function.
13695         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13696         function.
13697         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13698         (Symbol::output_section): Likewise.
13699         (Symbol::set_output_section): Likewise.
13700         (Symbol_table::sized_finalize_symbol): Likewise.
13701         (Symbol_table::sized_write_globals): Likewise.
13702         * resolve.cc (Symbol_table::should_override): Likewise.
13703         (Symbol::override_base_with_special): Likewise.
13704
13705         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13706         symbol, change it to have default visibility.
13707         * testsuite/protected_1.cc: New file.
13708         * testsuite/protected_2.cc: New file.
13709         * testsuite/protected_3.cc: New file.
13710         * testsuite/protected_main_1.cc: New file.
13711         * testsuite/protected_main_2.cc: New file.
13712         * testsuite/protected_main_3.cc: New file.
13713         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13714         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13715         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13716         (protected_1.so): New target.
13717         (protected_1_pic.o, protected_2_pic.o): New targets.
13718         (protected_3_pic.o): New target.
13719         (check_PROGRAMS): Add protected_2.
13720         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13721         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13722         * testsuite/Makefile.in: Rebuild.
13723
13724         * options.h (DEFINE_var): Add set_user_set_##varname__.
13725         (DEFINE_bool_alias): New macro.
13726         (class General_options): Define -Bstatic using DEFINE_bool_alias
13727         rather than DEFINE_special.  Add --undefined as an alias for -z
13728         defs.
13729         * options.cc (General_options::parse_Bstatic): Remove.
13730
13731         * options.h (class General_options): Add --fatal-warnings.
13732         * main.cc (main): Implement --fatal-warnings.
13733         * errors.h (Errors::warning_count): New function.
13734
13735         * options.h (class General_options): Add -Bsymbolic-functions.
13736         * symtab.h (Symbol::is_preemptible): Check for
13737         -Bsymbolic-functions.
13738
13739 2008-05-05  Ian Lance Taylor  <iant@google.com>
13740
13741         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13742         as noVARNAME rather than no-VARNAME.
13743         (class General_options): Add option -z combreloc.
13744         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13745         get_address.
13746         (Output_reloc::sort_before) [SHT_REL]: New function.
13747         (Output_reloc::sort_before) [SHT_RELA]: New function.
13748         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13749         Sort_relocs_comparison.
13750         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13751         parameter.  Change all callers.
13752         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13753         sort_relocs parameter.  Change all callers.
13754         * output.cc (Output_reloc::get_address): New function, broken out
13755         of write_rel.
13756         (Output_reloc::write_rel): Call it.
13757         (Output_reloc::compare): New function.
13758         (Output_data_reloc_base::do_write): Optionally sort relocs.
13759
13760         * configure.ac: If targ_extra_obj is set, link it in.
13761         * configure.tgt: Initialize all variables.
13762         (x86_64*): Set targ_extra_obj and targ_extra_size.
13763         * configure: Rebuild.
13764
13765         * object.cc (Sized_relobj::include_section_group): Adjust section
13766         indexes read from group data.  Build vector to pass to
13767         layout_group.
13768         * layout.cc (Layout::layout_group): Add flags and shndxes
13769         parameters.  Remove contents parameter.  Change caller.  Update
13770         explicit instantiations.
13771         * layout.h (class Layout): Update layout_group declaration.
13772         * output.cc (Output_data_group::Output_data_group): Add flags and
13773         input_shndxes parameters.  Remove contents parameter.  Change
13774         caller.
13775         (Output_data_group::do_write): Change input_sections_ to
13776         input_shndxes_.
13777         * output.h (class Output_data_group): Update constructor
13778         declaration.  Rename input_sections_ to input_shndxes_.
13779         * testsuite/many_sections_test.cc: Add template.
13780
13781 2008-04-30  Cary Coutant  <ccoutant@google.com>
13782
13783         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13784
13785         * layout.cc (Layout::include_section): Refactored check for debug
13786         info section.
13787         (Layout::add_comdat): Add new parameters.  Change type
13788         of signature parameter.  Add object and shndx to signatures table.
13789         (Layout::find_kept_object): New function.
13790         * layout.h: Include <cstring>.
13791         (Layout::is_debug_info_section): New function.
13792         (Layout::add_comdat): Add new parameters.
13793         (Layout::find_kept_object): New function.
13794         (Layout::Kept_section): New struct.
13795         (Layout::Signatures): Change type of map range.
13796         * object.cc (Relobj::output_section_address): New function.
13797         (Sized_relobj::include_section_group): Add new parameters.  Change
13798         calls to Layout::add_comdat.  Change to build table of kept comdat
13799         groups and table mapping discarded sections to kept sections.
13800         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13801         (Sized_relobj::do_layout): Change calls to include_section_group and
13802         include_linkonce_section.
13803         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13804         value to zero when section is discarded.
13805         (Sized_relobj::map_to_kept_section): New function.
13806         * object.h (Relobj::output_section_address): New function.
13807         (Relobj::Comdat_group): New type.
13808         (Relobj::find_comdat_group): New function.
13809         (Relobj::Comdat_group_table): New type.
13810         (Relobj::Kept_comdat_section): New type.
13811         (Relobj::Kept_comdat_section_table): New type.
13812         (Relobj::add_comdat_group): New function.
13813         (Relobj::set_kept_comdat_section): New function.
13814         (Relobj::get_kept_comdat_section): New function.
13815         (Relobj::comdat_groups_): New field.
13816         (Relobj::kept_comdat_sections_): New field.
13817         (Symbol_value::input_value): Update comment.
13818         (Sized_relobj::map_to_kept_section) New function.
13819         (Sized_relobj::include_linkonce_section): Add new parameter.
13820         * target-reloc.h (Comdat_behavior): New type.
13821         (get_comdat_behavior): New function.
13822         (relocate_section): Add code to map a discarded section to the
13823         corresponding kept section when applying a relocation.
13824
13825 2008-04-30  Craig Silverstein  <csilvers@google.com>
13826
13827         * dwarf_reader.cc (next_generation_count): New static var.
13828         (Addr2line_cache_entry): New struct.
13829         (addr2line_cache): New static var.
13830         (Dwarf_line_info::one_addr2line): Added caching.
13831         (Dwarf_line_info::clear_addr2line_cache): New function.
13832         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13833         cache-size parameter.
13834         (Dwarf_line_info::one_addr2line_cache): New function.
13835         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13836         new cache-size argument to one_addr2line(), and clear cache.
13837
13838 2008-04-28  Cary Coutant  <ccoutant@google.com>
13839
13840         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13841         R_386_PC8 relocations.
13842
13843 2008-04-23  Ian Lance Taylor  <iant@google.com>
13844
13845         * object.cc (Sized_relobj::include_section_group): Check for
13846         invalid section group.
13847
13848         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13849         header size.
13850
13851         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13852         than read for file header.
13853         * archive.cc (Archive::include_member): Likewise.
13854
13855 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13856
13857         * aclocal.m4: Regenerate.
13858         * configure: Regenerate.
13859
13860 2008-04-19  Ian Lance Taylor  <iant@google.com>
13861
13862         * version.cc (version_string): Bump to 1.6.
13863
13864         * testsuite/Makefile.am (many_sections_r_test): New target.
13865         (many_sections_r_test_SOURCES): Remove.
13866         (many_sections_r_test_DEPENDENCIES): Remove.
13867         (many_sections_r_test_LDFLAGS): Remove.
13868         (many_sections_r_test_LDADD): Remove.
13869
13870         * object.cc (Sized_relobj::do_add_symbols): Always pass
13871         local_symbol_count_ to add_from_relobj.
13872
13873         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13874         every thousand variables.
13875         * testsuite/Makefile.in: Rebuild.
13876
13877         * object.cc (Xindex::initialize_symtab_xindex): New function.
13878         (Xindex::read_symtab_xindex): New function.
13879         (Xindex::sym_xindex_to_shndx): New function.
13880         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13881         available.
13882         (Sized_relobj::do_initialize_xindex): New function.
13883         (Sized_relobj::do_read_symbols): Adjust section links.
13884         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13885         parameter.  Change all callers.
13886         (Sized_relobj::include_section_group): Adjust section links and
13887         symbol section indexes.
13888         (Sized_relobj::do_layout): Adjust section links.
13889         (Sized_relobj::do_count_local_symbols): Adjust section links and
13890         symbol section indexes.
13891         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13892         ordinary and special symbols.
13893         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13894         dynsym_xindex parameters.  Change all callers.  Adjust section
13895         links.  Use SHN_XINDEX when needed.
13896         (Sized_relobj::get_symbol_location_info): Adjust section links.
13897         Don't get fooled by special symbols.
13898         * object.h (class Xindex): Define.
13899         (class Object): Add xindex_ parameter.  Declare virtual functoin
13900         do_initialize_xindex.
13901         (Object::adjust_sym_shndx): New function.
13902         (Object::set_xindex): New protected function.
13903         (class Symbol_value): Add is_ordinary_shndx_ field.
13904         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13905         (Symbol_value::value): Assert ordinary section.
13906         (Symbol_value::initialize_input_to_output_map): Likewise.
13907         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13908         Change all callers.
13909         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13910         all callers.
13911         (class Sized_relobj): Update declarations.
13912         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13913         parameter.  Change all callers.
13914         (Sized_relobj::adjust_shndx): New function.
13915         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13916         field.
13917         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13918         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13919         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13920         (Sized_dynobj::read_dynsym_section): Adjust section links.
13921         (Sized_dynobj::read_dynamic): Likewise.
13922         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13923         section links.
13924         (Sized_dynobj::do_initialize_xindex): New function.
13925         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13926         do_initialize_xindex.
13927         (Sized_dynobj::adjust_shndx): New function.
13928         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13929         dynsym_xindex_ fields.
13930         (Layout::finalize): Add a call to set_section_indexes before
13931         creating the symtab sections.
13932         (Layout::set_section_indexes): Don't do anything if the section
13933         already has a section index.
13934         (Layout::create_symtab_sections): Add shnum parameter.  Change
13935         caller.  Create .symtab_shndx section if needed.
13936         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13937         caller.
13938         (Layout::allocated_output_section_count): New function.
13939         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13940         needed.
13941         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13942         fields.  Update declarations.
13943         (Layout::symtab_xindex): New function.
13944         (Layout::dynsym_xindex): New function.
13945         (class Write_symbols_task): Add layout_ field.
13946         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13947         Change caller.
13948         * output.cc (Output_section_headers::Output_section_headers): Add
13949         shstrtab_section parameter.  Change all callers.
13950         (Output_section_headers::do_sized_write): Store overflow values
13951         for section count and section string table section index in
13952         section header zero.
13953         (Output_file_header::do_sized_write): Check for overflow of
13954         section count and section string table section index.
13955         (Output_symtab_xindex::do_write): New function.
13956         (Output_symtab_xindex::endian_do_write): New function.
13957         * output.h (class Output_section_headers): Add shstrtab_section_.
13958         Update declarations.
13959         (class Output_symtab_xindex): Define.
13960         (Output_section::has_out_shndx): New function.
13961         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13962         field.
13963         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13964         Change all callers.
13965         (Sized_symbol::init): Likewise.
13966         (Symbol::output_section): Check for ordinary symbol.
13967         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13968         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13969         callers.
13970         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13971         Change all callers.  Simplify handling of symbols from sections
13972         not included in the link.
13973         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13974         distinction.
13975         (Weak_alias_sorter::operator()): Assert that symbols are
13976         ordinary.
13977         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13978         distinction.
13979         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13980         parameters.  Change all callers.
13981         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13982         symbol distinction.  Use SHN_XINDEX when needed.
13983         (Symbol_table::write_section_symbol): Add symtab_xindex
13984         parameter.  Change all callers.
13985         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13986         SHN_XINDEX when needed.
13987         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13988         declarations.
13989         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13990         (Symbol::is_defined): Check is_ordinary.
13991         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13992         (Symbol::is_absolute, Symbol::is_common): Likewise.
13993         (class Sized_symbol): Update declarations.
13994         (class Symbol_table): Update declarations.
13995         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13996         parameters.  Change all callers.
13997         (Sized_symbol::override): Likewise.
13998         (Symbol_table::override): Likewise.
13999         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14000         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14001         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14002         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14003         to be in an ordinary section.
14004         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14005         object and is_ordinary parameters.  Change all callers.
14006         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14007         Change all callers.  Don't add undefined or non-ordinary symbols
14008         to reloc_map_.
14009         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14010         Change all callers.
14011         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14012         declarations.
14013         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14014         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14015         (Sized_relobj::relocate_sections): Likewise.
14016         * target-reloc.h (scan_relocs): Adjust section symbol index.
14017         (scan_relocatable_relocs): Likewise.
14018         * i386.cc (Scan::local): Check for ordinary symbols.
14019         * sparc.cc (Scan::local): Likewise.
14020         * x86_64.cc (Scan::local): Likewise.
14021         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14022         to symbol_section_and_value.
14023         * testsuite/many_sections_test.cc: New file.
14024         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14025         (check_PROGRAMS): Add many_sections_test.
14026         (many_sections_test_SOURCES): Define.
14027         (many_sections_test_DEPENDENCIES): Define.
14028         (many_sections_test_LDFLAGS): Define.
14029         (BUILT_SOURCES): Add many_sections_define.h.
14030         (many_sections_define.h): New target.
14031         (BUILT_SOURCES): Add many_sections_check.h.
14032         (many_sections_check.h): New target.
14033         (check_PROGRAMS): Add many_sections_r_test.
14034         (many_sections_r_test_SOURCES): Define.
14035         (many_sections_r_test_DEPENDENCIES): Define.
14036         (many_sections_r_test_LDFLAGS): Define.
14037         (many_sections_r_test_LDADD): Define.
14038         (many_sections_r_test.o): New target.
14039         * testsuite/Makefile.in: Rebuild.
14040
14041 2008-04-17  Cary Coutant  <ccoutant@google.com>
14042
14043         * errors.cc (Errors::info): New function.
14044         (gold_info): New function.
14045         * errors.h (Errors::info): New function.
14046         * gold.h (gold_info): New function.
14047         * object.cc (Input_objects::add_object): Print trace output.
14048         * options.cc (options::parse_set): New function.
14049         (General_options::parse_wrap): Deleted.
14050         (General_options::General_options): Deleted initializer.
14051         * options.h (options::String_set): New typedef.
14052         (options::parse_set): New function.
14053         (DEFINE_set): New macro.
14054         (General_options::wrap): Changed to use DEFINE_set. Changed
14055         callers of any_wrap_symbols and is_wrap_symbol.
14056         (General_options::trace, General_options::trace_symbol):
14057         New options.
14058         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14059         (General_options::wrap_symbols_): Deleted.
14060         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14061
14062 2008-04-17  David S. Miller  <davem@davemloft.net>
14063
14064         * options.cc (General_options::parse_V): New function.
14065         * options.h: Add entries for -V and -Qy.
14066
14067 2008-04-17  Ian Lance Taylor  <iant@google.com>
14068
14069         * common.cc (Symbol_table::allocate_commons): Remove options
14070         parameter.  Change caller.
14071         (Symbol_table::do_allocate_commons): Remove options parameter.
14072         Change caller.  Just call do_allocate_commons_list twice.
14073         (Symbol_table::do_allocate_commons_list): New function, broken out
14074         of do_allocate_commons.
14075         * common.h (class Allocate_commons_task): Remove options_ field.
14076         Update constructor.
14077         * symtab.cc (Symbol_table::Symbol_table): Initialize
14078         tls_commons_.
14079         (Symbol_table::add_from_object): Put TLS common symbols on
14080         tls_commons_ list.
14081         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14082         which are IN_OUTPUT_DATA.
14083         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14084         allocate_commons and do_allocate_commons declarations.  Declare
14085         do_allocate_commons_list.
14086         * gold.cc (queue_middle_tasks): Update creation of
14087         Allocate_commons_task to not pass options.
14088         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14089         (TLS_TEST_C_FLAGS): New variable.
14090         (tls_test_c_pic.o): New target.
14091         (tls_test_shared.so): Link in tls_test_c_pic.o.
14092         (tls_test_c_pic_ie.o): New target.
14093         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14094         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14095         (tls_test_c.o): New target.
14096         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14097         (tls_pic_test_LDADD): Likewise.
14098         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14099         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14100         (tls_test_c_gnu2.o): New target.
14101         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14102         tls_test_c_gnu2.o.
14103         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14104         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14105         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14106         * testsuite/tls_test.cc: Include "config.h".
14107         (t_last): Call t11_last.
14108         * testsuite/tls_test.h (t11, t11_last): Declare.
14109         * testsuite/tls_test_c.c: New file.
14110         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14111         * configure.ac: Check for OpenMP support.
14112         * configure, config.in, Makefile.in: Rebuild.
14113         * testsuite/Makefile.in: Rebuild.
14114
14115 2008-04-16  Cary Coutant  <ccoutant@google.com>
14116
14117         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14118         (Target_i386::tls_base_symbol_defined_): New field.
14119         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14120         (Target_i386::Scan::global): Likewise.
14121         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14122         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14123         (Target_x86_64::tls_base_symbol_defined_): New field.
14124         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14125         (Target_x86_64::Scan::global): Likewise.
14126
14127 2008-04-16  Cary Coutant  <ccoutant@google.com>
14128
14129         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14130         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14131         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14132         building shared libraries.
14133         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14134         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14135         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14136         * testsuite/Makefile.in: Rebuild.
14137         * testsuite/weak_undef.h: New file.
14138         * testsuite/weak_undef_file1.cc: Add extra test cases.
14139         * testsuite/weak_undef_file2.cc: Likewise.
14140         * testsuite/weak_undef_test.cc: Likewise.
14141
14142 2008-04-16  David S. Miller  <davem@davemloft.net>
14143
14144         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14145         Add issued_non_pic_error_ field.  Declare check_non_pic.
14146         (Target_sparc::Scan::check_non_pic): New function.
14147         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14148         (Target_sparc::Scan::global): Likewise.
14149
14150         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14151         * configure: Rebuild.
14152
14153         * options.h (DEFINE_enable): New macro.
14154         (new_dtags): New enable option.
14155         (initfirst, interpose, loadfltr, nodefaultlib,
14156         nodelete, nodlopen, nodump): New -z options.
14157         * layout.cc (Layout:finish_dynamic_section): If new
14158         dtags enabled, emit DT_RUNPATH.  Also, emit a
14159         DT_FLAGS_1 containing any specified -z flags.
14160
14161 2008-04-16  Ian Lance Taylor  <iant@google.com>
14162
14163         * copy-relocs.cc: New file.
14164         * copy-relocs.h: New file.
14165         * reloc.cc: Remove Copy_relocs code.
14166         * reloc.h: Likewise.
14167         * reloc-types.h (struct Reloc_types) [both versions]: Add
14168         get_reloc_addend_noerror.
14169         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14170         variants of add_global which take an addend which must be zero.
14171         * i386.cc: Include "copy-relocs.h".
14172         (class Target_i386): Change type of copy_relocs_ to variable,
14173         update initializer.
14174         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14175         Change all callers.
14176         (Target_i386::do_finalize_sections): Change handling of
14177         copy_relocs_.
14178         * sparc.cc: Include "copy-relocs.h".
14179         (class Target_sparc): Change type of copy_relocs_ to variable,
14180         update initializer.
14181         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14182         Change all callers.
14183         (Target_sparc::do_finalize_sections): Change handling of
14184         copy_relocs_.
14185         * x86_64.cc: Include "copy-relocs.h".
14186         (class Target_x86_64): Change type of copy_relocs_ to variable,
14187         update initializer.
14188         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14189         class.  Change all callers.
14190         (Target_x86_64::do_finalize_sections): Change handling of
14191         copy_relocs_.
14192         * Makefile.am (CCFILES): Add copy-relocs.cc.
14193         (HFILES): Add copy-relocs.h.
14194
14195         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14196
14197         * testsuite/script_test_4.sh: Permit leading zeroes.
14198
14199 2008-04-15  Ian Lance Taylor  <iant@google.com>
14200
14201         * script-sections.cc (Script_sections::create_segments): Use
14202         header_size_adjustment even when there is enough room for the
14203         headers.
14204         * testsuite/script_test_4.sh: New file.
14205         * testsuite/script_test_4.t: New file.
14206         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14207         (check_DATA): Add script_test_4.stdout.
14208         (MOSTLYCLEANFILES): Likewise.
14209         (script_test_4): New target.
14210         (script_test_4.stdout): New target.
14211         * testsuite/Makefile.in: Rebuild.
14212
14213         * sparc.cc: Add definitions for Output_data_plt_sparc class
14214         constants.
14215
14216 2008-04-14  David S. Miller  <davem@davemloft.net>
14217
14218         * sparc.cc: New file.
14219         * Makefile.am (TARGETSOURCES): Add sparc.cc
14220         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14221         * configure.tgt: Document targ_extra_size and
14222         targ_extra_big_endian.  Add entries for sparc-* and
14223         sparc64-*.
14224         * configure.ac: Handle targ_extra_size and
14225         targ_extra_big_endian.
14226         * Makefile.in: Rebuild.
14227         * configure: Likewise.
14228         * po/POTFILES.in: Likewise.
14229         * po/gold.pot: Likewise.
14230
14231 2008-04-14  Ian Lance Taylor  <iant@google.com>
14232
14233         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14234         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14235         in the name/type/flags to section mapping.  Don't call
14236         allocate_output_section.
14237         (Layout::choose_output_section): Change parameter from adjust_name
14238         to is_input_section.  Don't permit input sections after sections
14239         are attached to segments.  Don't call allocate_output_section.
14240         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14241         not write_enable_output_section.
14242         (Layout::make_output_section): Don't push to
14243         unattached_section_list_ nor call attach_to_segment.  Call
14244         attach_section_to_segment if sections are attached.
14245         (Layout::attach_sections_to_segments): New function.
14246         (Layout::attach_section_to_segment): New function.
14247         (Layout::attach_allocated_section_to_segment): Rename from
14248         attach_to_segment.  Remove flags parameter.
14249         (Layout::allocate_output_section): Remove function.
14250         (Layout::write_enable_output_section): Remove function.
14251         * layout.h (class Layout): Update for above changes.  Add new
14252         field sections_are_attached_.
14253         * output.h (Output_section::update_flags_for_input_section): New
14254         function.
14255         * output.cc (Output_section::add_input_section): Call
14256         update_flags_for_input_section.
14257         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14258
14259 2008-04-11  Cary Coutant  <ccoutant@google.com>
14260
14261         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14262         thought unnecessary.
14263         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14264
14265 2008-04-11  Ian Lance Taylor  <iant@google.com>
14266
14267         * output.h (class Output_section_data): Remove inline definition
14268         of set_addralign.
14269         * output.cc (Output_section_data::set_addralign): New function.
14270
14271 2008-04-11  Cary Coutant  <ccoutant@google.com>
14272
14273         Add support for TLS descriptors for i386 and x86_64.
14274         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14275         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14276         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14277         GOT_TYPE_TLS_DESC.
14278         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14279         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14280         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14281         relocations.
14282         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14283         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14284         Fix problem with initial-exec relocations.
14285         (Target_i386::Relocate::relocate_tls): Likewise.
14286         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14287         relaxation.
14288         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14289         support for section-plus-offset dynamic table entries.
14290         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14291         (Output_data_dynamic::Dynamic_entry): Add support for
14292         section-plus-offset dynamic table entries.
14293         (Output_data_dynamic::Classification): Likewise.
14294         (Output_data_dynamic::classification_): Renamed offset_.
14295         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14296         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14297         (Target_x86_64::make_plt_section): New function.
14298         (Target_x86_64::reserve_tlsdesc_entries): New function.
14299         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14300         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14301         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14302         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14303         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14304         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14305         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14306         add extra PLT entry for TLS descriptors.
14307         (Output_data_plt_x86_64::got_): New field.
14308         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14309         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14310         fields.
14311         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14312         descriptors.
14313         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14314         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14315         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14316         R_386_TLS_DESC_CALL relocations.
14317         (Target_x86_64::Scan::global): Likewise.
14318         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14319         for TLS descriptors.
14320         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14321         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14322         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14323         GD-to-IE relaxation.
14324         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14325         and TLS_DESCRIPTORS.
14326         * Makefile.in: Rebuild.
14327         * configure: Rebuild.
14328         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14329         (tls_test_shared2.so): New target.
14330         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14331         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14332         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14333         (tls_shared_gd_to_ie_test_LDADD): New variable.
14334         (tls_shared_gnu2_gd_to_ie_test): New target.
14335         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14336         New targets.
14337         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14338         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14339         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14340         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14341         (tls_shared_gnu2_test): New target.
14342         (tls_test_gnu2_shared.so): New target.
14343         (tls_shared_gnu2_test_SOURCES): New variable.
14344         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14345         (tls_shared_gnu2_test_LDFLAGS): New variable.
14346         (tls_shared_gnu2_test_LDADD): New variable.
14347         * testsuite/Makefile.in: Rebuild.
14348         * testsuite/Makefile.
14349
14350 2008-04-11  Ian Lance Taylor  <iant@google.com>
14351
14352         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14353         justsyms.t.
14354         * testsuite/Makefile.in: Rebuild.
14355
14356         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14357         long.
14358         * testsuite/script_test_2.cc (main): Adjust test.
14359
14360 2008-04-11  David S. Miller  <davem@davemloft.net>
14361             Ian Lance Taylor  <iant@google.com>
14362
14363         * options.h (General_options): Add entries for '-Y' and
14364         '-relax'.
14365         * options.cc (General_options:finalize): If -Y was used, add those
14366         entries to the library path instead of the default "/lib" and
14367         "/usr/lib".
14368
14369 2008-04-11  David S. Miller  <davem@davemloft.net>
14370
14371         * testsuite/justsyms.t: Start at 0x100.
14372         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14373         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14374         long.
14375         * testsuite/script_test_2.cc: Adjust string and section length
14376         checks.
14377
14378 2008-04-09  Ian Lance Taylor  <iant@google.com>
14379
14380         PR gold/5996
14381         * script-sections.cc (Sections_element::allocate_to_segment): Add
14382         orphan parameter.
14383         (Output_section_definition::allocate_to_segment): Likewise.
14384         (Orphan_output_section::allocate_to_segment): Likewise.
14385         (Script_sections::attach_sections_using_phdrs_clause): Don't
14386         propagate non-PT_LOAD segments to orphan sections.
14387         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14388         readelf rather than objdump.
14389         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14390         .interp section and PT_INTERP segment are the same size.
14391         * testsuite/Makefile.in: Rebuild.
14392
14393         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14394         aliases for symbols defined in the same object.
14395         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14396         (weak_alias_test_SOURCES): New variable.
14397         (weak_alias_test_DEPENDENCIES): New variable.
14398         (weak_alias_test_LDFLAGS): New variable.
14399         (weak_alias_test_LDADD): New variable.
14400         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14401         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14402         (weak_alias_test_3.o): New target.
14403         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14404         * testsuite/weak_alias_test_main.cc: New file.
14405         * testsuite/weak_alias_test_1.cc: New file.
14406         * testsuite/weak_alias_test_2.cc: New file.
14407         * testsuite/weak_alias_test_3.cc: New file.
14408
14409 2008-04-08  Ian Lance Taylor  <iant@google.com>
14410
14411         * options.h (class General_options): Add --noinhibit-exec option.
14412         * main.cc (main): Check --noinhibit-exec.
14413
14414         * options.h (class General_options): Define --wrap as a special
14415         option.  Add wrap_symbols_ field.
14416         (General_options::any_wrap_symbols): New function.
14417         (General_options::is_wrap_symbol): New function.
14418         * options.cc (General_options::parse_wrap): New function.
14419         (General_options::General_options): Initialize wrap_symbols_.
14420         * symtab.cc (Symbol_table::wrap_symbol): New function.
14421         (Symbol_table::add_from_object): Handle --wrap.
14422         * symtab.h (class Symbol_table): Declare wrap_symbol.
14423         * target.h (Target::wrap_char): New function.
14424         (Target::Target_info): Add wrap_char field.
14425         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14426         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14427         * testsuite/testfile.cc (Target_test::test_target_info):
14428         Likewise.
14429
14430         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14431         there is one.
14432
14433         * layout.h (class Layout): Add added_eh_frame_data_ field.
14434         * layout.cc (Layout::Layout): Initialize new field.
14435         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14436         output section until we find a section we merged successfully.
14437         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14438         that the size be non-zero.
14439
14440         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14441         qualifier.
14442
14443 2008-04-08  Craig Silverstein  <csilvers@google.com>
14444
14445         * configure.ac: Export new conditional variable HAVE_ZLIB.
14446         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14447         on HAVE_ZLIB.
14448         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14449         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14450
14451 2008-04-07  Ian Lance Taylor  <iant@google.com>
14452
14453         * version.cc (version_string): Set to "1.5".
14454
14455         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14456         Add issued_non_pic_error_ field.  Declare check_non_pic.
14457         (Target_x86_64::Scan::check_non_pic): New function.
14458         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14459         (Target_x86_64::Scan::global): Likewise.
14460
14461         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14462         addend parameter.  Change caller.  Handle merge sections.
14463         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14464         Address to Addend.  Don't add in the result of
14465         local_section_offset, pass down the addend and use the returned
14466         value.
14467         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14468         Update declarations of local_section_offset and symbol_value.
14469         * testsuite/two_file_test_1.cc (t18): New function.
14470         * testsuite/two_file_test_2.cc (f18): New function.
14471         * testsuite/two_file_test_main.cc (main): Call t18.
14472         * testsuite/two_file_test.h (t18, f18): Declare.
14473
14474         * configure.ac: Don't test for objdump, c++filt, or readelf.
14475         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14476         conditionals.
14477         (TEST_READELF): New variable.
14478         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14479         (check_PROGRAMS): Add two_file_strip_test.
14480         (two_file_strip_test): New target.
14481         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14482         (two_file_same_shared_strip_test_SOURCES): New variable.
14483         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14484         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14485         (two_file_same_shared_strip_test_LDADD): New variable.
14486         (two_file_shared_strip.so): New target.
14487         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14488         (ver_test_5.syms, ver_test_7.syms): Likewise.
14489         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14490         (strip_test_3.stdout): Use TEST_OBJDUMP.
14491         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14492
14493 2008-04-04  Cary Coutant  <ccoutant@google.com>
14494
14495         * symtab.h (Symbol::is_weak_undefined): New function.
14496         (Symbol::is_strong_undefined): New function.
14497         (Symbol::is_absolute): New function.
14498         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14499         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14500         absolute symbols.
14501         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14502         (weak_undef_test): New target.
14503         * testsuite/Makefile.in: Rebuild.
14504         * testsuite/weak_undef_file1.cc: New file.
14505         * testsuite/weak_undef_file2.cc: New file.
14506         * testsuite/weak_undef_test.cc: New file.
14507
14508 2008-04-03  Craig Silverstein  <csilvers@google.com>
14509
14510         * compressed_output.h (class Output_compressed_section): Use
14511         unsigned buffer.
14512         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14513         add zlib header.
14514         (zlib_compressed_suffix): Removed.
14515         (Output_compressed_section::set_final_data_size): Use unsigned
14516         buffers.
14517         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14518         Fix linker invocation.
14519         (flagstest_o_specialfile_and_compress_debug_sections):
14520         Likewise.
14521         * testsuite/Makefile.in: Regenerated.
14522
14523 2008-04-02  David S. Miller  <davem@davemloft.net>
14524
14525         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14526         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14527
14528 2008-04-02  Craig Silverstein  <csilvers@google.com>
14529
14530         * TODO: New file.
14531
14532 2008-04-02  Ian Lance Taylor  <iant@google.com>
14533
14534         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14535         parameters.  Update for new key type to views_.  Change all
14536         callers.
14537         (File_read::read): Adjust for byteshift in returned view.
14538         (File_read::add_view): New function, broken out of
14539         find_and_make_view.
14540         (File_read::make_view): New function, broken out of
14541         find_and_make_view.
14542         (File_read::find_or_make_view): Add offset and aligned
14543         parameters.  Rewrite accordingly.  Change all callers.
14544         (File_read::get_view): Add offset and aligned parameters.  Adjust
14545         for byteshift in return value.
14546         (File_read::get_lasting_view): Likewise.
14547         * fileread.h (class File_read): Update declarations.
14548         (class File_read::View): Add byteshift_ field.  Add byteshift to
14549         constructor.  Add byteshift method.
14550         * archive.h (Archive::clear_uncached_views): New function.
14551         (Archive::get_view): Add aligned parameter.  Change all callers.
14552         * object.h (Object::get_view): Add aligned parameter.  Change all
14553         callers.
14554         (Object::get_lasting_view): Likewise.
14555
14556         * fileread.cc (File_read::release): Don't call clear_views if
14557         there are multiple objects.
14558         * fileread.h (File_read::clear_uncached_views): New function.
14559         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14560         on the archive.
14561
14562 2008-03-31  Cary Coutant  <ccoutant@google.com>
14563
14564         Add thin archive support.
14565         * archive.cc (Archive::armagt): New const.
14566         (Archive::setup): Remove task parameter and calls to unlock.
14567         (Archive::unlock_nested_archives): New function.
14568         (Archive::read_header): Add nested_off parameter. Change
14569         all callers.
14570         (Archive::interpret_header): Likewise.
14571         (Archive::include_all_members): Change to handle thin
14572         archives.
14573         (Archive::include_member): Likewise.
14574         * archive.h (Archive::Archive): Add new parameters and
14575         initializers.
14576         (Archive::armagt): New const.
14577         (Archive::setup): Remove task parameter.
14578         (Archive::unlock_nested_archives): New function.
14579         (Archive::read_header): Add nested_off parameter.
14580         (Archive::interpret_header): Likewise.
14581         (Archive::Nested_archive_table): New typedef.
14582         (Archive::is_thin_archive_): New field.
14583         (Archive::nested_archives_): New field.
14584         (Archive::options_): New field.
14585         (Archive::dirpath_): New field.
14586         (Archive::task_): New field.
14587         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14588         for thin archives.  Pass additional parameters to
14589         Archive::Archive.  Unlock the archive file after calling
14590         Archive::setup.
14591
14592 2008-03-29  Ian Lance Taylor  <iant@google.com>
14593
14594         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14595         version symbol to be local.
14596         * testsuite/ver_test_4.sh: New file.
14597         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14598         (check_DATA): Add ver_test_4.syms.
14599         (ver_test_4.syms): New target.
14600         * testsuite/Makefile.in: Rebuild.
14601
14602         * output.cc
14603         (Output_section::Input_section_sort_entry::has_priority): New
14604         function.
14605         (Output_section::Input_section_sort_entry::match_file_name): New
14606         function.
14607         (Output_section::Input_section_sort_entry::match_section_name):
14608         Remove.
14609         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14610         Remove.
14611         (Output_section::Input_section_sort_entry::match_section_file):
14612         Remove.
14613         (Output_section::Input_section_sort_compare::operator()): Rewrite
14614         using new Input_section_sort_entry functions.  Sort crtbegin and
14615         crtend first.  Sort sections with no priority before sections with
14616         a priority.
14617         * testsuite/initpri1.c (d3): Check j != 4.
14618         (cd5): New constructor/destructor function.
14619         (main): Check j != 2.
14620
14621         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14622         new symbol when resolving, don't call set_is_default.
14623         * testsuite/ver_test_7.cc: New file.
14624         * testsuite/ver_test_7.sh: New file.
14625         * testsuite/Makefile.am (ver_test_7.so): New target.
14626         (ver_test_7.o): New target.
14627         (check_SCRIPTS): Add ver_test_7.sh.
14628         (check_DATA): Add ver_test_7.syms.
14629         (ver_test_7.syms): New target.
14630
14631 2008-03-28  Ian Lance Taylor  <iant@google.com>
14632
14633         * layout.cc (Layout::layout): If we see an input section with a
14634         name that needs sorting, set the must_sort flag for the output
14635         section.
14636         (Layout::make_output_section): If the name of the output section
14637         indicates that it might require sorting, set the may_sort flag.
14638         * output.h (Output_section::may_sort_attached_input_sections): New
14639         function.
14640         (Output_section::set_may_sort_attached_input_sections): New
14641         function.
14642         (Output_section::must_sort_attached_input_sections): New
14643         function.
14644         (Output_section::set_must_sort_attached_input_sections): New
14645         function.
14646         (class Output_section): Declare Input_section_sort_entry.  Define
14647         Input_section_sort_compare.  Declare
14648         sort_attached_input_sections.  Add new fields:
14649         may_sort_attached_input_sections_,
14650         must_sort_attached_input_sections_,
14651         attached_input_sections_are_sorted_.
14652         * output.cc (Output_section::Output_section): Initialize new
14653         fields.
14654         (Output_section::add_input_section): Add an entry to
14655         input_sections_ if may_sort or must_sort are true.
14656         (Output_section::set_final_data_size): Call
14657         sort_attached_input_sections if necessary.
14658         (Output_section::Input_section_sort_entry): Define new class.
14659         (Output_section::Input_section_sort_compare::operator()): New
14660         function.
14661         (Output_section::sort_attached_input_sections): New function.
14662         * configure.ac: Check whether the compiler supports constructor
14663         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14664         * testsuite/initpri1.c: New file.
14665         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14666         CONSTRUCTOR_PRIORITY.
14667         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14668         (initpri1_LDFLAGS): New variable.
14669         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14670
14671 2008-03-27  Ian Lance Taylor  <iant@google.com>
14672
14673         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14674         * testsuite/common_test_1.c: New file.
14675         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14676         (common_test_1_SOURCES): New variable.
14677         (common_test_1_DEPENDENCIES): New variable.
14678         (common_test_1_LDFLAGS): New variable.
14679
14680         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14681         and commons_ correctly when NAME/VERSION does not override
14682         NAME/NULL.
14683         * testsuite/ver_test_6.c: New file.
14684         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14685         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14686         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14687
14688 2008-03-26  Ian Lance Taylor  <iant@google.com>
14689
14690         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14691         of an undefined symbol from a version script.
14692         * testsuite/Makefile.am (ver_test_5.so): New target.
14693         (ver_test_5.o): New target.
14694         (check_SCRIPTS): Add ver_test_5.sh.
14695         (check_DATA): Add ver_test_5.syms.
14696         (ver_test_5.syms): New target.
14697         * testsuite/ver_test_5.cc: New file.
14698         * testsuite/ver_test_5.script: New file.
14699         * testsuite/ver_test_5.sh: New file.
14700         * Makefile.in, testsuite/Makefile.in: Rebuild.
14701
14702         PR gold/5986
14703         Fix problems building gold with gcc 4.3.0.
14704         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14705         (gold_error_at_location, gold_warning_at_location): Use it.
14706         * configure.ac: Check whether we can compile and use a template
14707         function with a printf attribute.
14708         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14709         when jumping over bytes.
14710         * object.cc: Instantiate Object::read_section_data.
14711         * debug.h: Include <cstring>
14712         * dwarf_reader.cc: Include <algorithm>
14713         * main.cc: Include <cstring>.
14714         * options.cc: Include <cstring>.
14715         * output.cc: Include <cstring>.
14716         * script.cc: Include <cstring>.
14717         * script.h: Include <string>.
14718         * symtab.cc: Include <cstring> and <algorithm>.
14719         * target-select.cc: Include <cstring>.
14720         * version.cc: Include <string>.
14721         * testsuite/testmain.cc: Include <cstdlib>.
14722         * configure, config.in: Rebuild.
14723
14724 2008-03-25  Ian Lance Taylor  <iant@google.com>
14725
14726         * options.cc: Include "../bfd/bfdver.h".
14727         (options::help): Print bug reporting address.
14728
14729         * version.cc (print_version): Adjust output for current value of
14730         BFD_VERSION_STRING.
14731
14732         * NEWS: New file.
14733
14734         * options.cc (options::help): Print list of supported targets.
14735         * target-select.h: Include <vector>.
14736         (class Target_selector): Make machine_, size_, and is_big_endian_
14737         fields const.  Add bfd_name_ and instantiated_target_ fields.
14738         (Target_selector::Target_selector): Add bfd_name parameter.
14739         (Target_selector::recognize): Make non-virtual, call
14740         do_recognize.
14741         (Target_selector::recognize_by_name): Make non-virtual, call
14742         do_recognize_by_name.
14743         (Target_selector::supported_names): New function.
14744         (Target_selector::bfd_name): New function.
14745         (Target_selector::do_instantiate_target): New pure virtual
14746         function.
14747         (Target_selector::do_recognize): New virtual function.
14748         (Target_selector::do_recognize_by_name): New virtual function.
14749         (Target_selector::instantiate_target): New private function.
14750         (supported_target_names): Declare.
14751         * target-select.cc (Target_selector::Target_selector): Update for
14752         new parameter and fields.
14753         (select_target_by_name): Check that the name matches before
14754         calling recognize_by_name.
14755         (supported_target_names): New function.
14756         * i386.cc (class Target_selector_i386): Update Target_selector
14757         constructor call.  Remove recognize and recognize_by_name.  Add
14758         do_instantiate_target.
14759         * x86_64.cc (class Target_selector_x86_64): Likewise.
14760         * testsuite/testfile.cc (class Target_selector_test): Update for
14761         changes to Target_selector.
14762
14763         * README: Rewrite, with some notes on unsupported features.
14764
14765 2008-03-24  Cary Coutant  <ccoutant@google.com>
14766
14767         * i386.cc (Target_i386::Got_type): New enum declaration.
14768         (Target_i386::Scan::local): Updated callers of Output_data_got
14769         member functions.
14770         (Target_i386::Scan::global): Likewise.
14771         (Target_i386::Relocate::relocate): Likewise.
14772         (Target_i386::Relocate::relocate_tls): Likewise.
14773         * object.h (Got_offset_list): New class.
14774         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14775         (Sized_relobj::local_got_offset): Likewise.
14776         (Sized_relobj::set_local_got_offset): Likewise.
14777         (Sized_relobj::local_has_tls_got_offset): Removed.
14778         (Sized_relobj::local_tls_got_offset): Removed.
14779         (Sized_relobj::set_local_tls_got_offset): Removed.
14780         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14781         * output.cc (Output_data_got::add_global): Added got_type parameter.
14782         (Output_data_got::add_global_with_rel): Likewise.
14783         (Output_data_got::add_global_with_rela): Likewise.
14784         (Output_data_got::add_global_pair_with_rel): New function.
14785         (Output_data_got::add_global_pair_with_rela): New function.
14786         (Output_data_got::add_local): Added got_type parameter.
14787         (Output_data_got::add_local_with_rel): Likewise.
14788         (Output_data_got::add_local_with_rela): Likewise.
14789         (Output_data_got::add_local_pair_with_rel): New function.
14790         (Output_data_got::add_local_pair_with_rela): New function.
14791         (Output_data_got::add_global_tls): Removed.
14792         (Output_data_got::add_global_tls_with_rel): Removed.
14793         (Output_data_got::add_global_tls_with_rela): Removed.
14794         (Output_data_got::add_local_tls): Removed.
14795         (Output_data_got::add_local_tls_with_rel): Removed.
14796         (Output_data_got::add_local_tls_with_rela): Removed.
14797         * output.h (Output_data_got::add_global): Added got_type parameter.
14798         (Output_data_got::add_global_with_rel): Likewise.
14799         (Output_data_got::add_global_with_rela): Likewise.
14800         (Output_data_got::add_global_pair_with_rel): New function.
14801         (Output_data_got::add_global_pair_with_rela): New function.
14802         (Output_data_got::add_local): Added got_type parameter.
14803         (Output_data_got::add_local_with_rel): Likewise.
14804         (Output_data_got::add_local_with_rela): Likewise.
14805         (Output_data_got::add_local_pair_with_rel): New function.
14806         (Output_data_got::add_local_pair_with_rela): New function.
14807         (Output_data_got::add_global_tls): Removed.
14808         (Output_data_got::add_global_tls_with_rel): Removed.
14809         (Output_data_got::add_global_tls_with_rela): Removed.
14810         (Output_data_got::add_local_tls): Removed.
14811         (Output_data_got::add_local_tls_with_rel): Removed.
14812         (Output_data_got::add_local_tls_with_rela): Removed.
14813         * resolve.cc (Symbol::override_base_with_special): Removed
14814         reference to has_got_offset_ field.
14815         * symtab.cc (Symbol::init_fields): Replaced initialization
14816         of got_offset_ with got_offsets_.  Removed initialization
14817         of has_got_offset_
14818         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14819         (Symbol::got_offset): Likewise.
14820         (Symbol::set_got_offset): Likewise.
14821         (Symbol::has_tls_got_offset): Removed.
14822         (Symbol::tls_got_offset): Removed.
14823         (Symbol::set_tls_got_offset): Removed.
14824         (Symbol::got_offset_): Removed.
14825         (Symbol::tls_mod_got_offset_): Removed.
14826         (Symbol::tls_pair_got_offset_): Removed.
14827         (Symbol::got_offsets_): New field.
14828         (Symbol::has_got_offset): Removed.
14829         (Symbol::has_tls_mod_got_offset): Removed.
14830         (Symbol::has_tls_pair_got_offset): Removed.
14831         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14832         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14833         member functions.
14834         (Target_x86_64::Scan::global): Likewise.
14835         (Target_x86_64::Relocate::relocate): Likewise.
14836         (Target_x86_64::Relocate::relocate_tls): Likewise.
14837
14838 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14839
14840         * yyscript.y: Fix spelling error in comment.
14841
14842 2008-03-24  Ian Lance Taylor  <iant@google.com>
14843
14844         * options.h (class General_options): Define build_id option.
14845         * layout.h (class Layout): Declare write_build_id, create_note,
14846         create_build_id.  Add build_id_note_ member.
14847         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14848         "libiberty.h", "md5.h", "sha1.h".
14849         (Layout::Layout): Initialize eh_frame_data_,
14850         eh_frame_hdr_section_, and build_id_note_.
14851         (Layout::finalize): Call create_build_id.
14852         (Layout::create_note): New function, broken out of
14853         Layout::create_gold_note.
14854         (Layout::create_gold_note): Call create_note.
14855         (Layout::create_build_id): New function.
14856         (Layout::write_build_id): New function.
14857         (Close_task_runner::run): Call write_build_id.
14858
14859         * x86_64.cc: Correct license to GPLv3.
14860
14861 2008-03-23  Ian Lance Taylor  <iant@google.com>
14862
14863         * options.cc: Include "demangle.h".
14864         (parse_optional_string): New function.
14865         (parse_long_option): Handle takes_optional_argument.
14866         (parse_short_option): Update dash_z initializer.  Handle
14867         takes_optional_argument.
14868         (General_options::General_options): Initialize do_demangle_.
14869         (General_options::finalize): Set do_demangle_.  Handle demangling
14870         style.
14871         * options.h (parse_optional_string): Declare.
14872         (struct One_option): Add optional_arg field.  Update constructor.
14873         Update call constructor calls.  Add takes_optional_argument
14874         function.
14875         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14876         (DEFINE_optional_string): Define.
14877         (General_options::demangle): Change from DEFINE_bool to
14878         DEFINE_optional_string.
14879         (General_options::no_demangle): New function.
14880         (General_options::do_demangle): New function.
14881         (General_options::set_do_demangle): New function.
14882         (General_options::execstack_status_): Move definition to end of
14883         class definition.
14884         (General_options::static_): Likewise.
14885         (General_options::do_demangle_): New field.
14886         * object.cc (big_endian>::get_symbol_location_info): Call
14887         Options::do_demangle, not Options::demangle.
14888         * symtab.cc (demangle): Likewise.
14889
14890 2008-03-22  Ian Lance Taylor  <iant@google.com>
14891
14892         * gold.h: Include <cstddef> and <sys/types.h>
14893         * options.h: Include <cstring>.
14894
14895 2008-03-21  Ian Lance Taylor  <iant@google.com>
14896
14897         * Added source code to GNU binutils.
14898 \f
14899 Copyright (C) 2008-2013 Free Software Foundation, Inc.
14900
14901 Copying and distribution of this file, with or without modification,
14902 are permitted in any medium without royalty provided the copyright
14903 notice and this notice are preserved.
14904
14905 Local Variables:
14906 mode: change-log
14907 left-margin: 8
14908 fill-column: 74
14909 version-control: never
14910 End: