PR gold/15662
[external/binutils.git] / gold / ChangeLog
1 2013-06-27  Jing Yu  <jingyu@google.com>
2
3         PR gold/15662
4         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
5         function.
6         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
7         (Target_powerpc::do_relax): Call the above.
8
9 2013-06-27  Cary Coutant  <ccoutant@google.com>
10
11         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
12         on garbage collected .opd section.
13
14 2013-06-27  Alan Modra  <amodra@gmail.com>
15
16         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
17         is non-zero.
18         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
19         (Target_powerpc::do_function_location): Likewise for loc->shndx.
20
21 2013-06-14  Cary Coutant  <ccoutant@google.com>
22
23         * resolve.cc (Symbol::override_base): Don't override st_type
24         from plugin placeholder symbols.
25         (Symbol_table::resolve): Likewise.
26         (Symbol_table::should_override): Don't complain about TLS mismatch
27         if the TO symbol is a plugin placeholder.
28         * testsuite/Makefile.am (plugin_test_tls): New test.
29         * testsuite/Makefile.in: Regenerate.
30         * testsuite/plugin_test_tls.sh: New test script.
31         * testsuite/two_file_test_2_tls.cc: New test source.
32         * testsuite/two_file_test_tls.cc: New test source.
33
34 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
35
36         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
37         the maximum segment alignment is larger than the page size.
38         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
39         correctly aligns the symbols with large alignemnt.
40         * testsuite/Makefile.in: Regenerate.
41         * testsuite/large_symbol_alignment.cc: New file.
42
43 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
44             Sriraman Tallam  <tmsriram@google.com>
45
46         * options.h (sort_section): New option.
47         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
48         Rename from Input_section_sort_section_name_special_ordering_compare.
49         (Input_section_sort_section_name_compare): New struct.
50         * output.cc (Output_section::Input_section_sort_section_name_compare::
51         operator()): New function.
52         (Output_section::sort_attached_input_sections): Use new sort function
53         for .text if --sort-section=name is specified.
54         * layout.cc (Layout::make_output_section):
55         Add sorting by name when --sort-section=name is specified.
56         * testsuite/Makefile.am (text_section_grouping): Test option
57         --sort-section=name.
58         * testsuite/Makefile.in: Regenerate.
59         * testsuite/section_sorting_name.cc: New file.
60         * testsuite/section_sorting_name.sh: New file.
61
62 2013-05-21  Cary Coutant  <ccoutant@google.com>
63
64         * symtab.h (Symbol::is_cxx_vtable): New function.
65         * target-reloc.h (relocate_section): Check for vtable symbol.
66         * testsuite/Makefile.am (missing_key_func.sh): New test case.
67         * testsuite/Makefile.in: Regenerate.
68         * testsuite/missing_key_func.cc: New test source.
69         * testsuite/missing_key_func.sh: New test script.
70
71 2013-05-21  Cary Coutant  <ccoutant@google.com>
72
73         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
74         type of enclosing symbol.
75         (Relocate_info::location): Check symbol type when describing symbol.
76         * object.h (Symbol_location_info): Remove unused line_number;
77         add enclosing_symbol_type.
78         * testsuite/debug_msg.sh: Adjust expected output.
79
80 2013-05-13  Cary Coutant  <ccoutant@google.com>
81
82         * configure.ac: Export DEFAULT_TARGET.
83         * configure: Regenerate.
84         * Makefile.in: Regenerate.
85         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
86         * testsuite/Makefile.in: Regenerate.
87         * testsuite/debug_msg.sh: Delete duplicate tests.
88         Don't check undef_int error message match for powerpc where the
89         source file and line number aren't available.
90
91 2013-05-10  Roland McGrath  <mcgrathr@google.com>
92
93         * options.h (General_options): Add --rosegment-gap option.
94         * options.cc (finalize): --rosegment-gap implies --rosegment.
95         * layout.cc (set_segment_offsets): Let user option override
96         target->rosegment_gap().
97
98 2013-05-10  Roland McGrath  <mcgrathr@google.com>
99
100         * options.h (General_options): Remove leading space from help
101         messages for -nostdlib and --rosegment.
102
103 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
104
105         PR ld/15365
106         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
107
108 2013-05-03  Alan Modra  <amodra@gmail.com>
109
110         * merge.cc (Output_merge_string::do_add_input_section): Correct
111         scan for number of strings.  Rename vars to avoid shadowing.
112         Include missing terminator in input_size_.
113
114 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
115
116         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
117         Restore empty string handling.
118
119 2013-05-01  Cary Coutant  <ccoutant@google.com>
120
121         * stringpool.cc (Stringpool_template::new_key_offset): Fix
122         uninitialized warning.
123
124 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
125
126         * output.cc (Output_section::add_merge_input_section): Allow
127         to merge sections if the alignment is more than character size.
128         * merge.h (Output_merge_string::Output_merge_string): Remove
129         assert.
130         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
131         only not-null strings. Check the alignment of strings.
132         * stringpool.h
133         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
134         alignment as the argument.
135         (Stringpool_template<Stringpool_char>::addralign_): New class member.
136         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
137         Align non-zero length strings according to the addralign_.
138         (Stringpool_template<Stringpool_char>::set_string_offsets):
139         Updating offsets according to the given alignment.
140         * testsuite/Makefile.am (text_section_grouping): Test if string
141         literals are getting merged.
142         * testsuite/Makefile.in: Regenerate.
143         * testsuite/merge_string_literals_1.c: New file.
144         * testsuite/merge_string_literals_2.c: Ditto.
145         * testsuite/merge_string_literals.sh: Ditto.
146
147 2013-04-26  Ian Lance Taylor  <iant@google.com>
148
149         * target-reloc.h (relocate_section): If the reloc offset is out of
150         range, pass VIEW as NULL to relocate.relocate.
151         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
152         * i386.cc (Target_i386::Relocate::relocate): Likewise.
153         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
154         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
155         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
156         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
157
158 2013-04-26  Geoff Pike  <gpike@chromium.org>
159
160         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
161         * layout.cc (Hash_task): New class.
162         (Layout::queue_build_id_tasks): New function.
163         (Layout::write_build_id): Handle single-thread portion of build ID
164         computation.  (In some cases, all of it is single-threaded.)  Replace
165         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
166         functionality in fewer lines of code.
167         * layout.h (Layout::queue_build_id_tasks): New function declaration.
168         * options.h (General_options): make "--build-id" default to tree
169         rather than sha1.  Add two new options related to --build-id=tree:
170         --build-id-chunk-size-for-treehash and
171         --build-id-min-file-size-for-treehash.
172         * Makefile.am: add testing of --build-id=tree and related new options
173         (these tests will be invoked by "make check").
174         * Makefile.in: Regenerate.
175
176 2013-04-25  Alan Modra  <amodra@gmail.com>
177
178         * configure.tgt: Add powerpcle and powerpc64le.
179
180 2013-04-22  Alan Modra  <amodra@gmail.com>
181
182         PR gold/15355
183         * layout.cc (Layout::segment_precedes): Allow more than one
184         segment with the same type and flags.
185
186 2013-04-15  Cary Coutant  <ccoutant@google.com>
187
188         * layout.cc (Layout::set_relocatable_section_offsets): Don't
189         allocate space in file for BSS sections.
190
191 2013-04-15  Cary Coutant  <ccoutant@google.com>
192
193         * script-sections.cc (Orphan_output_section): Reset address
194         to zero after each orphaned section for relocatable links.
195
196 2013-04-15  Cary Coutant  <ccoutant@google.com>
197
198         * symtab.cc (Symbol_table::sized_write_globals): Subtract
199         section starting address for relocatable link.
200         * testsuite/Makefile.am (script_test_11): New test.
201         * testsuite/Makefile.in: Regenerate.
202         * testsuite/script_test_11.c: New source file.
203         * testsuite/script_test_11.t: New linker script.
204
205 2013-04-13  Alan Modra  <amodra@gmail.com>
206
207         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
208         owner when sections are not adjacent and exceed group size.
209         (Target_powerpc::group_sections): Handle corner case.
210         (Target_powerpc::Branch_info::make_stub): Handle case where
211         stub table doesn't exist due to branches in non-exec sections.
212         (Target_powerpc::Relocate::relocate): Likewise.
213
214 2013-04-11  Alan Modra  <amodra@gmail.com>
215
216         PR gold/15354
217         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
218         .branch_lt to match bfd ld.  Adjust comments throughout file.
219
220 2013-04-04  Ian Lance Taylor  <iant@google.com>
221
222         GCC PR c++/56840
223         * object.cc (do_layout_deferred_sections): Handle .eh_frame
224         sections before checking whether they are included in the link.
225
226 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
227
228         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
229         object before calling the plugin claim_file handler.  Pass the elf
230         object of the archive to the plugin. Delete the elf object if the
231         plugin claims the file.
232
233 2013-03-21  Alan Modra  <amodra@gmail.com>
234
235         * layout.cc (Layout::set_segment_offsets): Accept writable .text
236         segment when omagic.
237
238 2013-03-21  Alan Modra  <amodra@gmail.com>
239
240         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
241         comparison warning.
242         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
243         uninitialized" warning.
244
245 2013-03-20  Alan Modra  <amodra@gmail.com>
246
247         * symtab.h (Symbol::clear_version): New function.
248         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
249         is_needed by weak references.  Clear version for symbols defined
250         in as-needed objects that are not needed.
251
252 2013-03-15  Alan Modra  <amodra@gmail.com>
253
254         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
255         static and public.  Add report_err param.  Return false for data refs.
256         (Target_powerpc::rela_dyn_section): New overloaded function.
257         (Target_powerpc::plt_, iplt_): Elucidate.
258         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
259         (Output_data_plt_powerpc::do_write): Don't write .iplt.
260         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
261         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
262         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
263         push_branch and make_plt_entry for ifunc syms when
264         reloc_needs_plt_for_ifunc.
265         (Target_powerpc::Relocate::relocate): Don't use plt entry value
266         for ifunc unless reloc_needs_plt_for_ifunc.
267
268 2013-03-15  Alan Modra  <amodra@gmail.com>
269
270         * gc.h (gc_process_relocs): Don't look through function descriptors.
271         * icf.cc (get_section_contents): Do so here instead.
272
273 2013-03-13  Alan Modra  <amodra@gmail.com>
274
275         * powerpc.cc (is_branch_reloc): Forward declare.
276         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
277         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
278         false for 64-bit, true for 32-bit non-branch relocs.
279         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
280         * testsuite/Makefile.am (icf_test): Use linker map file instead of
281         nm output.
282         (icf_safe_test): Generate linker map file as well as nm output.
283         (icf_safe_so_test): Likewise.
284         * testsuite/Makefile.in: Regenerate.
285         * testsuite/icf_test.sh: Parse linker map file to determine
286         section folding.
287         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
288         * testsuite/icf_safe_so_test.sh: Likewise.
289         (X86_32_or_ARM_specific_safe_fold): Merge into..
290         (arch_specific_safe_fold): ..this.
291         (X86_64_specific_safe_fold): Delete unused function.
292
293 2013-03-12  Alan Modra  <amodra@gmail.com>
294
295         * gc.h (gc_process_relocs): Look through function descriptors
296         to determine shndx, symvalue and addend used by ICF.  Tidy
297         variable duplication.
298
299 2013-03-11  Alan Modra  <amodra@gmail.com>
300
301         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
302         * layout.cc (Layout_task_runner::run): ..to here.
303         * symtab.h (struct Symbol_location): Extract from..
304         (class Symbol_table): ..here.
305         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
306         * target.h (class Target): Add function_location and
307         do_function_location functions.
308         (class Sized_target): Add do_function_location.
309         * object.h (class Sized_relobj_file): Move find_shdr..
310         (class Object): ..to here.
311         * object.cc: Likewise.  Update to suit.  Instantiate.
312         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
313         * powerpc.cc (class Powerpc_dynobj): New.
314         (Target_powerpc::do_function_location): New function.
315         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
316         (Powerpc_dynobj::do_read_symbols): New function.
317         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
318
319 2013-03-08  Ian Lance Taylor  <iant@google.com>
320
321         * options.cc (General_options::string_to_object_format): Accept
322         "default".
323
324 2013-03-08  Alan Modra  <amodra@gmail.com>
325
326         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
327         pointer to Post_fde.
328         (struct Post_fde): Move definition to here..
329         * ehframe.cc (struct Post_fde): ..from here.
330         (Cie::write): Don't alloc Post_fde.
331         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
332
333 2013-03-07  Alan Modra  <amodra@gmail.com>
334
335         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
336         relocation referencing .LC0.
337         * testsuite/discard_locals_test.sh: Remove FIXMEs.
338
339 2013-03-07  Alan Modra  <amodra@gmail.com>
340
341         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
342         always_inline.  Add assembly for powerpc to avoid GOT.
343
344 2013-03-07  Alan Modra  <amodra@gmail.com>
345
346         * testsuite/script_test_10.sh: Don't test .bss section
347         header number.
348
349 2013-03-06  Alan Modra  <amodra@gmail.com>
350
351         * powerpc.cc (class Powerpc_relobj): Move some member functions.
352         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
353         all callers.  Handle folded sections.
354         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
355         to Powerpc_relobj.
356         (Global_symbol_visitor_opd::operator()): Likewise.
357
358 2013-03-04  Alan Modra  <amodra@gmail.com>
359
360         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
361         * testsuite/Makefile.in: Regenerate.
362
363 2013-03-01  Cary Coutant  <ccoutant@google.com>
364
365         Add dwp support for v2 DWARF package file format.
366         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
367         tu_length parameter.  Adjust all callers.
368         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
369         * dwp.cc: Include dwarf.h.
370         (Section_bounds): New struct type.
371         (Unit_set): New struct type.
372         (Dwo_file::Dwo_file): Initialize new data member.
373         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
374         Combine and rename to...
375         (Dwo_file::read_unit_index): ...this.
376         (Dwo_file::sized_read_compunit_index)
377         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
378         (Dwo_file::sized_read_unit_index): ...this.
379         (Dwo_file::copy_section): Remove section_name, is_str_offsets
380         parameters; add section_id parameter.
381         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
382         (Dwo_file::add_unit_set): ...this.
383         (Dwo_file::shndx_map_): Remove.
384         (Dwo_file::sect_offsets_): New data member.
385         (Dwp_output_file::Dwp_output_file): Initialize new data members.
386         (Dwp_output_file::add_section): Rename to...
387         (Dwp_output_file::add_contribution): ...this.
388         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
389         (Dwp_output_file::add_tu_set): Likewise.
390         (Dwp_output_file::Contribution): New type.
391         (Dwp_output_file::Section::contributions): New data member.
392         (Dwp_output_file::Cu_or_tu_set): Remove.
393         (Dwp_output_file::Section::Section): New ctor.
394         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
395         (Dwp_output_file::Dwp_index::Section_table): New type.
396         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
397         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
398         parameter.
399         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
400         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
401         (Dwp_output_file::Dwp_index::section_table): New member function.
402         (Dwp_output_file::Dwp_index::section_table_end): New member function.
403         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
404         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
405         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
406         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
407         (Dwp_output_file::Dwp_index::section_table_): New data member.
408         (Dwp_output_file::Dwp_index::section_mask_): New data member.
409         (Dwp_output_file::add_output_section): New member function.
410         (Dwp_output_file::write_new_section): New member function.
411         (Dwp_output_file::write_contributions): New member function.
412         (Dwp_output_file::section_id_map_): New data member.
413         (class Dwo_id_info_reader): Remove.
414         (class Unit_reader): New class.
415         (get_dwarf_section_name): New function.
416         (Dwo_file::read_executable): Adjust initializations of class data.
417         (Dwo_file::read): Add support for v2 package file format.
418         (Dwo_file::read_unit_index): Likewise.
419         (Dwo_file::sized_read_unit_index): Likewise.
420         (Dwo_file::copy_section): Likewise.
421         (Dwo_file::add_unit_set): Likewise.
422         (Dwp_output_file::add_output_section): Likewise.
423         (Dwp_output_file::add_contribution): Likewise.
424         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
425         for empty slot.
426         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
427         file format.
428         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
429         slot.
430         (Dwp_output_file::initialize): Remove unused function.
431         (Dwp_output_file::finalize): Add support for v2 package file format.
432         (Dwp_output_file::write_index): Likewise.
433         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
434         function prototype.
435
436 2013-03-01  Cary Coutant  <ccoutant@google.com>
437
438         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
439         function into class definition in header file.
440         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
441         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
442         New function.
443         (Dwarf_info_reader::check_buffer): Move here from .cc file.
444
445 2013-02-28  Alan Modra  <amodra@gmail.com>
446
447         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
448         * target.cc (Target::do_plt_fde_location): New function.
449         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
450         accessor function, and constructor param.
451         (struct Post_fde, Post_fdes): Declare.
452         (Cie::write): Add post_fdes param.
453         * ehframe.cc (Fde::write): Use plt_fde_location.
454         (struct Post_fde): Define.
455         (Cie::write): Stash FDEs added post merge mapping.
456         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
457         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
458         (Eh_frame::do_sized_write): Arrange to write post map FDES after
459         other FDEs.
460         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
461         (Target_powerpc::has_glink): New function.
462         (Target_powerpc::do_relax): Add eh_frame info for stubs.
463         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
464         glink_eh_frame_fde_32, default_fde): New data.
465         (Stub_table::eh_frame_added_): New var.
466         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
467         Make const.
468         (Stub_table::add_eh_frame): New function.
469         (Output_data_glink::add_eh_frame): New function.
470         (Target_powerpc::make_glink_section): Call add_eh_frame.
471
472 2013-02-15  Ian Lance Taylor  <iant@google.com>
473
474         * options.h (DEFINE_uint64_alias): Define.
475         (class General_options): Add -Ttext-segment as an alias for
476         -Ttext.
477
478 2013-02-15  Alan Modra  <amodra@gmail.com>
479
480         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
481         (Stub_table::do_write): ..here, two places.
482         (Stub_table::plt_call_size): Use it here too.
483
484 2013-02-11  Ian Lance Taylor  <iant@google.com>
485
486         * descriptors.cc (Descriptors::close_all): New function.
487         * descriptors.h (class Descriptors): Declare close_all.
488         (close_all_descriptors): New inline function.
489         * plugin.cc: Include "descriptors.h".
490         (Plugin_manager::cleanup): Call close_all_descriptors.
491
492 2013-02-06  Alan Modra  <amodra@gmail.com>
493
494         * README: Update coding style link.
495
496 2013-01-28  Cary Coutant  <ccoutant@google.com>
497
498         * dwp.cc (File_list): New typedef.
499         (Dwo_name_info_reader): New class.
500         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
501         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
502         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
503         (Dwo_file::read_executable): New function.
504         (Dwo_file::read): Move common setup code to ...
505         (Dwo_file::make_object): ... here.
506         (dwp_options): Add --exec/-e.
507         (usage): Likewise.
508         (main): Likewise.
509
510 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
511
512         * layout.cc (Layout::layout): Check for option text_reorder.
513         (Layout::make_output_section): Ditto.
514         * options.h (text_reorder): New option.
515         * output.cc (Input_section_sort_compare): Remove special ordering
516         of section names.
517         (Output_section::
518          Input_section_sort_section_name_special_ordering_compare::
519          operator()): New function.
520         (Output_section::sort_attached_input_sections): Use new sort function
521         for .text.
522         * output.h (Input_section_sort_section_name_special_ordering_compare):
523         New struct.
524         * testsuite/Makefile.am (text_section_grouping): Test option
525         --no-text-reorder
526         * testsuite/Makefile.in: Regenerate.
527         * testsuite/text_section_grouping.sh: Check order of functions without
528         default text reordering.
529
530 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
531
532         * options.h (General_options): Change default to true for new_dtags.
533
534 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
535
536         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
537         when enable_new_dtags is false.  Only add DT_RUNPATH when
538         enable_new_dtags is true.
539
540 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
541
542         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
543         used in declaration and definition consistent.
544         (Target_powerpc::symval_for_branch): Ditto.
545
546 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
547
548         * testsuite/plugin_final_layout.cc: Fix comment.
549
550 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
551
552         * layout.cc (Layout::layout): Do not do default sorting for
553         text sections when section ordering is specified.
554         (make_output_section): Ditto.
555         * testsuite/plugin_final_layout.cc: Name the function sections
556         to catch reordering issues.
557
558 2013-01-15  Alan Modra  <amodra@gmail.com>
559
560         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
561         plt-thread-safe.
562
563 2013-01-15  Alan Modra  <amodra@gmail.com>
564
565         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
566         * testsuite/Makefile.in: Regenerate.
567
568 2013-01-14  Alan Modra  <amodra@gmail.com>
569
570         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
571         * testsuite/Makefile.in: Regenerate.
572
573 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
574
575         PR bfd/14430
576         Fix mingw gold build with plugins enabled
577         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
578         * configure.ac: Export DLOPEN_LIBS and add headers check.
579         * plugin.cc: Handle non-dlfcn case.
580         * Makefile.in: Regenerate.
581         * config.in: Regenerate.
582         * configure: Regenerate.
583         * testsuite/Makefile.in: Regenerate.
584
585 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
586
587         * output.h (sort_attached_input_sections): Change to be public.
588         * script-sections.cc
589         (Output_section_definition::set_section_addresses): Sort
590         attached input sections according to section order before linker
591         script assigns section addresses.
592         (Orphan_output_section::set_section_addresses): Sort
593         attached input sections according to section order before linker
594         script assigns section addresses.
595         * Makefile.am (final_layout.sh): Use a simple linker script to
596         check if section ordering still works.
597         * Makefile.in: Regenerate.
598
599 2013-01-09  Ben Cheng  <bccheng@google.com>
600
601         * arm.cc (Target_arm::attributes_accept_div): New function.
602         (Target_arm::attributes_forbid_div): New function.
603         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
604         attribute using the same new functions as what bfd/elf32_arm.c
605         does.
606
607 2013-01-07  Cary Coutant  <ccoutant@google.com>
608
609         PR gold/14993
610         * output.cc (Output_section::add_input_section): For incremental
611         updates, don't track input sections that are allocated from patch
612         space.
613
614 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
615             Ian Lance Taylor  <iant@google.com>
616
617         PR gold/14897
618         * configure.ac (--enable-ld): Removed.
619         (install_as_default): Set to yes only for --enable-gold=default
620         or --disable-ld.
621         * configure: Regenerated.
622
623 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
624
625         * options.h (General_options): Add -fuse-ld= for GCC linker
626         option compatibility.
627
628 2013-01-04  Cary Coutant  <ccoutant@google.com>
629
630         * configure.ac: Fix typo restoring CXXFLAGS.
631         * configure: Regenerate.
632
633 2013-01-04  Cary Coutant  <ccoutant@google.com>
634
635         * testsuite/Makefile.am (CXXLINK_S): New macro.
636         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
637         * testsuite/Makefile.in: Regenerate.
638
639 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
640
641         * version.cc (print_version): Update copyright year to 2013.
642
643 2012-12-20  Ian Lance Taylor  <iant@google.com>
644
645         * layout.cc (Layout::special_ordering_of_input_section): New
646         function.
647         (Layout::layout): If input section requires special ordering, must
648         sort input sections.
649         (Layout::make_output_section): May sort .text input sections.
650         (Layout::is_section_name_prefix_grouped): Remove.
651         * layout.h (class Layout): Declare
652         special_ordering_of_input_section.  Don't declare
653         is_section_name_prefix_grouped.
654         * output.cc (Output_section::add_input_section): Revert last
655         change.
656         (Output_section::Input_section_sort::match_file_name): Don't crash
657         if called on output section data.
658         (Output_section::Input_section_sort_compare): Sort based on
659         special ordering.
660         (Output_section::Input_section_sort_section_order_index_compare):
661         Revert last patch.
662         (Output_section::sort_attached_input_sections): Likewise.
663
664 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
665
666         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
667         * layout.h (Layout::is_section_name_prefix_grouped): New function.
668         * output.cc (Output_section::add_input_section): Check if section
669         name contains special prefix.  Keep input sections to sort such
670         sections.
671         (Output_section::Input_section_sort_section_order_index_compare
672          ::operator()): Group sections according to prefixes.
673         (Output_section::sort_attached_input_sections): Add condition to
674         Input_section_entry constructor call.
675         * testsuite/Makefile.am (text_section_grouping): New test.
676         * testsuite/Makefile.in: Regenerate.
677         * testsuite/text_section_grouping.cc: New file.
678         * testsuite/text_section_grouping.sh: New file.
679
680 2012-12-17  Nick Clifton  <nickc@redhat.com>
681
682         * Makefile.am: Add copyright notice.
683         * NEWS: Likewise.
684         * README: Likewise.
685         * configure.ac: Likewise.
686         * ftruncate.c: Likewise.
687         * Makefile.in: Regenerate.
688
689 2012-12-14  Cary Coutant  <ccoutant@google.com>
690
691         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
692         --no-as-needed flag.
693         (exception_separate_shared_12_test): Likewise.
694         (incremental_copy_test): Likewise.
695         * testsuite/Makefile.in: Regenerate.
696
697 2012-12-14  Cary Coutant  <ccoutant@google.com>
698
699         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
700         (Dwp_output_file::Dwp_index::enter_set): Add assert.
701
702 2012-12-12  Alan Modra  <amodra@gmail.com>
703
704         * powerpc.cc (class Track_tls): New.
705         (class Relocate, class Scan): Inherit Track_tls.
706         (Target_powerpc::Scan::local, global): Track tls optimization
707         and avoid creating plt entry for __tls_get_addr if all uses
708         are optimized away.
709         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
710
711 2012-12-12  Alan Modra  <amodra@gmail.com>
712
713         * options.h (General_options): Add --toc-sort/--no-toc-sort.
714         Replace no_toc_optimize with toc_optimize.
715         * output.h (Output_section::input_sections): Provide non-const variant.
716         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
717         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
718         accessors.
719         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
720         (class Sort_toc_sections): New.
721         (Target_powerpc::do_finalize_sections): Sort toc sections.
722         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
723
724 2012-12-10  Roland McGrath  <mcgrathr@google.com>
725
726         * testsuite/binary_unittest.cc (read_all): New function.
727         (Sized_binary_test): Use it instead of ::read.
728         * fileread.cc (do_read): Don't assume pread always reads the whole
729         amount in a single call.
730
731 2012-12-10  Alan Modra  <amodra@gmail.com>
732
733         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
734         Set EM_PPC64 or EM_PPC here.
735         (Target_selector_powerpc::do_recognize): Delete.
736
737 2012-12-10  Alan Modra  <amodra@gmail.com>
738
739         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
740         stub_table_.
741         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
742
743 2012-12-07  Roland McGrath  <mcgrathr@google.com>
744
745         * testsuite/binary_unittest.cc (Sized_binary_test):
746         Use open_descriptor rather than ::open.
747
748 2012-12-07  Alan Modra  <amodra@gmail.com>
749
750         * powerpc.cc (Stub_table::do_write): Delete redundant Address
751         typedef and invalid_address constant.
752         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
753         instantiate constants.
754
755 2012-12-06  Roland McGrath  <mcgrathr@google.com>
756
757         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
758         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
759         * aclocal.m4: Regenerate.
760         * configure: Regenerate.
761         * Makefile.in: Regenerate.
762         * testsuite/Makefile.in: Regenerate.
763
764 2012-12-07  Alan Modra  <amodra@gmail.com>
765
766         * options.h (General_options): Add no_toc_optimize.
767         * powerpc.cc (ok_lo_toc_insn): New function.
768         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
769
770 2012-12-06  Alan Modra  <amodra@gmail.com>
771
772         * options.h (General_options): Add plt_align, plt_static_chain,
773         plt_thread_safe.  Update stub_group_size help text.
774         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
775         for new plt_thread_safe_ var.
776         (use_plt_offset): Correct comments.
777         (Target_powerpc::do_relax): Look for thread creation symbols to
778         determine default plt_thread_safe value.  Clear plt call stubs
779         as well as branch stubs each iteration.
780         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
781         insn constants.
782         (l, hi, ha, write_insn): Move earlier.
783         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
784         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
785         plt stubs too.
786         (Stub_table::update_size): Adjust.
787         (Stub_table::prev_size, set_prev_size): Delete.
788         (Stub_table::stub_align): Let --plt-align affect result.
789         (Stub_table::plt_call_size): Calculate sizes for various stubs.
790         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
791         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
792         (Stub_table::do_write): Support more stub variants.
793
794 2012-12-04  Alan Modra  <amodra@gmail.com>
795
796         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
797         (Target_powerpc::do_define_standard_symbols): New function.
798
799 2012-12-03  Alan Modra  <amodra@gmail.com>
800
801         * output.h: Formatting, whitespace.
802
803 2012-12-03  Alan Modra  <amodra@gmail.com>
804
805         * layout.h (Layout::get_executable_sections): Declare.
806         * layout.cc (Layout::get_executable_sections): New function.
807         * arm.cc (Target_arm::group_sections): Use it.
808         (Arm_output_section::group_sections): Delete now redundant test.
809         * output.cc (Output_reloc::Output_reloc): Add is_relative.
810         param to handle relative relocs.
811         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
812         (Output_data_reloc::add_absolute): Adjust.
813         (Output_data_reloc::add_relative): New function.
814         (Output_data::reset_data_size): New function.
815         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
816         (Output_section::set_addralign): New function.
817         (Output_section::checkpoint_set_addralign): New function.
818         (Output_section::clear_section_offsets_need_adjustment): New function.
819         (Output_section::input_sections): Make public.
820         * powerpc.cc (class Output_data_brlt_powerpc): New.
821         (class Stub_table, class Stub_control): New.
822         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
823         stub_table_, set_stub_table, stub_table): New vectors and accessor
824         functions.
825         (Target_powerpc::do_may_relax, do_relax, push_branch,
826         new_stub_table, stub_tables, brlt_section, group_sections,
827         add_branch_lookup_table, find_branch_lookup_table,
828         write_branch_lookup_table, make_brlt_section): New functions.
829         (Target_powerpc::struct Sort_sections, class Branch_info): New.
830         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
831         branch_info_): New vars.
832         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
833         make call stubs here.
834         (Output_data_glink): Remove all call stub handling from this class.
835         (Target_powerpc::Scan::local, global): Save interesting branch
836         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
837         (Target_powerpc::do_finalize_sections): Only make reg save/restore
838         functions on final link.
839         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
840         Handle long branch destinations too.
841         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
842         do_plt_address_for_local): Adjust lookup of plt call stubs.
843
844 2012-11-30  Alan Modra  <amodra@gmail.com>
845
846         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
847         relocs against protected symbols when building 32-bit shared libs.
848
849 2012-11-30  Alan Modra  <amodra@gmail.com>
850
851         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
852         param.  Call got_section() to make .got.  Update all callers
853         and their callers and so on.
854
855 2012-11-30  Alan Modra  <amodra@gmail.com>
856
857         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
858         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
859         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
860         value if it already exists.
861
862 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
863
864         PR gold/14858
865         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
866
867 2012-11-14  Roland McGrath  <mcgrathr@google.com>
868
869         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
870         than bfc instruction for data sandboxing.
871
872 2012-11-08  Alan Modra  <amodra@gmail.com>
873
874         * po/POTFILES.in: Regenerate.
875
876 2012-11-05  Alan Modra  <amodra@gmail.com>
877
878         * configure.ac: Apply 2012-09-10 change to config.in here.
879         * configure: Regenerate.
880
881 2012-11-05  Alan Modra  <amodra@gmail.com>
882
883         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
884         (struct Opd_ent): Use "Address" rather than "Offset".
885         (Output_data_got_powerpc::got_base_offset): Return Valtype.
886         (Target_powerpc::got_section): Make public.
887         (Target_powerpc::scan_relocs): Move code setting symbols..
888         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
889         Create _SDA_BASE_ only when referenced.
890
891 2012-11-02  Roland McGrath  <mcgrathr@google.com>
892
893         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
894         from last change.
895
896 2012-11-01  Roland McGrath  <mcgrathr@google.com>
897
898         * target.h (Sized_target::relocate_relocs): Use Elf_Off
899         for offset_in_output_section parameter.
900         (Sized_target::relocate_special_relocatable): Likewise.
901         * arm.cc (Target_arm::relocate_relocs): Likewise.
902         (Target_arm::relocate_special_relocatable): Likewise.
903         * i386.cc (Target_i386::relocate_relocs): Likewise.
904         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
905         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
906         * target-reloc.h (relocate_relocs): Likewise.
907         * testsuite/testfile.cc (Target_test): Likewise.
908         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
909         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
910
911         * system.h: Move inclusion of <clocale> to after <libintl.h> in
912         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
913
914         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
915         parameter, which is unused in the [!F_SETFD] case.
916
917         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
918         SYMNDX to off_t before comparing it to this->data_size().
919         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
920         * incremental.cc (Output_section_incremental_inputs::do_write):
921         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
922
923         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
924
925 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
926
927         * gold.cc (Target_arm::do_adjust_elf_header): Add the
928         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
929         in EABI_VER5.
930
931 2012-10-29  Cary Coutant  <ccoutant@google.com>
932
933         * dwp.cc (usage): Add file and exit status parameters;
934         add --help and --version options.
935         (print_version): New function.
936         (main): Add --help and --version options.
937
938 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
939
940         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
941         final_layout_sequence.txt.
942         * testsuite/Makefile.in: Regenerated.
943
944 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
945
946         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
947         COMPILE generated by automake.
948         (LINK1): Likewise.
949         (CXXCOMPILE1): Likewise.
950         (CXXLINK1): Likewise.
951         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
952         (LINK): Likewise.
953         (CXXCOMPILE): Likewise.
954         (CXXLINK): Likewise.
955         * testsuite/Makefile.in: Regenerated.
956
957 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
958
959         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
960         on bad fwrite return.
961
962 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
963
964         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
965         on val.
966
967 2012-10-23  Cary Coutant  <ccoutant@google.com>
968
969         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
970         * testsuite/Makefile.in: Regenerate.
971         * testsuite/dwp_test.h: New source file.
972         * testsuite/dwp_test_1.cc: New source file.
973         * testsuite/dwp_test_1.s: New source file.
974         * testsuite/dwp_test_1.sh: New source file.
975         * testsuite/dwp_test_1b.cc: New source file.
976         * testsuite/dwp_test_1b.s: New source file.
977         * testsuite/dwp_test_2.cc: New source file.
978         * testsuite/dwp_test_2.s: New source file.
979         * testsuite/dwp_test_2.sh: New source file.
980         * testsuite/dwp_test_main.cc: New source file.
981         * testsuite/dwp_test_main.s: New source file.
982
983 2012-10-23  Cary Coutant  <ccoutant@google.com>
984
985         * dwp.h: New header file.
986         * dwp.cc: New source file.
987         * gold.h: Move shared declarations to system.h.
988         * system.h: New header file.
989         * Makefile.am: Add dwp.
990         * Makefile.in: Regenerate.
991
992 2012-10-23  Cary Coutant  <ccoutant@google.com>
993
994         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
995         Dwarf_info_reader::read_from_pointer.
996         (Dwarf_pubnames_table::read_header): Likewise.
997         (Dwarf_pubnames_table::next_name): Likewise.
998         (Dwarf_die::read_attributes): Likewise.
999         (Dwarf_die::skip_attributes): Likewise.
1000         (Dwarf_info_reader::read_from_pointer): New function template.
1001         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1002         (Dwarf_pubnames_table): Likewise.
1003         (Dwarf_info_reader::read_from_pointer): New function template.
1004         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1005         Dwarf_pubnames_table ctor.
1006
1007 2012-10-23  Cary Coutant  <ccoutant@google.com>
1008
1009         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1010         abbrev_shndx.
1011         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1012         abbrev_shndx_.
1013         (Dwarf_info_reader::set_abbrev_shndx): New method.
1014         (Dwarf_info_reader::abbrev_shndx_): New data member.
1015
1016 2012-10-23  Cary Coutant  <ccoutant@google.com>
1017
1018         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1019         from object, not parameters.
1020         (Dwarf_info_reader::parse): Likewise.
1021         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1022         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1023         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1024         methods.
1025
1026 2012-10-23  Cary Coutant  <ccoutant@google.com>
1027
1028         * fileread.cc (Input_file::Input_file): New constructor.
1029         * fileread.h (class Input_file): Add new constructor.
1030
1031 2012-10-18  Alan Modra  <amodra@gmail.com>
1032
1033         PR gold/14727
1034         * object.cc (Relobj::is_section_name_included): Also match
1035         .sdata personality section.
1036
1037 2012-10-18  Alan Modra  <amodra@gmail.com>
1038
1039         * target-reloc.h (class Default_comdat_behavior): New, package up..
1040         (get_comdat_behaviour): ..this.
1041         (relocate_section): Add Relocate_comdat_behavior template arg,
1042         adjust code to suit.
1043         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1044         (Target_arm::scan_reloc_section): Likewise.
1045         * i386.cc (Target_i386::relocate_section): Likewise.
1046         * sparc.cc (Target_sparc::relocate_section): Likewise.
1047         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1048         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1049         * powerpc.cc (class Relocate_comdat_behavior): New.
1050         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1051         gold::relocate_section with new template arg.
1052
1053 2012-10-18  Alan Modra  <amodra@gmail.com>
1054
1055         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1056         dynamic relocs for GOT_TPREL got entries, without symbol if
1057         resolving locally.
1058         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1059         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1060         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1061
1062 2012-10-17  Alan Modra  <amodra@gmail.com>
1063
1064         PR gold/14726
1065         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1066
1067 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1068
1069         * layout.cc (Layout::include_section): Keep sections marked
1070         SHF_EXCLUDE when doing relocatable links.
1071
1072 2012-10-16  Alan Modra  <amodra@gmail.com>
1073
1074         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1075         (Target_powerpc::do_finalize_sections): Call it.
1076         (Output_data_save_res): New class and supporting functions.
1077         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1078         normal symbols defined in object files.
1079
1080 2012-10-12  Alan Modra  <amodra@gmail.com>
1081
1082         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1083         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1084         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1085         section if scan_opd_relocs not yet called.
1086         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1087
1088 2012-10-12  Alan Modra  <amodra@gmail.com>
1089
1090         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1091         add_local_ifunc_entry): Revert last change.
1092         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1093
1094 2012-10-05  Alan Modra  <amodra@gmail.com>
1095
1096         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1097         do_plt_address_for_global): New functions.
1098         (Output_data_got_powerpc::do_write): Don't segfault when linking
1099         statically.
1100         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1101         add_local_ifunc_entry): Return true on adding entry..
1102         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1103         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1104         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1105         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1106         set up symbols here.
1107         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1108         syms here.  Do so even when no .iplt.  Don't segfault when linking
1109         statically.
1110         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1111         new variants without reloc param.
1112         (Glink_sym_ent::Glink_sym_ent): Likewise.
1113         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1114         reloc when refs will resolve to plt call stub.
1115         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1116         R_PPC_PLTREL24 to resolve locally.
1117         (Target_powerpc::Scan::global): Correct ifunc handling.
1118         (Target_powerpc::Relocate::relocate): Correct local sym glink
1119         lookup.  Don't destroy "value" when we have a plt call stub,
1120         and when checking plt call validity.
1121         (Target_powerpc::do_dynsym_value): Simplify.
1122
1123 2012-10-05  Alan Modra  <amodra@gmail.com>
1124
1125         * i386.cc (Output_data_plt_i386::address_for_global,
1126         address_for_local): Add plt offset to returned value.  Adjust uses.
1127         * sparc.cc (Output_data_plt_sparc::address_for_global,
1128         address_for_local): Likewise.
1129         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1130         address_for_local): Likewise.
1131         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1132         address_for_local): Likewise.
1133         * target.h (Target::plt_address_for_global, plt_address_for_local):
1134         Update comment.
1135         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1136         (Output_data_got::Got_entry::write): Nor here.
1137         * output.h: Comment fix.
1138
1139 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1140
1141         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1142         global_offset_table_ value for larget got.
1143         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1144
1145 2012-09-29  Alan Modra  <amodra@gmail.com>
1146
1147         * powerpc.cc (Target_powerpc::iplt_): New output section.
1148         (Target_powerpc::iplt_section, make_iplt_section,
1149         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1150         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1151         Target_powerpc::plt_entry_count): Count iplt entries too.
1152         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1153         reloc section in constructor.  New params.
1154         (Target_powerpc::make_plt_section): Create reloc section here instead.
1155         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1156         functions.
1157         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1158         (Output_data_glink::add_entry, find_entry): New functions to
1159         deal with local syms.
1160         (Glink_sym_ent): Add support for local syms.
1161         (Output_data_glink::do_write): Handle ifunc plt entries.
1162         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1163         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1164         (Target_powerpc::Relocate::relocate): Likewise.
1165         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1166
1167 2012-09-25  Alan Modra  <amodra@gmail.com>
1168
1169         * object.h (Sized_relobj_file::adjust_local_symbol,
1170         do_adjust_local_symbol): New functions.
1171         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1172         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1173         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1174         and irregular opd entry spacing.
1175         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1176         (Global_symbol_visitor_opd): New functor.
1177         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1178         on deleted opd entries.
1179
1180 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1181
1182         * tilegx.cc: New file.
1183         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1184         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1185         * configure.tgt: Add entries for tilegx*.
1186         * configure.ac: Likewise.
1187         * Makefile.in: Rebuild.
1188         * configure: Likewise.
1189         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1190         tilegx.
1191
1192 2012-09-13  Alan Modra  <amodra@gmail.com>
1193
1194         * target-reloc.h (scan_relocs): Call scan.local for relocs
1195         against symbols in discarded sections.  Pass is_discarded
1196         param.
1197         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1198         Add is_discarded param.
1199         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1200         is_discarded to flag opd entry as discarded.  Don't emit dyn
1201         relocs on such entries.
1202         (Target_powerpc::Scan::global): Similarly detect and handle
1203         such opd entries.
1204         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1205         opd_ent_.  Update all uses.
1206         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1207         (Target_powerpc::relocate_section): Zero out discarded opd
1208         entry relocs.
1209
1210 2012-09-12  Ian Lance Taylor  <iant@google.com>
1211
1212         PR gold/14570
1213         * output.cc: Rename Output_data_got template parameter from size
1214         to got_size for all functions.  Compile all variants of
1215         Output_data_got.
1216         (Output_data_got::Got_entry::write): Correct use of size for
1217         symbol value.  Use local_is_tls rather than casting to
1218         Sized_relobj_file.
1219         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1220         (class Sized_relobj_file): Add do_local_is_tls.
1221         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1222
1223 2012-09-11  Alan Modra  <amodra@gmail.com>
1224
1225         PR gold/14566
1226         * layout.cc (Layout::set_segment_offsets): When using
1227         common-page-size alignment, ensure we are on a new max-page-size
1228         page.
1229         * output.cc (Output_segment::set_section_addresses): Use
1230         abi_pagesize, not common_pagesize for relro boundary.
1231         (Output_segment::set_offset): Likewise.
1232
1233 2012-09-11  Alan Modra  <amodra@gmail.com>
1234
1235         * output.h (Output_data_got::add_global_tls, add_local_tls,
1236         add_local_tls_pair): New functions.
1237         (Output_data_got::add_local_pair_with_rel): Remove second
1238         reloc param.  Expand comment.
1239         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1240         use_plt_or_tls_offset_, similarly for constructor param.
1241         (Output_data_got::Got_entry::write): Add got_index param.
1242         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1243         add_local_tls_pair): New functions.
1244         (Output_data_got::Got_entry::write): Handle tls symbols
1245         with use_plt_or_tls_offset_ set specially.
1246         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1247         (Output_data_got::do_write): Replace iterator with index, pass
1248         index to entry write function.
1249         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1250         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1251         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1252         call.
1253         * i386.cc (Target_i386::Scan::local): Likewise.
1254         * sparc.cc (Target_sparc::Scan::local): Likewise.
1255         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1256         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1257         do_tls_offset_for_global): New functions.
1258         (Target_powerpc::Scan::local): Correct TLS relocations and got
1259         entry values.
1260         (Target_powerpc::Scan::global): Don't emit unnecessary
1261         dynamic relocations on TLS GOT entries.
1262
1263 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1264
1265         * config.in: Disable sanity check for kfreebsd.
1266
1267 2012-09-10  Sterling Augustine  <saugustine@google.com>
1268
1269         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1270         (Gdb_index::pubtypes_read): New parameter.
1271         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1272         to calls.
1273         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1274         pubtypes_object_.
1275
1276 2012-09-09  Alan Modra  <amodra@gmail.com>
1277
1278         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1279         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1280         * gc.h (gc_process_relocs): Call target gc_add_reference.
1281         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1282         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1283         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1284         unnecessary cast.
1285         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1286         to cater for when we don't need code offset.  Update use.
1287         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1288         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1289         set_opd_valid): New functions.
1290         (Target_powerpc::do_gc_add_reference): New function.
1291         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1292         stashed refs.
1293         (Target_powerpc::do_gc_mark_symbol): New function.
1294
1295 2012-09-06  Cary Coutant  <ccoutant@google.com>
1296
1297         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1298         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1299         (Dwarf_die::skip_attributes): Likewise.
1300         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1301         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1302         (main): Call it.
1303         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1304
1305 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1306
1307         * testsuite/script_test_3.t: Add .got.plt output section
1308         statement.
1309         * testsuite/script_test_4.t: Likewise.
1310
1311 2012-09-05  Alan Modra  <amodra@gmail.com>
1312
1313         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1314         update all uses and lose "enum" when using type.
1315
1316 2012-09-05  Alan Modra  <amodra@gmail.com>
1317
1318         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1319         * configure: Regenerate.
1320         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1321         (plugin_final_layout.stdout): Likewise.
1322         (memory_test): Set page sizes to 0x1000.
1323         * testsuite/Makefile.in: Regenerate.
1324         * testsuite/discard_locals_test.sh: Add FIXME comment.
1325         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1326         * testsuite/pr14265.t: Add .got output section statement.
1327         * testsuite/script_test_2.t: Likewise.
1328         * testsuite/script_test_3.t: Likewise.
1329         * testsuite/script_test_4.t: Likewise.
1330         * testsuite/script_test_5.t: Likewise.
1331         * testsuite/script_test_6.t: Likewise.
1332         * testsuite/script_test_7.t: Likewise.
1333         * testsuite/script_test_9.t: Likewise.
1334
1335 2012-09-05  Alan Modra  <amodra@gmail.com>
1336
1337         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1338         (Powerpc_relocate_functions::Status): New typedef.
1339         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1340         (Target_powerpc::Scan::local): Handle REL64.
1341         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1342         for REL32 and REL64.
1343         (Target_powerpc::symval_for_branch): New function, extracted from..
1344         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1345         checks.  Report overflow errors.
1346
1347 2012-09-05  Alan Modra  <amodra@gmail.com>
1348
1349         * object.h (Sized_relobj_file::emit_relocs): Delete.
1350         (Sized_relobj_file::emit_relocs_reltype): Delete.
1351         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1352         relocate_relocs for --emit-relocs.
1353         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1354         * output.h: Update comment.
1355         (Output_segment::first_section): New function.
1356         (Output_segment::first_section_load_address): Use first_section.
1357         * output.cc (Output_segment::first_section): New function extracted..
1358         (Output_segment::first_section_load_address): ..from here.  Delete.
1359         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1360         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1361         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1362         adjust call to target.h function.
1363         * i386.cc (Target_i386): Likewise.
1364         * sparc.cc (Target_sparc): Likewise.
1365         * x86_64.cc (Target_x86_64): Likewise.
1366         * powerpc.cc (Target_powerpc): Likewise.
1367         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1368         first tls section has section symbol for optimised local dynamic
1369         output relocs.
1370         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1371         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1372         optimised tls code.
1373         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1374         Rename to relocate_relocs.  Update error message.
1375
1376 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1377
1378         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1379         --just-symbols.
1380
1381 2012-08-31  Alan Modra  <amodra@gmail.com>
1382
1383         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1384         (Powerpc_relobj::toc_base_offset): New stub function.
1385         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1386         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1387         (Target_powerpc::Relocate::enum skip_tls): New.
1388         (Target_powerpc::call_tls_get_addr_): New var.
1389         (Target_powerpc::is_branch_reloc): Move to file scope.
1390         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1391         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1392         New functions.
1393         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1394         (powerpc_info): Correct common_pagesize for ppc64.
1395         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1396         (Powerpc_relocate_functions): Add overflow check enums and functions.
1397         Add non-shift version of rela, rela_ua.  Delete all rel public
1398         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1399         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1400         addr16_ha3, addr14 functions.
1401         (Output_data_got_powerpc::add_constant_pair): New function.
1402         (Output_data_got_powerpc::got_base_offset): Likewise.
1403         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1404         (instruction constants): Sort, add some more.
1405         (Output_data_glink::do_write): Add and use Address typedef.  Use
1406         object->toc_base_offset() stub for 64-bit.
1407         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1408         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1409         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1410         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1411         Always treat .opd relocs as against locally defined symbol.
1412         Correct condition for RELATIVE relocs.
1413         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1414         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1415         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1416         calculations.  Handle TLS relocs, and more.  Add overflow
1417         checking and adjust for Powerpc_relocate_functions changes.
1418         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1419         Reinstate --emit-relocs code with FIXME.
1420
1421 2012-08-30  Alan Modra  <amodra@gmail.com>
1422
1423         * layout.cc (Layout::set_segment_offsets): Set p_align to
1424         abi_pagesize, not common_pagesize.
1425         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1426         to determine whether file header can go in segment.
1427
1428 2012-08-30  Alan Modra  <amodra@gmail.com>
1429
1430         * output.h (Output_reloc::Output_reloc <output section>): Add
1431         is_relative param.  Adjust calls.
1432         (Output_reloc::add_output_section_relative): New functions.
1433         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1434         is_relative.
1435         (Output_reloc::symbol_value): Handle SECTION_CODE.
1436
1437 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1438
1439         * gold.cc (queue_middle_tasks): Call layout again when unique
1440         segments for sections is desired.
1441         * layout.cc (Layout::Layout): Initialize new members.
1442         (Layout::get_output_section_flags): New function.
1443         (Layout::choose_output_section): Call get_output_section_flags.
1444         (Layout::layout): Make output section for mapping to a unique segment.
1445         (Layout::insert_section_segment_map): New function.
1446         (Layout::attach_allocated_section_to_segment): Make unique segment for
1447         output sections marked so.
1448         (Layout::segment_precedes): Check for unique segments when sorting.
1449         * layout.h (Layout::Unique_segment_info): New struct.
1450         (Layout::Section_segment_map): New typedef.
1451         (Layout::insert_section_segment_map): New function.
1452         (Layout::get_output_section_flags): New function.
1453         (Layout::is_unique_segment_for_sections_specified): New function.
1454         (Layout::set_unique_segment_for_sections_specified): New function.
1455         (Layout::unique_segment_for_sections_specified_): New member.
1456         (Layout::section_segment_map_): New member.
1457         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1458         Rename is_gc_pass_one to is_pass_one.
1459         Rename is_gc_pass_two to is_pass_two.
1460         Rename is_gc_or_icf to is_two_pass.
1461         Check for which pass based on whether symbols data is present.
1462         Make it two pass when unique segments for sections is desired.
1463         * output.cc (Output_section::Output_section): Initialize new
1464         members.
1465         * output.h (Output_section::is_unique_segment): New function.
1466         (Output_section::set_is_unique_segment): New function.
1467         (Output_section::is_unique_segment_): New member.
1468         (Output_section::extra_segment_flags): New function.
1469         (Output_section::set_extra_segment_flags): New function.
1470         (Output_section::extra_segment_flags_): New member.
1471         (Output_section::segment_alignment): New function.
1472         (Output_section::set_segment_alignment): New function.
1473         (Output_section::segment_alignment_): New member.
1474         (Output_segment::Output_segment): Initialize is_unique_segment_.
1475         (Output_segment::is_unique_segment): New function.
1476         (Output_segment::set_is_unique_segment): New function.
1477         (Output_segment::is_unique_segment_): New member.
1478         * plugin.cc (allow_unique_segment_for_sections): New function.
1479         (unique_segment_for_sections): New function.
1480         (Plugin::load): Add new functions to transfer vector.
1481         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1482         * Makefile.in: Regenerate.
1483         * testsuite/plugin_final_layout.sh: Check if unique segment
1484         functionality works.
1485         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1486         are available.
1487         (allow_unique_segment_for_sections): New global.
1488         (unique_segment_for_sections): New global.
1489         (claim_file_hook): Call allow_unique_segment_for_sections.
1490         (all_symbols_read_hook): Call unique_segment_for_sections.
1491
1492 2012-08-22  Cary Coutant  <ccoutant@google.com>
1493
1494         * layout.cc (Layout::include_section): Don't assert on GROUP
1495         sections with --emit-relocs.
1496
1497 2012-08-21  Cary Coutant  <ccoutant@google.com>
1498
1499         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1500         if --export-dynamic-symbol names an undef symbol.
1501
1502 2012-08-18  Alan Modra  <amodra@gmail.com>
1503
1504         * powerpc.cc: Formatting and white space.
1505         (Powerpc_relobj): Rename got2_section_ to special_.
1506         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1507         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1508         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1509         (Target_powerpc): Add Address typedef and invalid_address.  Use
1510         throughout.
1511         (Target_powerpc::is_branch_reloc): New function.
1512         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1513         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1514         for dst_mask, value and addend.
1515         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1516         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1517         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1518         uint16_t for 24-bit offset.  Use get_output_section_offset and
1519         check return.
1520         (Target_powerpc::Scan::local): Handle more relocs.
1521         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1522         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1523         Plug in toc restoring insn after plt calls.  Translate branches
1524         to function descriptor symbols to corresponding entry point.
1525         (Target_powerpc::relocate_for_relocatable): Check return from
1526         get_output_section_offset.
1527         * symtab.h: Comment typo.
1528
1529 2012-08-14  Ian Lance Taylor  <iant@google.com>
1530
1531         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1532         unsupported_relocal_local to call unsupported_reloc_global.
1533
1534 2012-08-14  Nick Clifton  <nickc@redhat.com>
1535
1536         PR ld/14265
1537         * script-sections.cc (Sections_element::output_section_name): Add
1538         keep return parameter.
1539         (Output_section_element::match_name): Add keep return parameter.
1540         Return the value of the keep_ member.
1541         * script-sections.h (class Output_section): Update
1542         output_section_name prototype.
1543         * layout.cc (Layout::keep_input_section): New public member
1544         function.
1545         (Layout::choose_output_section): Pass keep parameter to
1546         output_section_name.
1547         * layout.h (class Layout): Add keep_input_section.
1548         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1549         sections.
1550         * testsuite/Makefile.am: Add a test.
1551         * testsuite/Makefile.in: Regenerate.
1552         * testsuite/pr14265.c: Source file for the test.
1553         * testsuite/pr14265.t: Linker script for the test.
1554         * testsuite/pr14265.sh: Shell script for the test.
1555
1556 2012-08-14  Alan Modra  <amodra@gmail.com>
1557
1558         * target.h (Target::output_section_name): New function.
1559         (Target::do_output_section_name): New function.
1560         * layout.cc (Layout::choose_output_section): Call the above.
1561         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1562
1563 2012-08-14  Alan Modra  <amodra@gmail.com>
1564
1565         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1566         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1567         for replace_constant call.
1568         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1569         (Output_data_glink::do_print_to_mapfile): New function.
1570         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1571         (Target_powerpc::Relocate::relocate): Likewise.
1572
1573 2012-08-14  Alan Modra  <amodra@gmail.com>
1574
1575         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1576         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1577         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1578         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1579         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1580         here.
1581         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1582         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1583         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1584         here.
1585         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1586         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1587
1588 2012-08-12  Alan Modra  <amodra@gmail.com>
1589
1590         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1591         (glink insn constants): Use uint32_t.
1592         (Output_data_glink::add_entry): Use insert, not [] operator.
1593
1594 2012-08-11  Alan Modra  <amodra@gmail.com>
1595
1596         * object.h (Sized_relobj_file::find_shdr): New function.
1597         (Sized_relobj_file::find_special_sections): New function.
1598         * object.cc (Sized_relobj_file::find_shdr): New function.
1599         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1600         (Sized_relobj_file::find_special_sections): New function, split out..
1601         (Sized_relobj_file::do_read_symbols): ..from here.
1602         * output.h (Output_data_got::replace_constant): New function.
1603         (Output_data_got::num_entries): New function.
1604         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1605         (Output_data_got::got_offset): Protected rather than private.
1606         (Output_data_got::replace_got_entry): New function.
1607         * output.cc (Output_data_got::replace_got_entry): New function.
1608         * powerpc.cc (class Powerpc_relobj): New.
1609         (class Powerpc_relocate_functions): Delete all psymval variants or
1610         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1611         Implement _ha functions using corresponding _hi function.
1612         (Powerpc_relobj::find_special_sections): New function.
1613         (Target_powerpc::do_make_elf_object): New function.
1614         (class Output_data_got_powerpc): New.
1615         (class Output_data_glink): New.
1616         (class Powerpc_scan_relocatable_reloc): New.
1617         Many more changes througout file.
1618
1619 2012-08-09  Nick Clifton  <nickc@redhat.com>
1620
1621         * po/vi.po: Updated Vietnamese translation.
1622
1623 2012-08-07  Ian Lance Taylor  <iant@google.com>
1624
1625         * layout.cc (Layout::add_target_dynamic_tags): If
1626         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1627         plt_rel.
1628
1629 2012-07-30  Nick Clifton  <nickc@redhat.com>
1630
1631         * po/gold.pot: Updated template.
1632         * po/es.po: Updated Spanish translation.
1633
1634 2012-07-18  Cary Coutant  <ccoutant@google.com>
1635
1636         PR gold/14344
1637         * configure.ac: Add check for -gpubnames support.
1638         * configure: Regenerate.
1639         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1640         support; force -gno-pubnames.
1641         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1642         support.
1643         (gdb_index_test_4): New test.
1644         * testsuite/Makefile.in: Regenerate.
1645         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1646         * testsuite/gdb_index_test_2.sh: Likewise.
1647         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1648         * testsuite/gdb_index_test_4.sh: New script.
1649         * testsuite/gdb_index_test_comm.sh: New script with common code;
1650         don't look for space after colon.
1651
1652 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1653
1654         * gold.cc (queue_middle_tasks): Update function order only after
1655         deferred objects due to plugins are processed.
1656
1657 2012-07-11  Ian Lance Taylor  <iant@google.com>
1658
1659         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1660         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1661         (Target_arm::scan_reloc_for_stub): Likewise.
1662         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1663         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1664         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1665         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1666         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1667
1668 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1669             Ian Lance Taylor  <iant@google.com>
1670
1671         PR gold/14309
1672         * configure.ac: Test whether std::tr1::hash<off_t> works.
1673         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1674         needed.
1675         * output.h (class Output_fill): Add virtual destructor.
1676         * configure, config.in: Rebuild.
1677
1678 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1679
1680         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1681
1682 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1683
1684         * plugin.cc (Plugin::load): Handle position independent executables.
1685
1686 2012-06-06  Cary Coutant  <ccoutant@google.com>
1687
1688         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1689         add .debug_macro.
1690         (lines_only_debug_sections): Likewise.
1691         (gdb_fast_lookup_sections): New static array.
1692         (is_gdb_debug_section): Rename formal parameter.
1693         (is_lines_only_debug_section): Likewise.
1694         (is_gdb_fast_lookup_section): New function.
1695         (Layout::include_section): Check for ".zdebug_" prefix; pass
1696         section name suffix to is_gdb_debug_section, et al.; check for
1697         fast-lookup sections when building .gdb_index.
1698         * options.h (--strip-debug-gdb): Update GDB version number.
1699
1700 2012-06-06  Cary Coutant  <ccoutant@google.com>
1701
1702         * configure.ac: Add check for fallocate.
1703         * configure: Regenerate.
1704         * config.in: Regenerate.
1705
1706         * options.h (class General_options): Add --mmap-output-file and
1707         --posix-fallocate options.
1708         * output.cc: (posix_fallocate): Remove; replace with...
1709         (gold_fallocate): New function.
1710         (Output_file::map_no_anonymous): Call gold_fallocate.
1711         (Output_file::map): Check --mmap-output-file option.
1712
1713 2012-06-05  Jing Yu  <jingyu@google.com>
1714
1715         * gold.h (textdomain): Add do {} to empty while(0).
1716         (bindtextdomain): Likewise.
1717
1718 2012-06-04  Cary Coutant  <ccoutant@google.com>
1719
1720         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1721         has_dynsym_index.
1722
1723 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1724
1725         * symtab.cc (Symbol_table::define_special_symbol):
1726         Initialize *poldsym to prevent uninitialized variable errors.
1727
1728 2012-05-23  Cary Coutant  <ccoutant@google.com>
1729
1730         * layout.cc (Layout::section_name_mapping): Add rules to handle
1731         exact match on .data.rel.ro.local or .data.rel.ro.
1732         (Layout::output_section_name): Check for exact matches.
1733
1734 2012-05-23  Cary Coutant  <ccoutant@google.com>
1735
1736         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1737         more carefully.
1738
1739 2012-05-22  Cary Coutant  <ccoutant@google.com>
1740
1741         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1742         object before exporting symbol.
1743
1744 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1745
1746         * testsuite/tls_test.cc: Include "config.h" first.
1747         * testsuite/tls_test_c.c: Likewise.
1748
1749 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1750             Nick Clifton  <nickc@redhat.com>
1751
1752         PR 14072
1753         * configure.in: Add check that sysdep.h has been included before
1754         any system header files.
1755         * configure: Regenerate.
1756         * config.in: Regenerate.
1757
1758 2012-05-14  Cary Coutant  <ccoutant@google.com>
1759
1760         * layout.cc (Layout::make_output_section): Mark .tdata section
1761         as RELRO.
1762         * testsuite/relro_test.cc: Add a TLS variable.
1763
1764 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1765
1766         PR gold/14091
1767         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1768         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1769         R_X86_64_64.
1770
1771 2012-05-08  Cary Coutant  <ccoutant@google.com>
1772
1773         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1774         (lines_only_debug_sections): Likewise.
1775
1776 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1777
1778         * nacl.cc: New file.
1779         * nacl.h: New file.
1780         * Makefile.am (CCFILES, HFILES): Add them.
1781         * Makefile.in: Regenerate.
1782         * i386.cc (Output_data_plt_i386_nacl): New class.
1783         (Output_data_plt_i386_nacl_exec): New class.
1784         (Output_data_plt_i386_nacl_dyn): New class.
1785         (Target_i386_nacl): New class.
1786         (Target_selector_i386_nacl): New class.
1787         (target_selector_i386): Use it instead of Target_selector_i386.
1788         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1789         (Target_x86_64_nacl): New class.
1790         (Target_selector_x86_64_nacl): New class.
1791         (target_selector_x86_64, target_selector_x32): Use it instead of
1792         Target_selector_x86_64.
1793         * arm.cc (Output_data_plt_arm_nacl): New class.
1794         (Target_arm_nacl): New class.
1795         (Target_selector_arm_nacl): New class.
1796         (target_selector_arm, target_selector_armbe): Use it instead of
1797         Target_selector_arm.
1798
1799         * target-select.cc (select_target): Take new Input_file* and off_t
1800         arguments, pass them on to recognize method of selector.
1801         * object.cc (make_elf_sized_object): Update caller.
1802         * parameters.cc (parameters_force_valid_target): Likewise.
1803         * incremental.cc (make_sized_incremental_binary): Likewise.
1804         * target-select.h: Update decl.
1805         (Target_selector::recognize): Take new Input_file* argument,
1806         pass it on to do_recognize.
1807         (Target_selector::do_recognize): Take new Input_file* argument.
1808         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1809         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1810         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1811         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1812
1813         * target.h (Target::Target_info): New members isolate_execinstr
1814         and rosegment_gap.
1815         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1816         * arm.cc (Target_arm::arm_info): Update initializer.
1817         * i386.cc (Target_i386::i386_info): Likewise.
1818         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1819         * sparc.cc (Target_sparc::sparc_info): Likewise.
1820         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1821         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1822         * layout.cc (Layout::attach_allocated_section_to_segment):
1823         Take new const Target* argument.  If target->isolate_execinstr(), act
1824         like --rosegment.
1825         (Layout::find_first_load_seg): Take new const Target* argument;
1826         if target->isolate_execinstr(), reject PF_X segments.
1827         (Layout::relaxation_loop_body): Update caller.
1828         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1829         reset file offset to zero when we hit LOAD_SEG, and then do a second
1830         loop over the segments before LOAD_SEG to reassign offsets after
1831         addresses have been determined.  Handle target->rosegment_gap().
1832         (Layout::attach_section_to_segment): Take new const Target* argument;
1833         pass it to attach_allocated_section_to_segment.
1834         (Layout::make_output_section): Update caller.
1835         (Layout::attach_sections_to_segments): Take new const Target* argument;
1836         pass it to attach_section_to_segment.
1837         * gold.cc (queue_middle_tasks): Update caller.
1838         * layout.h (Layout): Update method decls with new arguments.
1839
1840         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1841         Target_info pointer to use.
1842         (Target_arm::do_make_data_plt): New virtual method.
1843         (Target_arm::make_data_plt): New method that calls it.
1844         (Target_arm::make_plt_entry): Use it.
1845         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1846         for the section alignment.
1847         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1848         method.
1849         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1850         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1851         method.
1852         (Output_data_plt_arm::get_plt_entry_size): Call it.
1853         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1854         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1855         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1856         method.
1857         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1858         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1859         method instead of sizeof(plt_entry).
1860         (Output_data_plt_arm::add_entry): Likewise.
1861         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1862         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1863         than static method.
1864         (Target_arm::plt_entry_size): Likewise.
1865         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1866         Move to ...
1867         (Output_data_plt_arm_standard): ... here, new class.
1868         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1869         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1870         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1871
1872         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1873         Take additional argument for the PLT entry size.
1874         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1875         Use get_plt_entry_size method rather than plt_entry_size variable.
1876         (Output_data_plt_x86_64::reserve_slot): Likewise.
1877         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1878         (Output_data_plt_x86_64::add_entry): Likewise.
1879         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1880         (Output_data_plt_x86_64::address_for_global): Likewise.
1881         (Output_data_plt_x86_64::address_for_local): Likewise.
1882         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1883         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1884         Make method non-static.
1885         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1886         method.
1887         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1888         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1889         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1890         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1891         virtual method.
1892         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1893         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1894         virtual method.
1895         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1896         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1897         virtual method.
1898         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1899         (Output_data_plt_x86_64::plt_entry_size)
1900         (Output_data_plt_x86_64::first_plt_entry)
1901         (Output_data_plt_x86_64::plt_entry)
1902         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1903         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1904         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1905         (Output_data_plt_x86_64_standard): ... here, new class.
1906         (Target_x86_64::Target_x86_64): Take optional argument for the
1907         Target_info pointer to use.
1908         (Target_x86_64::do_make_data_plt): New virtual method.
1909         (Target_x86_64::make_data_plt): New method to call it.
1910         (Target_x86_64::init_got_plt_for_update): Use that.
1911         Call this->plt_->add_eh_frame method here.
1912         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1913         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1914         rather than static method.
1915         (Target_x86_64::plt_entry_size): Likewise.
1916         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1917         rather than plt_entry_size variable.  Move guts of PLT filling to...
1918         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1919         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1920         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1921
1922         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1923         additional argument for the section alignment.
1924         Don't do add_eh_frame_for_plt here.
1925         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1926         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1927         variable.
1928         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1929         method.
1930         (Output_data_plt_i386::get_plt_entry_size): Call it.
1931         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1932         (Output_data_plt_i386::add_eh_frame): New method to call it.
1933         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1934         method.
1935         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1936         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1937         method.
1938         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1939         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1940         method instead of plt_entry_size.
1941         (Output_data_plt_i386::plt_entry_size)
1942         (Output_data_plt_i386::plt_eh_frame_fde_size)
1943         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1944         (Output_data_plt_i386_standard): ... here, new class.
1945         (Output_data_plt_i386_exec): New class.
1946         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1947         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1948         (Output_data_plt_i386::exec_plt_entry): Move to ...
1949         (Output_data_plt_i386_exec::plt_entry): ... here.
1950         (Output_data_plt_i386_dyn): New class.
1951         (Output_data_plt_i386::first_plt_entry): Move to ...
1952         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1953         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1954         (Output_data_plt_i386_dyn::plt_entry): ... here.
1955         (Target_i386::Target_i386): Take optional argument for the Target_info
1956         pointer to use.
1957         (Target_i386::do_make_data_plt): New virtual method.
1958         (Target_i386::make_data_plt): New method to call it.
1959         (Target_i386::make_plt_section): Use that.
1960         Call this->plt_->add_eh_frame method here.
1961         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1962         rather than plt_entry_size variable.
1963         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1964         (Output_data_plt_i386::address_for_local): Likewise.
1965         (Output_data_plt_i386::do_write): Likewise.
1966         Move guts of PLT filling to...
1967         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1968         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1969         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1970         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1971
1972 2012-05-01  Cary Coutant  <ccoutant@google.com>
1973
1974         * dwarf_reader.cc (Dwarf_die::read_attributes)
1975         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1976         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1977         * reduced_debug_output.cc
1978         (Output_reduced_debug_info_section::get_die_end): Remove
1979         DW_FORM_GNU_ref_index.  Add default case.
1980
1981 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1982
1983         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1984         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1985         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1986         DW_AT_high_pc as offset from DW_AT_low_pc.
1987
1988         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1989         * testsuite/Makefile.in: Regenerate.
1990         * testsuite/gdb_index_test_3.c: New test source file.
1991         * testsuite/gdb_index_test_3.sh: New test source file.
1992
1993 2012-04-25  Ian Lance Taylor  <iant@google.com>
1994
1995         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1996         pointer.
1997         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1998         as a class, not a struct.
1999         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2000         (Target_arm::apply_cortex_a8_workaround): Likewise.
2001         * gc.h: Declare Reloc_types as a struct, not a class.
2002         * object.h: Declare Symbols_data as a struct.
2003         * reloc.h: Declare Read_relocs_data as a struct.
2004         * target.h: Declare Relocate_info as a struct.
2005
2006 2012-04-24  David S. Miller  <davem@davemloft.net>
2007
2008         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2009         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2010         and R_SPARC_WPLT30.
2011
2012 2012-04-24  Cary Coutant  <ccoutant@google.com>
2013
2014         * incremental-dump.cc (find_input_containing_global): Replace
2015         magic number with symbolic constant.
2016         (dump_incremental_inputs): Update version number.
2017         * incremental.cc (Output_section_incremental_inputs): Update version
2018         number; import symbolic constants from Incremental_inputs_reader.
2019         (Incremental_inputs::create_data_sections): Align relocations
2020         section correctly for 64-bit targets.
2021         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2022         constants; add padding.
2023         (Output_section_incremental_inputs::write_header): Add assert for
2024         header_size.
2025         (Output_section_incremental_inputs::write_input_files): Add assert
2026         for input_entry_size.
2027         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2028         add assert for object_info_size, input_section_entry_size,
2029         global_sym_entry_size.
2030         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2031         for data structure sizes; use them.
2032         (Incremental_input_entry_reader): Import symbolic constants from
2033         Incremental_inputs_reader; use them.
2034
2035 2012-04-23  David S. Miller  <davem@davemloft.net>
2036
2037         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2038         and elf_flags_set_.
2039         (Target_sparc::Target_sparc): Initialize new fields.
2040         (Target_sparc::do_make_elf_object): New function.
2041         (Target_sparc::do_adjust_elf_header): New function.
2042
2043 2012-04-23  Cary Coutant  <ccoutant@google.com>
2044
2045         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2046         CU range table of gdb index.
2047
2048 2012-04-20  David S. Miller  <davem@davemloft.net>
2049
2050         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2051         instead of false.
2052
2053 2012-04-16  David S. Miller  <davem@davemloft.net>
2054
2055         * sparc.cc (Target_sparc::got_address): New function.
2056         (Sparc_relocate_functions::gdop_hix22): New function.
2057         (Sparc_relocate_functions::gdop_lox10): New function.
2058         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2059         relocs.
2060         (Target_sparc::Scan::local): Likewise if the global symbol is not
2061         preemptible and is not IFUNC.
2062         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2063         transformations for local and non-preemptible non-IFUNC global
2064         symbols.
2065
2066         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2067         writing out 64-bit part of ranges.
2068
2069         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2070         -fpic and -fpie respectively.
2071         * Makefile.in: Regenerate.
2072
2073         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2074         (Target_sparc::Target_sparc): Initialize new field.
2075         (Target_sparc::do_plt_section_for_global): New function.
2076         (Target_sparc::do_plt_section_for_local): New function.
2077         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2078         (Target_sparc::make_plt_section): New function, broken out of
2079         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2080         (Target_sparc::make_plt_entry): Call make_plt_section.
2081         (Target_sparc::make_local_ifunc_plt_entry): New function.
2082         (Target_sparc::rela_ifunc_section): New function.
2083         (Target_sparc::plt_section): Remove const.
2084         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2085         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2086         and ifunc_count_ fields.
2087         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2088         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2089         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2090         (Output_data_plt_sparc::rela_ifunc): New function.
2091         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2092         (Output_data_plt_sparc::has_ifunc_section): New function.
2093         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2094         (Output_data_plt_sparc::address_for_global): New function.
2095         (Output_data_plt_sparc::address_for_local): New function.
2096         (Output_data_plt_sparc::plt_index_to_offset): New function.
2097         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2098         and entry_count.
2099         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2100         entry_count.
2101         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2102         R_SPARC_JMP_IREL to switch.
2103         (Target_sparc::Scan::check_non_pic): Likewise.
2104         (Target_sparc::Scan::local): Handle IFUNC symbols.
2105         (Target_sparc::Scan::local): Likewise.
2106         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2107         and plt_address_for_local.
2108         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2109         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2110
2111         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2112         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2113         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2114         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2115         global relocs too.
2116         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2117         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2118         calls.
2119         * sparc.cc (Target_sparc::Scan::global): Likewise.
2120         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2121
2122 2012-04-16  Cary Coutant  <ccoutant@google.com>
2123
2124         * archive.cc (Library_base::should_include_member): Check for
2125         --export-dynamic-symbol.
2126         * options.h (class General_options): Add --export-dynamic-symbol.
2127         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2128         --export-dynamic-symbol.
2129         (Symbol_table::gc_mark_undef_symbols): Likewise.
2130         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2131
2132 2012-04-12  David S. Miller  <davem@davemloft.net>
2133
2134         * sparc.cc (Reloc::wdisp10): New relocation method.
2135         (Reloc::h34): Likewise.
2136         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2137         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2138         R_SPARC_WDISP10.
2139         (Target_sparc::Scan::local): Likewise.
2140         (Target_sparc::Scan::global): Likewise.
2141         (Target_sparc::Relocate::relocate): Likewise.
2142
2143 2012-04-09  Cary Coutant  <ccoutant@google.com>
2144
2145         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2146         low_pc == 0.
2147
2148 2012-04-06  Ian Lance Taylor  <iant@google.com>
2149
2150         * timer.cc: #include <unistd.h>.
2151
2152 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2153
2154         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2155         * config.in: Regenerate.
2156         * configure: Regenerate.
2157
2158 2012-04-05  Nick Clifton  <nickc@redhat.com>
2159
2160         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2161         (AM_LC_MESSAGES): Add.
2162         * aclocal.m4: Regenerate.
2163         * config.in: Regenerate.
2164         * configure: Regenerate.
2165
2166 2012-03-21  Cary Coutant  <ccoutant@google.com>
2167
2168         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2169         * Makefile.in: Regenerate.
2170         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2171         (Sized_elf_reloc_mapper::symbol_section): New function.
2172         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2173         (make_elf_reloc_mapper): New function.
2174         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2175         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2176         (Dwarf_abbrev_table::do_get_abbrev): New function.
2177         (Dwarf_ranges_table::read_ranges_table): New function.
2178         (Dwarf_ranges_table::read_range_list): New function.
2179         (Dwarf_pubnames_table::read_section): New function.
2180         (Dwarf_pubnames_table::read_header): New function.
2181         (Dwarf_pubnames_table::next_name): New function.
2182         (Dwarf_die::Dwarf_die): New function.
2183         (Dwarf_die::read_attributes): New function.
2184         (Dwarf_die::skip_attributes): New function.
2185         (Dwarf_die::set_name): New function.
2186         (Dwarf_die::set_linkage_name): New function.
2187         (Dwarf_die::attribute): New function.
2188         (Dwarf_die::string_attribute): New function.
2189         (Dwarf_die::int_attribute): New function.
2190         (Dwarf_die::uint_attribute): New function.
2191         (Dwarf_die::ref_attribute): New function.
2192         (Dwarf_die::child_offset): New function.
2193         (Dwarf_die::sibling_offset): New function.
2194         (Dwarf_info_reader::check_buffer): New function.
2195         (Dwarf_info_reader::parse): New function.
2196         (Dwarf_info_reader::do_parse): New function.
2197         (Dwarf_info_reader::do_read_string_table): New function.
2198         (Dwarf_info_reader::lookup_reloc): New function.
2199         (Dwarf_info_reader::get_string): New function.
2200         (Dwarf_info_reader::visit_compilation_unit): New function.
2201         (Dwarf_info_reader::visit_type_unit): New function.
2202         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2203         Sized_elf_reloc_mapper.
2204         (Sized_dwarf_line_info::symbol_section): Remove function.
2205         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2206         (Sized_dwarf_line_info::read_line_mappings): Remove object
2207         parameter, adjust callers.
2208         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2209         * dwarf_reader.h: Include <sys/types.h>.
2210         (class Track_relocs): Remove forward declaration.
2211         (class Elf_reloc_mapper): New class.
2212         (class Sized_elf_reloc_mapper): New class.
2213         (class Dwarf_abbrev_table): New class.
2214         (class Dwarf_range_list): New class.
2215         (class Dwarf_ranges_table): New class.
2216         (class Dwarf_pubnames_table): New class.
2217         (class Dwarf_die): New class.
2218         (class Dwarf_info_reader): New class.
2219         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2220         (Sized_dwarf_line_info::symbol_section): Remove member function.
2221         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2222         base class.
2223         * gdb-index.cc: New source file.
2224         * gdb-index.h: New source file.
2225         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2226         and .debug_types sections, call Layout::add_to_gdb_index.
2227         (Sized_relobj_incr::do_section_name): Implement.
2228         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2229         return type; Implement.
2230         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2231         return type.
2232         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2233         parameter list and return type.
2234         (Sized_incr_dynobj::do_section_contents): Likewise.
2235         * layout.cc: Include gdb-index.h.
2236         (Layout::Layout): Initialize gdb_index_data_.
2237         (Layout::init_fixed_output_section): Check for .gdb_index section.
2238         (Layout::add_to_gdb_index): New function. Instantiate.
2239         * layout.h: Add forward declaration for class Gdb_index.
2240         (Layout::add_to_gdb_index): New member function.
2241         (Layout::gdb_index_data_): New data member.
2242         * main.cc: Include gdb-index.h.
2243         (main): Print statistics for gdb index.
2244         * object.cc (Object::section_contents): Move code into
2245         do_section_contents.
2246         (need_decompressed_section): Check for sections needed when building
2247         gdb index.
2248         (build_compressed_section_map): Likewise.
2249         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2250         gdb index.
2251         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2252         sections; call Layout::add_to_gdb_index.
2253         (Sized_relobj_file::do_decompressed_section_contents): Call
2254         do_section_contents directly.
2255         * object.h (Object::do_section_contents): Adjust parameter list and
2256         return type.
2257         (Object::do_decompressed_section_contents): Call do_section_contents
2258         directly.
2259         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2260         return type.
2261         * options.h (class General_options): Add --gdb-index option.
2262         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2263         list and return type.
2264         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2265         * reloc.h (Track_relocs::checkpoint): New function.
2266         (Track_relocs::reset): New function.
2267
2268         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2269         New test cases.
2270         * testsuite/Makefile.in: Regenerate.
2271         * testsuite/gdb_index_test.cc: New test source file.
2272         * testsuite/gdb_index_test_1.sh: New test source file.
2273         * testsuite/gdb_index_test_2.sh: New test source file.
2274
2275 2012-03-19  Doug Kwan  <dougkwan@google.com>
2276
2277         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2278         (Target_arm::do_finalize_sections): Remove code which defines
2279         __exidx_start and __exidx_end.  Make symbol table parameter
2280         anonymous as it is not used.
2281         * gold.cc (queue_middle_tasks): Call target hook to define any
2282         target-specific symbols.
2283         * target.h (Target::define_standard_symbols): New method.
2284         (Target::do_define_standard_symbols): Same.
2285         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2286         * testsuite/Makefile.in: Regenerate.
2287         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2288         and __exidx_end.
2289         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2290         relocations are generated for __exidx_start and __exidx_end.
2291
2292 2012-03-16  Doug Kwan  <dougkwan@google.com>
2293
2294         * testsuite/Makefile.am: Disable test initpri3b.
2295         * testsuite/Makefile.in: Regenerate.
2296
2297 2012-03-15  Doug Kwan  <dougkwan@google.com>
2298
2299         * arm.cc (Target_arm::got_section): Make .got section read-only
2300         if -z now is given.
2301
2302 2012-03-15  Ian Lance Taylor  <iant@google.com>
2303
2304         PR gold/13850
2305         * layout.cc (Layout::make_output_section): Correctly mark
2306         SHT_INIT_ARRAY, et. al., as relro.
2307
2308 2012-03-14  Doug Kwan  <dougkwan@google.com>
2309
2310         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2311         dynamic relocations for protected symbols in shared objects.
2312
2313 2012-03-13  Ian Lance Taylor  <iant@google.com>
2314
2315         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2316         keep the larger alignment.
2317
2318 2012-03-12  Cary Coutant  <ccoutant@google.com>
2319
2320         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2321         handling of DW_LNE_define_file.
2322
2323 2012-03-12  Cary Coutant  <ccoutant@google.com>
2324
2325         * reduced_debug_output.cc
2326         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2327         codes to switch.
2328
2329 2012-02-29  Cary Coutant  <ccoutant@google.com>
2330
2331         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2332
2333 2012-02-29  Cary Coutant  <ccoutant@google.com>
2334
2335         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2336         Call Object::decompressed_section_contents.
2337         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2338         New dtor.
2339         (Sized_dwarf_line_info::buffer_start_): New data member.
2340         * merge.cc (Output_merge_data::do_add_input_section): Call
2341         Object::decompressed_section_contents.
2342         (Output_merge_string::do_add_input_section): Likewise.
2343         * object.cc (need_decompressed_section): New function.
2344         (build_compressed_section_map): Decompress sections needed later.
2345         (Sized_relobj_file::do_decompressed_section_contents): New function.
2346         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2347         * object.h (Object::decompressed_section_contents): New function.
2348         (Object::discard_decompressed_sections): New function.
2349         (Object::do_decompressed_section_contents): New function.
2350         (Object::do_discard_decompressed_sections): New function.
2351         (Compressed_section_info): New type.
2352         (Compressed_section_map): Include decompressed section contents.
2353         (Sized_relobj_file::do_decompressed_section_contents): New function.
2354         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2355
2356 2012-02-16  Cary Coutant  <ccoutant@google.com>
2357
2358         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2359         * testsuite/Makefile.in: Regenerate.
2360
2361 2012-02-14  Cary Coutant  <ccoutant@google.com>
2362
2363         * options.cc (General_options::finalize): Disallow -pie and -static.
2364
2365 2012-02-03  Doug Kwan  <dougkwan@google.com>
2366
2367         * arm.cc (Arm_relocate_functions::abs8,
2368         Arm_relocate_functions::abs16): Use
2369         Bits::has_signed_unsigned_overflow32.
2370         (Arm_relocate_functions::thm_abs8): Correct range of
2371         overflow check.
2372         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2373         in assertions.
2374
2375 2012-02-02  Doug Kwan  <dougkwan@google.com>
2376
2377         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2378         position independent outputs, not just shared objects.
2379
2380 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2381
2382         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2383         * configure: Regenerated.
2384
2385 2012-01-27  Ian Lance Taylor  <iant@google.com>
2386
2387         * reloc.h (Bits): New class with static functions, copied from
2388         namespace utils in arm.cc.
2389         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2390         instead.
2391
2392 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2393
2394         * incremental.cc (write_info_blocks): Correct relocation offset.
2395
2396 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2397
2398         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2399         (Relocate::tls_gd_to_le): Likewise.
2400
2401 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2402
2403         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2404
2405 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2406
2407         * configure.ac: Check if -mcmodel=medium works.
2408         * configure: Regenerated.
2409
2410 2012-01-24  Cary Coutant  <ccoutant@google.com>
2411
2412         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2413         definition and ...
2414         (read_unsigned_LEB_128_x): ... this new function.
2415         (read_signed_LEB_128): Replaced with inline definition and ...
2416         (read_signed_LEB_128_x): ... this new function.
2417         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2418         (read_unsigned_LEB_128): Add inline definition.
2419         (read_signed_LEB_128_x): New function.
2420         (read_signed_LEB_128): Add inline definition.
2421         * testsuite/Makefile.am (leb128_unittest): New unit test.
2422         * testsuite/Makefile.in: Regenerate.
2423         * testsuite/leb128_unittest.cc: New unit test.
2424
2425 2012-01-23  Ian Lance Taylor  <iant@google.com>
2426
2427         PR gold/13617
2428         * i386.cc (Target_i386::do_code_fill): When using a jmp
2429         instruction, pad with nop instructions.
2430         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2431
2432 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2433
2434         * x86_64.cc (gc_process_relocs): Add typename on types used in
2435         template.
2436         (scan_relocs): Likewise.
2437         (relocate_section): Likewise.
2438         (apply_relocation): Likewise.
2439
2440 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2441
2442         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2443         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2444         under x32.
2445
2446 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2447
2448         * x86_64.cc: Initial support for x32.
2449
2450 2012-01-03  Cary Coutant  <ccoutant@google.com>
2451
2452         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2453         Use abstract base class for GOT.
2454         * gold/output.h (class Output_data_got_base): New abstract base class.
2455         (class Output_data_got): Derive from new base class, adjust ctors.
2456         (Output_data_got::reserve_slot): Make virtual; rename to
2457         do_reserve_slot; Adjust callers.
2458         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2459         pointer to abstract base class.
2460         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2461
2462 2011-12-18  Ian Lance Taylor  <iant@google.com>
2463
2464         * object.h (Relobj::local_symbol_value): New function.
2465         (Relobj::local_plt_offset): New function.
2466         (Relobj::local_has_got_offset): New function.
2467         (Relobj::local_got_offset): New function.
2468         (Relobj::set_local_got_offset): New function.
2469         (Relobj::do_local_symbol_value): New pure virtual function.
2470         (Relobj::do_local_plt_offset): Likewise.
2471         (Relobj::do_local_has_got_offset): Likewise.
2472         (Relobj::do_local_got_offset): Likewise.
2473         (Relobj::do_set_local_got_offset): Likewise.
2474         (Sized_relobj::do_local_has_got_offset): Rename from
2475         local_has_got_offset.
2476         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2477         (Sized_relobj::do_set_local_got_offset): Rename from
2478         set_local_got_offset.
2479         (Sized_relobj_file::do_local_plt_offset): Rename from
2480         local_plt_offset.
2481         (Sized_relobj_file::do_local_symbol_value): New function.
2482         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2483         local_plt_offset.
2484         * output.cc (Output_data_got::Got_entry::write): Change object to
2485         Relobj.  Use local_symbol_value.
2486         (Output_data_got::add_global_with_rel): Change rel_dyn to
2487         Output_data_reloc_generic*.  Use add_global_generic.
2488         (Output_data_got::add_global_with_rela): Remove.  Change all
2489         callers to use add_global_with_rel.
2490         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2491         Output_data_reloc_generic*.  Use add_global_generic.
2492         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2493         callers to use add_global_pair_with_rel.
2494         (Output_data_got::add_local): Change object to Relobj*.
2495         (Output_data_got::add_local_plt): Likewise.
2496         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2497         change rel_dyn to Output_data_reloc_generic*.  Use
2498         add_local_generic.
2499         (Output_data_got::add_local_with_rela): Remove.  Change all
2500         callers to use all_local_with_rel.
2501         (Output_data_got::add_local_pair_with_rel): Change object to
2502         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2503         add_output_section_generic.
2504         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2505         callers to use add_local_pair_with_rel.
2506         (Output_data_got::reserve_local): Change object to Relobj*.
2507         * output.h: (class Output_data_reloc_generic): Add pure virtual
2508         declarations for add_global_generic, add_local_generic,
2509         add_output_section_generic.
2510         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2511         functions for Output_data_reloc_generic.  Update declarations for
2512         changes listed in output.cc.
2513         (class Output_data_got): Change template parameter to got_size.
2514         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2515         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2516         function.
2517         (Sized_relobj_incr::do_local_plt_offset): New function.
2518         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2519         add_global_generic.
2520
2521 2011-12-17  Cary Coutant  <ccoutant@google.com>
2522
2523         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2524         * resolve.cc (Symbol_table::resolve): Likewise.
2525         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2526         arrays.
2527         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2528
2529 2011-12-16  Ian Lance Taylor  <iant@google.com>
2530
2531         * output.h (Output_data_reloc_generic::add): Only call
2532         add_dynamic_reloc if this is a dynamic reloc section.
2533
2534 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2535
2536         PR gold/13505
2537         * target-reloc.h (apply_relocation): Replace <64, false> with
2538         <size, big_endian>.
2539
2540 2011-11-25  Nick Clifton  <nickc@redhat.com>
2541
2542         * po/it.po: New Italian translation.
2543
2544 2011-11-17  Sterling Augustine  <saugustine@google.com>
2545
2546         * script.cc (script_include_directive): Implement.
2547         (read_script_file): New local variables name and search_path. Update
2548         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2549         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2550         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2551
2552 2011-11-11  Sterling Augustine  <saugustine@google.com>
2553
2554         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2555         (file_or_sections_cmd): Likewise.
2556
2557 2011-11-11  Doug Kwan  <dougkwan@google.com>
2558
2559         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2560         if --just-symbols is given.
2561
2562 2011-11-10  Doug Kwan  <dougkwan@google.com>
2563
2564         PR gold/13362
2565         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2566         when processing data relocs.
2567         * reloc.h (Relocate_functions::rel_unaligned): New method.
2568         (Relocate_functions::pcrel_unaligned): Ditto.
2569         (Relocate_functions::rel32_unaligned): Ditto.
2570         (Relocate_functions::pcrel32_unaligned): Ditto.
2571
2572 2011-11-09  Doug Kwan  <dougkwan@google.com>
2573
2574         PR gold/13362
2575         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2576         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2577         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2578         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2579         (Relocate_functions::rel_unaligned): New.
2580         (Relocate_functions::rel32_unaligned): New.
2581         * target-reloc.h (relocate_for_relocatable): Add code to handle
2582         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2583         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2584         arm_unaligned_reloc_r): New targets.
2585         * testsuite/Makefile.in: Regenerate.
2586         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2587         linking.
2588
2589 2011-11-02  Ian Lance Taylor  <iant@google.com>
2590
2591         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2592         NATIVE_LINKER.
2593         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2594         * options.cc (General_options::finalize): Use library search path
2595         from configure script if specified.  If not native and no sysroot,
2596         only search TOOLLIBDIR.
2597         * options.h (Search_directory::Search_directory): Change name to
2598         const std::string&.
2599         (General_options::add_to_library_path_with_sysroot): Change arg to
2600         const std::string&.
2601         * configure, Makefile.in, config.in: Rebuild.
2602
2603 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2604
2605         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2606         we are working around the ARM1176 Erratum.
2607         * options.h (General_options::fix_arm1176): Add option.
2608         * testsuite/Makefile.am: Add testcases, and keep current ones
2609         working.
2610         * testsuite/Makefile.in: Regenerate.
2611         * testsuite/arm_fix_1176.s: New file.
2612         * testsuite/arm_fix_1176.sh: Likewise.
2613
2614 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2615
2616         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2617         may_use_blx_.
2618         (Target_arm::may_use_blx): Remove method.
2619         (Target_arm::set_may_use_blx): Likewise.
2620         (Target_arm::may_use_v4t_interworking): New method.
2621         (Target_arm::may_use_v5t_interworking): Likewise.
2622         (Target_arm::may_use_blx_): Remove member variable.
2623         (Arm_relocate_functions::arm_branch_common): Check for v5T
2624         interworking.
2625         (Arm_relocate_functions::thumb_branch_common): Likewise.
2626         (Reloc_stub::stub_type_for_reloc): Likewise.
2627         (Target_arm::do_finalize_sections): Correct interworking checks.
2628         * testsuite/Makefile.am: Add new tests.
2629         * testsuite/Makefile.in: Regenerate.
2630         * testsuite/arm_farcall_arm_arm.s: New test.
2631         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2632         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2633         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2634         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2635         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2636         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2637         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2638
2639 2011-10-31  Cary Coutant  <ccoutant@google.com>
2640
2641         PR gold/13023
2642         * expression.cc (Expression::eval_with_dot): Add
2643         is_section_dot_assignment parameter.
2644         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2645         absolute and assigning to dot within a section.
2646         * script-sections.cc
2647         (Output_section_element_assignment::set_section_addresses): Pass
2648         dot_section to set_if_absolute.
2649         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2650         as is_section_dot_assignment flag to eval_with_dot.
2651         (Output_section_element_dot_assignment::set_section_addresses):
2652         Likewise.
2653         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2654         parameter.  Also set value if relative to dot_section; set the
2655         symbol's output_section.
2656         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2657         parameter.  Adjust all callers.
2658         (Expression::eval_maybe_dot): Likewise.
2659         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2660         Adjust all callers.
2661         * testsuite/script_test_2.t: Test assignment of an absolute value
2662         to dot within an output section element.
2663
2664 2011-10-31  Cary Coutant  <ccoutant@google.com>
2665
2666         * options.h (class General_options): Add --[no-]gnu-unique options.
2667         * symtab.cc (Symbol_table::sized_write_globals): Convert
2668         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2669
2670 2011-10-31  Cary Coutant  <ccoutant@google.com>
2671
2672         PR gold/13359
2673         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2674         unnecessary assertion.
2675         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2676
2677 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2678
2679         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2680         gc_mark_symbol.
2681         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2682         gc_mark_symbol.
2683         Change to just keep the section associated with symbol.
2684         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2685         they are externally visible and --export-dynamic is turned on.
2686         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2687
2688 2011-10-19  Ian Lance Taylor  <iant@google.com>
2689
2690         PR gold/13163
2691         * script-sections.cc
2692         (Output_section_element_dot_assignment::needs_output_section): New
2693         function.
2694
2695 2011-10-19  Ian Lance Taylor  <iant@google.com>
2696
2697         PR gold/13204
2698         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2699         --section-start option was seen.
2700         * options.h (General_options::any_section_start): New function.
2701
2702 2011-10-18  David S. Miller  <davem@davemloft.net>
2703
2704         PR binutils/13301
2705         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2706         member to track relocation locations that have moved during TLS
2707         reloc optimizations.
2708         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2709         (Target_sparc::Relocate::relocate): Adjust view down by 4
2710         bytes if it matches reloc_adjust_addr_.
2711         (Target_sparc::Relocate::relocate_tls): Always move the
2712         __tls_get_addr call delay slot instruction forward 4 bytes when
2713         performing relaxation.
2714
2715 2011-10-18  Cary Coutant  <ccoutant@google.com>
2716
2717         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2718         (Output_file::map_no_anonymous): Check for non-zero
2719         return code from posix_fallocate.
2720
2721 2011-10-17  Cary Coutant  <ccoutant@google.com>
2722
2723         PR gold/13245
2724         * plugin.cc (is_visible_from_outside): Check for symbols
2725         referenced from dynamic objects.
2726         * resolve.cc (Symbol_table::resolve): Don't count references
2727         from dynamic objects as references from real ELF files.
2728         * testsuite/plugin_test_2.sh: Adjust expected result.
2729
2730 2011-10-17  Cary Coutant  <ccoutant@google.com>
2731
2732         * gold.cc: Include timer.h.
2733         (queue_middle_tasks): Stamp time.
2734         (queue_final_tasks): Likewise.
2735         * main.cc (main): Store timer in parameters.  Print timers
2736         for each pass.
2737         * parameters.cc (Parameters::Parameters): Initialize timer_.
2738         (Parameters::set_timer): New function.
2739         (set_parameters_timer): New function.
2740         * parameters.h (Parameters::set_timer): New function.
2741         (Parameters::timer): New function.
2742         (Parameters::timer_): New data member.
2743         (set_parameters_timer): New function.
2744         * timer.cc (Timer::stamp): New function.
2745         (Timer::get_pass_time): New function.
2746         * timer.h (Timer::stamp): New function.
2747         (Timer::get_pass_time): New function.
2748         (Timer::pass_times_): New data member.
2749
2750 2011-10-17  Cary Coutant  <ccoutant@google.com>
2751
2752         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2753         task for members of lib groups.
2754
2755 2011-10-17  Cary Coutant  <ccoutant@google.com>
2756
2757         PR gold/13288
2758         * fileread.cc (File_read::find_view): Add assert.
2759         (File_read::make_view): Move bounds check (replace with assert)...
2760         (File_read::find_or_make_view): ... to here.
2761
2762 2011-10-12  Cary Coutant  <ccoutant@google.com>
2763
2764         * output.cc (Output_file::open_base_file): Handle case where
2765         ::read returns less than requested size.
2766
2767 2011-10-10  Cary Coutant  <ccoutant@google.com>
2768
2769         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2770         Initialize defined_count_.
2771         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2772         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2773         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2774         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2775         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2776         * incremental.h (Sized_relobj_incr::defined_count_): New data
2777         member.
2778         (Sized_incr_dynobj::defined_count_): New data member.
2779         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2780         Return zeroes instead of internal error.
2781
2782 2011-10-10  Cary Coutant  <ccoutant@google.com>
2783
2784         PR gold/13249
2785         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2786         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2787         * output.h (class Output_reloc): Add use_plt_offset flag.
2788         (Output_reloc::type_): Adjust size of bit field.
2789         (Output_reloc::use_plt_offset_): New bit field.
2790         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2791         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2792         flag.  Adjust all callers.
2793         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2794         creating RELATIVE relocations.
2795
2796 2011-10-10  Nick Clifton  <nickc@redhat.com>
2797
2798         * po/es.po: Updated Spanish translation.
2799         * po/fi.po: Updated Finnish translation.
2800
2801 2011-10-03   Diego Novillo  <dnovillo@google.com>
2802
2803         * options.cc (parse_uint): Fix dereference of RETVAL.
2804
2805 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2806
2807         * layout.h (section_order_map_): New member.
2808         (get_section_order_map): New member function.
2809         * output.cc (Output_section::add_input_section): Check for patterns
2810         only when --section-ordering-file is specified.
2811         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2812         output_sections have been formed.
2813         * layout.cc (Layout_Layout): Initialize section_order_map_.
2814         * plugin.cc (update_section_order): Store order in order_map. Do not
2815         update the order.
2816         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2817         * testsuite/Makefile.in: Regenerate.
2818         * testsuite/plugin_section_order.c: New file.
2819         * testsuite/plugin_final_layout.cc: New file.
2820         * testsuite/plugin_final_layout.sh: New file.
2821
2822 2011-09-29  Cary Coutant  <ccoutant@google.com>
2823
2824         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2825         Check for NULL.
2826         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2827         symbols during incremental update.
2828         (Symbol_table::add_from_dynobj): Likewise.
2829
2830 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2831             Ian Lance Taylor  <iant@google.com>
2832
2833         * symtab.cc (Symbol_table::define_special_symbol): Always
2834         canonicalize version string.
2835
2836 2011-09-26  Cary Coutant  <ccoutant@google.com>
2837
2838         * gold.cc (queue_initial_tasks): Move option checks ...
2839         * options.cc (General_options::finalize): ... to here. Disable
2840         some options; make others fatal.
2841
2842 2011-09-26  Cary Coutant  <ccoutant@google.com>
2843
2844         gcc PR lto/47247
2845         * plugin.cc (get_symbols_v2): New function.
2846         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2847         (is_referenced_from_outside): New function.
2848         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2849         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2850         (get_symbols): Pass version parameter.
2851         (get_symbols_v2): New function.
2852         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2853         parameter.
2854         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2855         (onload): Add LDPT_GET_SYMBOLS_V2.
2856         (all_symbols_read_hook): Use get_symbols_v2; check for
2857         LDPR_PREVAILING_DEF_IRONLY_EXP.
2858         * testsuite/plugin_test_3.sh: Update expected results.
2859
2860 2011-09-23  Simon Baldwin  <simonb@google.com>
2861
2862         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2863         configuration options.
2864         * configure: Regenerate.
2865         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2866         * Makefile.in: Regenerate.
2867         * testsuite/Makefile.in: Regenerate.
2868
2869 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2870
2871         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2872
2873 2011-09-19  Cary Coutant  <ccoutant@google.com>
2874
2875         * incremental.cc (can_incremental_update): Fix typo in comment.
2876         * incremental.h (can_incremental_update): Likewise.
2877
2878 2011-09-18  Cary Coutant  <ccoutant@google.com>
2879
2880         * incremental.cc (can_incremental_update): New function.
2881         * incremental.h (can_incremental_update): New function.
2882         * layout.cc (Layout::init_fixed_output_section): Call it.
2883         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2884         * object.cc (Sized_relobj_file::do_layout): Call
2885         can_incremental_update.
2886
2887 2011-09-13  Cary Coutant  <ccoutant@google.com>
2888
2889         * configure.ac: Check for glibc support for gnu_indirect_function
2890         support with static linking, setting automake conditional
2891         IFUNC_STATIC.
2892         * Makefile.in: Regenerate.
2893         * configure: Regenerate.
2894
2895         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2896         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2897         for IFUNC_STATIC.
2898         * testsuite/Makefile.in: Regenerate.
2899
2900 2011-09-13  Cary Coutant  <ccoutant@google.com>
2901
2902         * incremental.cc (Sized_relobj_incr::do_layout): Call
2903         report_comdat_group for kept comdat sections.
2904         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2905         * testsuite/Makefile.in: Regenerate.
2906         * testsuite/incr_comdat_test_1.cc: New source file.
2907         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2908         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2909         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2910
2911 2011-09-13  Ian Lance Taylor  <iant@google.com>
2912
2913         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2914         variable external_symbols_offset.
2915
2916 2011-09-12  Ian Lance Taylor  <iant@google.com>
2917
2918         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2919         triggered if object has no symbols.
2920
2921 2011-09-09  David S. Miller  <davem@davemloft.net>
2922
2923         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2924         (Output_fill_debug_line::do_write): Likewise.
2925
2926 2011-08-29  Cary Coutant  <ccoutant@google.com>
2927
2928         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2929         casts to match formatting specs.
2930         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2931
2932 2011-08-26  Cary Coutant  <ccoutant@google.com>
2933
2934         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2935         remaining hole size when allocating.
2936         (Layout::make_output_section): Set fill methods for debug sections.
2937         * layout.h (Free_list::Free_list_node): Move from private to
2938         public.
2939         (Free_list::set_min_hole_size): New function.
2940         (Free_list::begin, Free_list::end): New functions.
2941         (Free_list::min_hole_): New data member.
2942         * output.cc: Include dwarf.h.
2943         (Output_fill_debug_info::do_minimum_hole_size): New function.
2944         (Output_fill_debug_info::do_write): New function.
2945         (Output_fill_debug_line::do_minimum_hole_size): New function.
2946         (Output_fill_debug_line::do_write): New function.
2947         (Output_section::Output_section): Initialize new data member.
2948         (Output_section::set_final_data_size): Ensure patch space is larger
2949         than minimum hole size.
2950         (Output_section::do_write): Fill holes in debug sections.
2951         * output.h (Output_fill): New class.
2952         (Output_fill_debug_info): New class.
2953         (Output_fill_debug_line): New class.
2954         (Output_section::set_free_space_fill): New function.
2955         (Output_section::free_space_fill_): New data member.
2956         * testsuite/Makefile.am (incremental_test_3): Add
2957         --incremental-patch option.
2958         (incremental_test_4): Likewise.
2959         (incremental_test_5): Likewise.
2960         (incremental_test_6): Likewise.
2961         (incremental_copy_test): Likewise.
2962         (incremental_common_test_1): Likewise.
2963         * testsuite/Makefile.in: Regenerate.
2964
2965 2011-08-26  Nick Clifton  <nickc@redhat.com>
2966
2967         * po/es.po: Updated Spanish translation.
2968
2969 2011-08-01  Cary Coutant  <ccoutant@google.com>
2970
2971         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2972         * gold/testsuite/Makefile.in: Regenerate.
2973         * gold/testsuite/justsyms_exec.c: New source file.
2974         * gold/testsuite/justsyms_lib.c: New source file.
2975
2976 2011-08-01  Cary Coutant  <ccoutant@google.com>
2977
2978         * layout.cc (Layout::set_segment_offsets): Don't realign text
2979         segment if -Ttext was specified.
2980         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2981         file type.
2982         * object.h (Sized_relobj_file::e_type): New function.
2983         (Sized_relobj_file::e_type_): New data member.
2984         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2985         base address for ET_EXEC files.
2986         * target.cc (Target::do_make_elf_object_implementation): Allow
2987         ET_EXEC files with --just-symbols option.
2988
2989 2011-07-28  Cary Coutant  <ccoutant@google.com>
2990
2991         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2992         Add thread_number parameter.
2993         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2994         * workqueue-threads.cc
2995         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2996         current thread if its thread number is greater than desired thread
2997         count.
2998         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2999         Add thread_number parameter.
3000         (Workqueue::should_cancel_thread): Likewise.
3001         (Workqueue::find_runnable_or_wait): Pass thread_number to
3002         should_cancel_thread.
3003         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3004         parameter.
3005
3006 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3007
3008         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3009         only after checking if it cannot be forced local.
3010         * symtab.h (is_externally_visible): Check if the symbol is not forced
3011         local.
3012
3013 2011-07-15  Ian Lance Taylor  <iant@google.com>
3014
3015         * options.h (class General_options): Add --print-output-format.
3016         Move -EL next to -EB, for  better --help output.
3017         * target-select.cc: Include <cstdio>, "options.h", and
3018         "parameters.h".
3019         (Target_selector::do_target_bfd_name): New function.
3020         (print_output_format): New function.
3021         * target-select.h (class Target_selector): Update declarations.
3022         (Target_selector::target_bfd_name): New function.
3023         (print_output_format): Declare.
3024         * main.cc: Include "target-select.h".
3025         (main): Handle --print-output-format.
3026         * gold.cc: Include "target-select.h".
3027         (queue_initial_tasks): Handle --print-output-format when there are
3028         no input files.
3029         * parameters.cc (parameters_force_valid_target): Give a better
3030         error message if -EB/-EL does not match target.
3031         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3032         function.
3033
3034 2011-07-15  Ian Lance Taylor  <iant@google.com>
3035
3036         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3037         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3038         (Output_data_plt_i386::do_write): Write address of .dynamic
3039         section to first entry in .got.plt section.
3040         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3041         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3042         Initialize layout_.
3043         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3044         section to first entry in .got.plt section.
3045         * layout.h (Layout::dynamic_section): New function.
3046
3047 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3048
3049         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3050         to claim_file call.
3051         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3052         input_section_position_, and input_section_glob_.
3053         (read_layout_from_file): Call function section_ordering_specified.
3054         * layout.h (is_section_ordering_specified): New function.
3055         (section_ordering_specified): New function.
3056         (section_ordering_specified_): New boolean member.
3057         * main.cc(main): Call load_plugins after layout object is defined.
3058         * output.cc (Output_section::add_input_section): Use
3059         function section_ordering_specified to check if section ordering is
3060         needed.
3061         * output.cc (Output_section::add_relaxed_input_section): Use
3062         function section_ordering_specified to check if section ordering is
3063         needed.
3064         (Output_section::update_section_layout): New function.
3065         (Output_section::sort_attached_input_sections): Check if input section
3066         must be reordered.
3067         * output.h (Output_section::update_section_layout): New function.
3068         * plugin.cc (get_section_count): New function.
3069         (get_section_type): New function.
3070         (get_section_name): New function.
3071         (get_section_contents): New function.
3072         (update_section_order): New function.
3073         (allow_section_ordering): New function.
3074         (Plugin::load): Add the new interfaces to the transfer vector.
3075         (Plugin_manager::load_plugins): New parameter.
3076         (Plugin_manager::all_symbols_read): New parameter.
3077         (Plugin_manager::claim_file): New parameter. Save the elf object for
3078         unclaimed objects.
3079         (Plugin_manager::get_elf_object): New function.
3080         (Plugin_manager::get_view): Change to directly use the bool to check
3081         if get_view is called from claim_file_hook.
3082         * plugin.h (input_objects): New function
3083         (Plugin__manager::load_plugins): New parameter.
3084         (Plugin_manager::claim_file): New parameter.
3085         (Plugin_manager::get_elf_object): New function.
3086         (Plugin_manager::in_claim_file_handler): New function.
3087         (Plugin_manager::in_claim_file_handler_): New member.
3088         (layout): New function.
3089         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3090         handler with an extra parameter. Make the elf object before calling
3091         claim_file handler.
3092         * testsuite/plugin_test.c (get_section_count): New function pointer.
3093         (get_section_type): New function pointer.
3094         (get_section_name): New function pointer.
3095         (get_section_contents): New function pointer.
3096         (update_section_order): New function pointer.
3097         (allow_section_ordering): New function pointer.
3098         (onload): Check if the new interfaces exist.
3099
3100 2011-07-13  Ian Lance Taylor  <iant@google.com>
3101
3102         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3103         relro section.
3104         * x86_64.cc (Target_x86_64::got_section): Likewise.
3105         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3106         (relro_now_test_SOURCES): New variable.
3107         (relro_now_test_DEPENDENCIES): New variable.
3108         (relro_now_test_LDFLAGS): New variable.
3109         (relro_now_test_LDADD): New variable.
3110         (relro_now_test.so): New target.
3111         * testsuite/Makefile.in: Rebuild.
3112
3113 2011-07-12  Ian Lance Taylor  <iant@google.com>
3114
3115         PR gold/12980
3116         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3117         GLOB_DAT relocation rather than a RELATIVE relocation for a
3118         protected symbol when creating a shared library.
3119         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3120         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3121         * testsuite/protected_main_1.cc (main): Test that protected
3122         function has same address.
3123
3124 2011-07-11  Ian Lance Taylor  <iant@google.com>
3125
3126         PR gold/12979
3127         * options.h (class General_options): Add -Bgroup.
3128         * options.cc (General_options::finalize): If -Bgroup is set,
3129         default to --unresolved-symbols=report-all.
3130         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3131         * target-reloc.h (issue_undefined_symbol_error): Handle
3132         --unresolved-symbols=report-all.
3133
3134 2011-07-08  Ian Lance Taylor  <iant@google.com>
3135
3136         PR gold/11985
3137         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3138         if linker script discards key sections.
3139         (Layout::create_dynamic_symtab): Likewise.
3140         (Layout::assign_local_dynsym_offsets): Likewise.
3141         (Layout::sized_create_version_sections): Likewise.
3142         (Layout::create_interp): Likewise.
3143         (Layout::finish_dynamic_section): Likewise.
3144         (Layout::set_dynamic_symbol_size): Likewise.
3145
3146 2011-07-08  Ian Lance Taylor  <iant@google.com>
3147
3148         PR gold/12386
3149         * options.h (class General_options): Add --unresolved-symbols.
3150         * target-reloc.h (issue_undefined_symbol_error): Check
3151         --unresolved-symbols.  Add comments.
3152
3153 2011-07-08  Ian Lance Taylor  <iant@google.com>
3154
3155         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3156         expression more complex.
3157
3158 2011-07-08  Ian Lance Taylor  <iant@google.com>
3159
3160         PR gold/11317
3161         * target-reloc.h (issue_undefined_symbol_error): New inline
3162         function, broken out of relocate_section.
3163         (relocate_section): Call issue_undefined_symbol_error.
3164         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3165         there is no TLS segment if we are about to issue an undefined
3166         symbol error.
3167         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3168
3169 2011-07-08  Ian Lance Taylor  <iant@google.com>
3170
3171         PR gold/12279
3172         * resolve.cc (Symbol_table::should_override): Add fromtype
3173         parameter.  Change all callers.  Give error when linking together
3174         TLS and non-TLS symbol.
3175         (Symbol_table::should_override_with_special): Add fromtype
3176         parameter.  Change all callers.
3177         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3178         there is no TLS segment if we have reported some errors.
3179         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3180
3181 2011-07-08  Ian Lance Taylor  <iant@google.com>
3182
3183         PR gold/12372
3184         * target.h (Target::plt_address_for_global): New function.
3185         (Target::plt_address_for_local): New function.
3186         (Target::plt_section_for_global): Remove.
3187         (Target::plt_section_for_local): Remove.
3188         (Target::do_plt_address_for_global): New virtual function.
3189         (Target::do_plt_address_for_local): New virtual function.
3190         (Target::do_plt_section_for_global): Remove.
3191         (Target::do_plt_section_for_local): Remove.
3192         (Target::register_global_plt_entry): Add Symbol_table and Layout
3193         parameters.
3194         * output.cc (Output_data_got::Got_entry::write): Use
3195         plt_address_for_global and plt_address_for_local.
3196         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3197         address of output section.
3198         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3199         got_irelative_, and irelative_count_ fields.  Update
3200         declarations.
3201         (Output_data_plt_i386::has_irelative_section): New function.
3202         (Output_data_plt_i386::entry_count): Add irelative_count_.
3203         (Output_data_plt_i386::set_final_data_size): Likewise.
3204         (class Target_i386): Add got_irelative_ and rel_irelative_
3205         fields.  Update declarations.
3206         (Target_i386::Target_i386): Initialize new fields.
3207         (Target_i386::do_plt_address_for_global): New function replacing
3208         do_plt_section_for_global.
3209         (Target_i386::do_plt_address_for_local): New function replacing
3210         do_plt_section_for_local.
3211         (Target_i386::got_section): Create got_irelative_.
3212         (Target_i386::rel_irelative_section): New function.
3213         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3214         fields.  Don't define __rel_iplt_{start,end}.
3215         (Output_data_plt_i386::add_entry): Add symtab and layout
3216         parameters.  Change all callers.  Use different PLT and GOT for
3217         IFUNC symbols.
3218         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3219         layout parameters.  Change all callers.  Use different PLT and
3220         GOT.
3221         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3222         (Output_data_plt_i386::rel_irelative): New function.
3223         (Output_data_plt_i386::address_for_global): New function.
3224         (Output_data_plt_i386::address_for_local): New function.
3225         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3226         IRELATIVE GOT when changing IFUNC GOT entries.
3227         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3228         reloc.
3229         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3230         if we didn't create an IRELATIVE GOT.
3231         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3232         plt_address_for_local.
3233         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3234         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3235         got_irelative_, and irelative_count_ fields.  Update
3236         declarations.
3237         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3238         Initialize new fields.  Remove symtab parameter.  Change all
3239         callers.
3240         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3241         irelative_count_.
3242         (Output_data_plt_x86_64::has_irelative_section): New function.
3243         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3244         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3245         fields.  Update declarations.
3246         (Target_x86_64::Target_x86_64): Initialize new fields.
3247         (Target_x86_64::do_plt_address_for_global): New function replacing
3248         do_plt_section_for_global.
3249         (Target_x86_64::do_plt_address_for_local): New function replacing
3250         do_plt_section_for_local.
3251         (Target_x86_64::got_section): Create got_irelative_.
3252         (Target_x86_64::rela_irelative_section): New function.
3253         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3254         all callers.  Don't create __rel_iplt_{start,end}.
3255         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3256         parameters.  Change all callers.  Use different PLT and GOT for
3257         IFUNC symbols.
3258         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3259         layout parameters.  Change all callers.  Use different PLT and
3260         GOT.
3261         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3262         parameters.  Change all callers.  Use different PLT and GOT for
3263         IFUNC symbols.
3264         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3265         (Output_data_plt_x86_64::rela_irelative): New function.
3266         (Output_data_plt_x86_64::address_for_global): New function.
3267         (Output_data_plt_x86_64::address_for_local): New function.
3268         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3269         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3270         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3271         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3272         parameters.
3273         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3274         reloc.
3275         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3276         symbols if we didn't create an IRELATIVE GOT.
3277         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3278         plt_address_for_local.
3279         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3280         * testsuite/ifuncvar1.c: New test file.
3281         * testsuite/ifuncvar2.c: New test file.
3282         * testsuite/ifuncvar3.c: New test file.
3283         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3284         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3285         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3286         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3287         * testsuite/Makefile.in: Rebuild.
3288
3289 2011-07-07  Cary Coutant  <ccoutant@google.com>
3290
3291         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3292         (two_file_test_1_ndebug.o): Likewise.
3293         (two_file_test_1b_ndebug.o): Likewise.
3294         (two_file_test_2_ndebug.o): Likewise.
3295         (two_file_test_main_ndebug.o): Likewise.
3296         (incremental_test_2): Link with no-debug versions.
3297
3298 2011-07-06  Cary Coutant  <ccoutant@google.com>
3299
3300         * gold/incremental.cc
3301         (Output_section_incremental_inputs::write_info_blocks): Check for
3302         hidden and internal symbols.
3303
3304 2011-07-06  Cary Coutant  <ccoutant@google.com>
3305
3306         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3307         Check disposition for startup file.
3308         (Incremental_inputs::report_command_line): Ignore
3309         --incremental-startup-unchanged option.
3310         * options.cc (General_options::parse_incremental_startup_unchanged):
3311         New function.
3312         (General_options::General_options): Initialize new data member.
3313         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3314         (General_options): Add --incremental-startup-unchanged option.
3315         (General_options::incremental_startup_disposition): New function.
3316         (General_options::incremental_startup_disposition_): New data member.
3317
3318 2011-07-06  Cary Coutant  <ccoutant@google.com>
3319
3320         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3321         input file index to Script_info ctor.
3322         (Sized_incremental_binary::do_file_has_changed): Find the
3323         command-line argument for files named in scripts.
3324         * incremental.h (Script_info::Script_info): New ctor
3325         with input file index.
3326         (Script_info::input_file_index): New function.
3327         (Script_info::input_file_index_): New data member.
3328         (Incremental_binary::get_library): Add const.
3329         (Incremental_binary::get_script_info): Add const.
3330         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3331         * testsuite/Makefile.am (incremental_test_5): New test case.
3332         (incremental_test_6): New test case.
3333         * testsuite/Makefile.in: Regenerate.
3334
3335 2011-07-06  Cary Coutant  <ccoutant@google.com>
3336
3337         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3338         debug output when command lines differ.
3339
3340 2011-07-06  Cary Coutant  <ccoutant@google.com>
3341
3342         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3343         --incremental-patch option.
3344         * layout.cc (Free_list::allocate): Extend allocation beyond original
3345         end if enabled.
3346         (Layout::make_output_section): Mark sections that should get
3347         patch space.
3348         * options.cc (parse_percent): New function.
3349         * options.h (parse_percent): New function.
3350         (DEFINE_percent): New macro.
3351         (General_options): Add --incremental-patch option.
3352         * output.cc (Output_section::Output_section): Initialize new data
3353         members.
3354         (Output_section::add_input_section): Print section name when out
3355         of patch space.
3356         (Output_section::add_output_section_data): Likewise.
3357         (Output_section::set_final_data_size): Add patch space when
3358         doing --incremental-full.
3359         (Output_section::do_reset_address_and_file_offset): Remove patch
3360         space.
3361         (Output_segment::set_section_list_addresses): Print debug output
3362         only if --incremental-update.
3363         * output.h (Output_section::set_is_patch_space_allowed): New function.
3364         (Output_section::is_patch_space_allowed_): New data member.
3365         (Output_section::patch_space_): New data member.
3366         * parameters.cc (Parameters::incremental_full): New function.
3367         * parameters.h (Parameters::incremental_full): New function
3368         * testsuite/Makefile.am (incremental_test_2): Add test for
3369         --incremental-patch option.
3370         * testsuite/Makefile.in: Regenerate.
3371         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3372         (t18): Remove function body.
3373
3374 2011-07-05  Doug Kwan  <dougkwan@google.com>
3375
3376         PR gold/12771
3377         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3378         Arm_Address type for relocation result.
3379         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3380         overflow check.
3381         (Arm_relocate_functions::abs32): Use unaligned access.
3382         (Arm_relocate_functions::rel32): Ditto.
3383         (Arm_relocate_functions::prel31): Ditto.
3384         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3385         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3386         static data relocations.
3387         * testsuite/Makefile.in: Regnerate.
3388         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3389
3390 2011-07-05  Ian Lance Taylor  <iant@google.com>
3391
3392         PR gold/12392
3393         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3394         symbols if necessary.
3395         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3396
3397 2011-07-05  Ian Lance Taylor  <iant@google.com>
3398
3399         PR gold/12952
3400         * resolve.cc (Symbol::override_base_with_special): Simply override
3401         version with special symbol version, ignoring previous version.
3402
3403 2011-07-05  Ian Lance Taylor  <iant@google.com>
3404
3405         * object.cc (Sized_relobj_file::include_section_group): Add
3406         information to comment about signature location.
3407
3408 2011-07-02  Ian Lance Taylor  <iant@google.com>
3409
3410         PR gold/12957
3411         * options.h (class General_options): Add -f and -F.
3412         * options.cc (General_options::finalize): Fatal error if -f/-F
3413         are used without -shared.
3414         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3415
3416 2011-07-02  Ian Lance Taylor  <iant@google.com>
3417
3418         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3419
3420 2011-07-01  Ian Lance Taylor  <iant@google.com>
3421
3422         PR gold/12525
3423         PR gold/12952
3424         * resolve.cc (Symbol::override_base_with_special): Don't override
3425         the version if the overriding symbol has a different name.
3426         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3427         all callers.  If we give an error about an undefined version,
3428         define the base version if necessary.
3429         * dynobj.h (class Versions): Update declaration.
3430         * testsuite/weak_alias_test_5.cc: New file.
3431         * testsuite/weak_alias_test.script: New file.
3432         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3433         and versioned_alias have the right value, and call t2.
3434         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3435         weak_alias_test_5.so.
3436         (weak_alias_test_LDADD): Likewise.
3437         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3438         * testsuite/Makefile.in: Rebuild.
3439
3440 2011-07-01  Ian Lance Taylor  <iant@google.com>
3441
3442         PR gold/12525
3443         * options.h (class General_options): Support -z notext.
3444         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3445         -Wl,-z,notext.
3446         (two_file_shared_nonpic.so): Likewise.
3447         (two_file_shared_mixed.so): Likewise.
3448         (two_file_shared_mixed_1.so): Likewise.
3449         (weak_undef_lib_nonpic.so): Likewise.
3450         (alt/weak_undef_lib_nonpic.so): Likewise.
3451         (tls_test_shared_nonpic.so): Likewise.
3452         * testsuite/Makefile.in: Rebuild.
3453
3454 2011-07-01  Ian Lance Taylor  <iant@google.com>
3455
3456         PR gold/12525
3457         * configure.ac: Test whether static linking works, setting
3458         the automake conditional HAVE_STATIC.
3459         * testsuite/Makefile.am: Disable tests using -static if
3460         HAVE_STATIC is not true.
3461         * configure, testsuite/Makefile.in: Rebuild.
3462
3463 2011-07-01  Ian Lance Taylor  <iant@google.com>
3464
3465         PR gold/12525
3466         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3467         Assert if we see DW_EH_PE_indirect.
3468         * target.h (Target::ehframe_datarel_base): New function.
3469         (Target::do_ehframe_datarel_base): New target function.
3470         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3471         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3472         function.
3473
3474 2011-07-01  Ian Lance Taylor  <iant@google.com>
3475
3476         PR gold/12571
3477         * options.h (class General_options): Add
3478         --ld-generated-unwind-info.
3479         * ehframe.cc (Fde::write): Add address parameter.  Change all
3480         callers.  If associated with PLT, fill in address and size.
3481         (Cie::set_output_offset): Only add merge mapping if there is an
3482         object.
3483         (Cie::write): Add address parameter.  Change all callers.
3484         (Eh_frame::add_ehframe_for_plt): New function.
3485         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3486         input_offset_ fields into union u_, with new plt field.
3487         (Fde::Fde): Adjust for new union field.
3488         (Fde::Fde) [Output_data version]: New constructor.
3489         (Fde::add_mapping): Only add merge mapping if there is an object.
3490         (class Cie): Update declarations.
3491         (class Eh_frame): Declare add_ehframe_for_plt.
3492         * layout.cc (Layout::layout_eh_frame): Break out code into
3493         make_eh_frame_section, and call it.
3494         (Layout::make_eh_frame_section): New function.
3495         (Layout::add_eh_frame_for_plt): New function.
3496         * layout.h (class Layout): Update declarations.
3497         * merge.cc (Merge_map::add_mapping): Add assertion.
3498         * i386.cc: Include "dwarf.h".
3499         (class Output_data_plt_i386): Make first_plt_entry,
3500         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3501         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3502         and plt_eh_frame_fde.
3503         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3504         boundary.  Call add_eh_frame_for_plt if appropriate.
3505         * x86_64.cc: Include "dwarf.h".
3506         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3507         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3508         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3509         and plt_eh_frame_fde.
3510         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3511         appropriate.
3512
3513 2011-06-29  Ian Lance Taylor  <iant@google.com>
3514
3515         PR gold/12629
3516         * object.cc (Sized_relobj_file::layout_section): Change shdr
3517         parameter to be const.
3518         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3519         out of do_layout.
3520         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3521         appropriate.  Call layout_eh_frame_section.
3522         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3523         sections.
3524         * object.h (class Sized_relobj_file): Update declarations.
3525
3526 2011-06-29  Ian Lance Taylor  <iant@google.com>
3527
3528         PR gold/12652
3529         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3530         modifier.
3531         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3532
3533 2011-06-29  Ian Lance Taylor  <iant@google.com>
3534
3535         PR gold/12675
3536         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3537         SHT_X86_64_UNWIND.
3538         * layout.cc (Layout::layout_eh_frame): Likewise.
3539
3540 2011-06-29  Ian Lance Taylor  <iant@google.com>
3541
3542         PR gold/12695
3543         * layout.cc (Layout::symtab_section_shndx): New function.
3544         * layout.h (class Layout): Declare symtab_section_shndx.
3545         * output.cc (Output_section::write_header): Call it.
3546
3547 2011-06-29  Ian Lance Taylor  <iant@google.com>
3548
3549         PR gold/12818
3550         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3551         symbols which are not used in a relocation.
3552
3553 2011-06-28  Ian Lance Taylor  <iant@google.com>
3554
3555         PR gold/12898
3556         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3557         script create indistinguishable segments.
3558         (Layout::set_segment_offsets): Use stable_sort when sorting
3559         segments.  Pass this to Compare_segments constructor.
3560         * layout.h (class Layout): Make segment_precedes non-static.
3561         (class Compare_segments): Change from struct to class.  Add
3562         layout_ field.  Add constructor.
3563         * script-sections.cc
3564         (Script_sections::attach_sections_using_phdrs_clause): Rename
3565         local orphan to is_orphan.  Don't report failure to put empty
3566         section in segment.  On attachment failure, report name of
3567         section, and attach to first PT_LOAD segment.
3568
3569 2011-06-28  Ian Lance Taylor  <iant@google.com>
3570
3571         PR gold/12934
3572         * target-select.cc (Target_selector::Target_selector): Add
3573         emulation parameter.  Change all callers.
3574         (select_target_by_bfd_name): Rename from select_target_by_name.
3575         Change all callers.
3576         (select_target_by_emulation): New function.
3577         (supported_emulation_names): New function.
3578         * target-select.h (class Target_selector): Add emulation_ field.
3579         Update declarations.
3580         (Target_selector::recognize_by_bfd_name): Rename from
3581         recognize_by_name.  Change all callers.
3582         (Target_selector::supported_bfd_names): Rename from
3583         supported_names.  Change all callers.
3584         (Target_selector::recognize_by_emulation): New function.
3585         (Target_selector::supported_emulations): New function.
3586         (Target_selector::emulation): New function.
3587         (Target_selector::do_recognize_by_bfd_name): Rename from
3588         do_recognize_by_name.  Change all callers.
3589         (Target_selector::do_supported_bfd_names): Rename from
3590         do_supported_names.  Change all callers.
3591         (Target_selector::do_recognize_by_emulation): New function.
3592         (Target_selector::do_supported_emulations): New function.
3593         (select_target_by_bfd_name): Change name in declaration.
3594         (select_target_by_emulation): Declare.
3595         (supported_emulation_names): Declare.
3596         * parameters.cc (parameters_force_valid_target): Try to find
3597         target based on emulation from -m option.
3598         * options.h (class General_options): Change doc string for -m.
3599         * options.cc (help): Print emulations.
3600         (General_options::parse_V): Likewise.
3601         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3602         Add emulation parameter.  Change all callers.
3603
3604 2011-06-28  Ian Lance Taylor  <iant@google.com>
3605
3606         * target.h (class Target): Add osabi_ field.
3607         (Target::osabi): New function.
3608         (Target::set_osabi): New function.
3609         (Target::Target): Initialize osabi_.
3610         (Target::do_adjust_elf_header): Make pure virtual.
3611         (Sized_target::do_adjust_elf_header): Declare.
3612         * target.cc (Sized_target::do_adjust_elf_header): New function.
3613         (class Sized_target): Instantiate all versions.
3614         * freebsd.h (class Target_freebsd): Remove.
3615         (Target_selector_freebsd::do_recognize): Call set_osabi on
3616         Target.
3617         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3618         (Target_selector_freebsd::set_osabi): Remove.
3619         * i386.cc (class Target_i386): Inherit from Sized_target rather
3620         than Target_freebsd.
3621         * x86_64.cc (class Target_x86_64): Likewise.
3622
3623 2011-06-28  Ian Lance Taylor  <iant@google.com>
3624
3625         * target.h (Target::can_check_for_function_pointers): Rewrite.
3626         Make non-virtual.
3627         (Target::can_icf_inline_merge_sections): Likewise.
3628         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3629         (Target::Target_info): Add can_icf_inline_merge_sections field.
3630         (Target::do_can_check_for_function_pointers): New virtual
3631         function.
3632         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3633         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3634         from can_check_for_function_pointers, move in file.
3635         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3636         section_may_have_icf_unsafe_poineters, move in file.
3637         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3638         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3639         Rename from can_check_for_function_pointers, move in file.
3640         (Target_i386::can_icf_inline_merge_sections): Remove.
3641         (Target_i386::i386_info): Initialize
3642         can_icf_inline_merge_sections.
3643         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3644         Initialize can_icf_inline_merge_sections.
3645         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3646         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3647         Rename from can_check_for_function_pointers, move in file.
3648         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3649         (Target_x86_64::x86_64_info): Initialize
3650         can_icf_inline_merge_sections.
3651         * testsuite/testfile.cc (Target_test::test_target_info):
3652         Likewise.
3653         * icf.cc (get_section_contents): Correct formatting.
3654
3655 2011-06-27  Ian Lance Taylor  <iant@google.com>
3656
3657         * symtab.cc (Symbol::versioned_name): New function.
3658         (Symbol_table::add_to_final_symtab): Use versioned_name when
3659         appropriate.
3660         (Symbol_table::sized_write_symbol): Likewise.
3661         * symtab.h (class Symbol): Declare versioned_name.
3662         * stringpool.h (class Stringpool_template): Add variant of add
3663         which takes a std::basic_string.
3664         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3665         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3666         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3667         (ver_test_12.o): New target.
3668         * testsuite/Makefile.in: Rebuild.
3669
3670 2011-06-27  Doug Kwan  <dougkwan@google.com>
3671
3672         * arm.cc (Arm_relocate_functions::thm_jump8,
3673         Arm_relocate_functions::thm_jump11): Use a wider signed
3674         type to compute offset.
3675         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3676         arm_thm_jump8.
3677         * testsuite/Makefile.in: Regenerate.
3678         * testsuite/arm_branch_in_range.sh: Check test results of
3679         arm_thm_jump11 and arm_thm_jump8.
3680         * testsuite/arm_thm_jump11.s: New test source file.
3681         * testsuite/arm_thm_jump11.t: New linker script.
3682         * testsuite/arm_thm_jump8.s: New test source file.
3683         * testsuite/arm_thm_jump8.t: New linker script.
3684
3685 2011-06-24  Ian Lance Taylor  <iant@google.com>
3686
3687         * layout.cc: Include "object.h".
3688         (ctors_sections_in_init_array): New static variable.
3689         (Layout::is_ctors_in_init_array): New function.
3690         (Layout::layout): Add entry to ctors_sections_in_init_array if
3691         appropriate.
3692         * layout.h (class Layout): Declare is_ctors_in_init_array.
3693         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3694         is_ctors_reverse_view is set.
3695         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3696         all callers.  Set is_ctors_reverse_view field of View_size.
3697         (Sized_relobj_file::reverse_words): New function.
3698         * object.h (Sized_relobj_file::View_size): Add
3699         is_ctors_reverse_view field.
3700         (class Sized_relobj_file): Update declarations.
3701         * testsuite/initpri3.c: New test.
3702         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3703         initpri3b.
3704         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3705         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3706         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3707         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3708         * testsuite/Makefile.in: Rebuild.
3709
3710 2011-06-24  Cary Coutant  <ccoutant@google.com>
3711
3712         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3713         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3714         (debug_msg_cdebug.err): New targets.
3715         * testsuite/Makefile.in: Regenerate.
3716         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3717         Fix checks for link with shared library.
3718
3719 2011-06-24  Doug Kwan  <dougkwan@google.com>
3720
3721         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3722         skip empty text sections.
3723         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3724
3725 2011-06-22  Ian Lance Taylor  <iant@google.com>
3726
3727         PR gold/12910
3728         * options.h (class General_options): Add --ctors-in-init-array.
3729         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3730         friends as SHT_PROGBITS for merging sections.
3731         (Layout::layout): Remove special handling of .init_array and
3732         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3733         and .dtors if ctors_in_init_array.
3734         (Layout::make_output_section): Force correct section types for
3735         .init_array and friends.  Don't sort if doing relocatable link,
3736         Don't sort .ctors and .dtors if ctors_in_init_array.
3737         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3738         (Layout::output_section_name): Add relobj parameter.  Change all
3739         callers.  Handle .ctors. and .dtors. in code rather than table.
3740         Handle .ctors and .dtors if ctors_in_init_array.
3741         (Layout::match_file_name): New function, moved from output.cc.
3742         * layout.h (class Layout): Update declarations.
3743         * output.cc: Include "layout.h".
3744         (Input_section_sort_entry::get_priority): New function.
3745         (Input_section_sort_entry::match_file_name): Just call
3746         Layout::match_file_name.
3747         (Output_section::Input_section_sort_init_fini_compare::operator()):
3748         Handle .ctors and .dtors.  Sort by explicit priority rather than
3749         by name.
3750         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3751         * testsuite/initpri2.c: New test.
3752         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3753         (check_PROGRAMS): Add initpri2.
3754         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3755         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3756         * configure, testsuite/Makefile.in: Rebuild.
3757
3758 2011-06-19  Ian Lance Taylor  <iant@google.com>
3759
3760         PR gold/12880
3761         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3762         .interp section to a PT_INTERP segment even if we have seen a
3763         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3764         clause in a linker script.
3765         (Layout::finalize): Don't create a .interp section if we've
3766         already create a PT_INTERP segment.
3767         (Layout::create_interp): Always call choose_output_section (revert
3768         patch of 2011-06-17).  Don't create PT_INTERP segment.
3769         * script-sections.cc
3770         (Script_sections::create_note_and_tls_segments): Add a .interp
3771         section to a PT_INTERP segment even if we have seen a
3772         --dynamic-linker option.
3773
3774 2011-06-18  Ian Lance Taylor  <iant@google.com>
3775
3776         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3777         merely because a non-PT_LOAD segment has a dynamic reloc.
3778
3779 2011-06-18  Ian Lance Taylor  <iant@google.com>
3780
3781         * layout.cc (Layout::finish_dynamic_section): Don't create
3782         DT_FLAGS entry if not needed.
3783
3784 2011-06-18  Ian Lance Taylor  <iant@google.com>
3785
3786         PR gold/12745
3787         * layout.cc (Layout::layout_eh_frame): Correct handling of
3788         writable .eh_frame section.
3789
3790 2011-06-17  Ian Lance Taylor  <iant@google.com>
3791
3792         PR gold/12893
3793         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3794         symbol is redefined with the exact same object and value.
3795
3796 2011-06-17  Ian Lance Taylor  <iant@google.com>
3797
3798         PR gold/12880
3799         * layout.h (class Layout): Add interp_segment_ field.
3800         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3801         (Layout::attach_allocated_section_to_segment): If making shared
3802         library, put .interp section in PT_INTERP segment.
3803         (Layout::finalize): Also call create_interp if -dynamic-linker
3804         option was used.
3805         (Layout::create_interp): Assert that there is no PT_INTERP
3806         segment.  If not using a SECTIONS clause, use make_output_section.
3807         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3808         * script-sections.cc
3809         (Script_sections::create_note_and_tls_segments): If making shared
3810         library, put .interp section in PT_INTERP segment.
3811
3812 2011-06-17  Ian Lance Taylor  <iant@google.com>
3813
3814         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3815         when making a shared library.
3816
3817 2011-06-17  Ian Lance Taylor  <iant@google.com>
3818
3819         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3820         parameter.  Change all callers.  Don't issue warning about PC32
3821         against locally defined symbol.
3822
3823 2011-06-16  Ian Lance Taylor  <iant@google.com>
3824
3825         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3826         occurs in same object.
3827
3828 2011-06-14  Alan Modra  <amodra@gmail.com>
3829
3830         * po/POTFILES.in: Regenerate.
3831
3832 2011-06-09  Ian Lance Taylor  <iant@google.com>
3833
3834         * script-sections.cc
3835         (Orphan_output_section::set_section_addresses): For a relocatable
3836         link set address to 0.
3837
3838 2011-06-09  Cary Coutant  <ccoutant@google.com>
3839
3840         PR gold/12804
3841         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3842         used with --compress-debug-sections.
3843         * gold/object.cc (Sized_relobj_file::do_layout): Report
3844         uncompressed size of compressed input sections.
3845
3846 2011-06-08  Cary Coutant  <ccoutant@google.com>
3847
3848         PR gold/12804
3849         * testsuite/two_file_test_2_v1.cc: Change initialization of
3850         v2 to keep it in .data.
3851
3852 2011-06-07  Cary Coutant  <ccoutant@google.com>
3853
3854         * common.cc (Symbol_table::do_allocate_commons_list): Call
3855         gold_fallback.
3856         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3857         (Errors::fallback): New function.
3858         (gold_fallback): New function.
3859         * errors.h (Errors::fallback): New function.
3860         * gold.cc (gold_exit): Change status parameter to enum; adjust
3861         all callers.
3862         (queue_initial_tasks): Call gold_fallback.
3863         * gold.h: Include cstdlib.
3864         (Exit_status): New enum type.
3865         (gold_exit): Change status parameter to enum.
3866         (gold_fallback): New function.
3867         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3868         (Layout::create_symtab_sections): Likewise.
3869         (Layout::create_shdrs): Likewise.
3870         * main.cc (main): Adjust call to gold_exit.
3871         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3872         (Output_data_got::add_got_entry_pair): Likewise.
3873         (Output_section::add_input_section): Likewise.
3874         (Output_section::add_output_section_data): Likewise.
3875         (Output_segment::set_section_list_addresses): Likewise.
3876         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3877
3878 2011-06-07  Cary Coutant  <ccoutant@google.com>
3879
3880         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3881         for incremental links.
3882         * output.cc (Output_segment::set_section_list_addresses): Remove
3883         FIXME and test for TLS or BSS.
3884
3885 2011-06-07  Cary Coutant  <ccoutant@google.com>
3886
3887         * testsuite/Makefile.am: Add incremental_copy_test,
3888         incremental_common_test_1.
3889         * testsuite/Makefile.in: Regenerate.
3890         * testsuite/common_test_1_v1.c: New source file.
3891         * testsuite/common_test_1_v2.c: New source file.
3892         * testsuite/copy_test_v1.cc: New source file.
3893
3894 2011-06-07  Cary Coutant  <ccoutant@google.com>
3895
3896         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3897         update, allocate common from bss section's free list.
3898         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3899         linker-defined symbols.
3900         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3901         Skip GOT and PLT entries that are no longer referenced.
3902         (Output_section_incremental_inputs::write_info_blocks): Mark
3903         linker-defined symbols.
3904         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3905         * output.cc (Output_section::allocate): New function.
3906         * output.h (Output_section::allocate): New function.
3907         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3908         linker-defined symbols.
3909         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3910         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3911         (Symbol::init_base_output_data): Likewise.
3912         (Symbol::init_base_output_segment): Likewise.
3913         (Symbol::init_base_constant): Likewise.
3914         (Sized_symbol::init_output_data): Likewise.
3915         (Sized_symbol::init_output_segment): Likewise.
3916         (Sized_symbol::init_constant): Likewise.
3917         (Symbol_table::do_define_in_output_data): Likewise.
3918         (Symbol_table::do_define_in_output_segment): Likewise.
3919         (Symbol_table::do_define_as_constant): Likewise.
3920         * symtab.h (Symbol::is_predefined): New function.
3921         (Symbol::init_base_output_data): Add is_predefined parameter.
3922         (Symbol::init_base_output_segment): Likewise.
3923         (Symbol::init_base_constant): Likewise.
3924         (Symbol::is_predefined_): New data member.
3925         (Sized_symbol::init_output_data): Add is_predefined parameter.
3926         (Sized_symbol::init_output_segment): Likewise.
3927         (Sized_symbol::init_constant): Likewise.
3928         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3929
3930 2011-06-07  Cary Coutant  <ccoutant@google.com>
3931
3932         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3933         instead of emit_copy_reloc.
3934         (Copy_relocs::emit_copy_reloc): Refactor.
3935         (Copy_relocs::make_copy_reloc): New function.
3936         (Copy_relocs::add_copy_reloc): Remove.
3937         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3938         section.
3939         (Copy_relocs::make_copy_reloc): New function.
3940         (Copy_relocs::add_copy_reloc): Remove.
3941         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3942         unchanged input files.
3943         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3944         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3945         Reserve BSS space for COPY relocations.
3946         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3947         (Output_section_incremental_inputs::write_info_blocks): Record
3948         whether a symbol is copied from a shared object.
3949         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3950         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3951         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3952         (Incremental_input_entry_reader::get_output_symbol_index): Add
3953         is_copy parameter.
3954         (Incremental_binary::emit_copy_relocs): New function.
3955         (Incremental_binary::do_emit_copy_relocs): New function.
3956         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3957         new data member.
3958         (Sized_incremental_binary::add_copy_reloc): New function.
3959         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3960         (Sized_incremental_binary::Copy_reloc): New struct.
3961         (Sized_incremental_binary::Copy_relocs): New typedef.
3962         (Sized_incremental_binary::copy_relocs_): New data member.
3963         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3964         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3965         * target.h (Sized_target::emit_copy_reloc): New function.
3966         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3967
3968 2011-06-02  Cary Coutant  <ccoutant@google.com>
3969
3970         PR gold/12163
3971         * gold/archive.cc (Archive::Archive): Initialize new data member.
3972         (Archive::include_all_members): Return if archive has already been
3973         included.
3974         * gold/archive.h (Archive::include_all_members_): New data member.
3975
3976 2011-06-02  Nick Clifton  <nickc@redhat.com>
3977
3978         * dynobj.h: Fix spelling mistake in comment.
3979         * output.cc: Likewise.
3980
3981 2011-05-31  Doug Kwan  <dougkwan@google.com>
3982             Asier Llano
3983
3984         PR gold/12826
3985         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3986         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3987         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3988         redundant arm_exidx_test.so.
3989         * testsuite/Makefile.in: Regenerate.
3990         (check_SCRIPTS): Add pr12826.sh
3991         (check_DATA): Add pr12826.stdout
3992         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3993         * testsuite/pr12826.sh: New file.
3994         * testsuite/pr12826_1.s: Ditto.
3995         * testsuite/pr12826_1.s: Ditto.
3996
3997 2011-05-30  Ian Lance Taylor  <iant@google.com>
3998
3999         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4000         sections.
4001
4002 2011-05-29  Ian Lance Taylor  <iant@google.com>
4003
4004         PR gold/12804
4005         * testsuite/Makefile.am: Use different file name for two_file_test
4006         temporary file for each incremental test.
4007         * testsuite/Makefile.in: Rebuild.
4008
4009 2011-05-29  Ian Lance Taylor  <iant@google.com>
4010
4011         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4012         binary input file is empty.
4013
4014 2011-05-27  Ian Lance Taylor  <iant@google.com>
4015
4016         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4017         (ver_test_9.so): Likewise.
4018         * testsuite/Makefile.in: Rebuild.
4019
4020 2011-05-26 Cary Coutant  <ccoutant@google.com>
4021
4022         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4023         * incremental.cc (Incremental_inputs::report_input_section): Fix
4024         comment, indentation.
4025         (Incremental_inputs::report_comdat_group): New function.
4026         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4027         of data for incremental input file entry.
4028         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4029         group count, COMDAT group signatures.
4030         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4031         an unchanged input file.
4032         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4033         Initialize new data member.
4034         (Incremental_object_entry::add_comdat_group): New function.
4035         (Incremental_object_entry::get_comdat_group_count): New function.
4036         (Incremental_object_entry::get_comdat_signature_key): New function.
4037         (Incremental_object_entry::groups_): New data member.
4038         (Incremental_inputs::report_comdat_group): New function.
4039         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4040         data for incremental input file entry.
4041         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4042         (Incremental_input_entry_reader::get_input_section): Adjust size of
4043         data for incremental input file entry.
4044         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4045         (Incremental_input_entry_reader::get_comdat_group_signature): New
4046         function.
4047         * object.cc (Sized_relobj::include_section_group): Report kept
4048         COMDAT groups for incremental links.
4049
4050 2011-05-24  David Meyer  <pdox@google.com>
4051
4052         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4053         with name parameter.  Add found_name parameter.
4054         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4055         * dirsearch.h (class Dirsearch): Update declaration.
4056
4057 2011-05-24  Ian Lance Taylor  <iant@google.com>
4058
4059         * archive.cc (Library_base::should_include_member): Pull in object
4060         from archive if it defines the entry symbol.
4061         * parameters.cc (Parameters::entry): New function.
4062         * parameters.h (class Parameters): Declare entry.
4063         * output.h (class Output_file_header): Remove entry_ field.
4064         * output.cc (Output_file_header::Output_file_header): Remove entry
4065         parameter.  Change all callers.
4066         (Output_file_header::entry): Use parameters->entry.
4067         * gold.cc (queue_middle_tasks): Likewise.
4068         * plugin.cc (Plugin_hook::run): Likewise.
4069
4070 2011-05-24 Cary Coutant  <ccoutant@google.com>
4071
4072         * gold.cc (queue_initial_tasks): Pass incremental base filename
4073         to Output_file::open_base_file; don't print error message.
4074         * incremental-dump.cc (main): Adjust call to
4075         Output_file::open_for_modification.
4076         * incremental-dump.cc (main): Likewise.
4077         * incremental.cc (Incremental_inputs::report_command_line):
4078         Ignore --incremental-base option when comparing command lines.
4079         Ignore parameter when given as separate argument.
4080         * options.h (class General_options): Add --incremental-base.
4081         * output.cc (Output_file::Output_file):
4082         (Output_file::open_base_file): Add base_name and writable parameters;
4083         read base file into new file; print error message here.
4084         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4085         callers.
4086         * output.h (Output_file::open_for_modification): Rename to...
4087         (Output_file::open_base_file): ...this; add base_name and
4088         writable parameters; adjust all callers.
4089         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4090         callers.
4091         * testsuite/Makefile.am (incremental_test_4): Test
4092         --incremental-base.
4093         * testsuite/Makefile.in: Regenerate.
4094
4095 2011-05-24 Cary Coutant  <ccoutant@google.com>
4096
4097         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4098         incremental_test_4.
4099         * testsuite/Makefile.in: Regenerate.
4100         * testsuite/two_file_test_1_v1.cc: New test source file.
4101         * testsuite/two_file_test_1b_v1.cc: New test source file.
4102         * testsuite/two_file_test_2_v1.cc: New test source file.
4103
4104 2011-05-24 Cary Coutant  <ccoutant@google.com>
4105
4106         * dynobj.h (Dynobj::do_dynobj): New function.
4107         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4108         flag and soname for shared objects.
4109         * incremental.cc (Incremental_inputs::report_object): Make
4110         either Incremental_object_entry or Incremental_dynobj_entry; add
4111         soname to string table.
4112         (Incremental_inputs::report_input_section): Add assertion.
4113         (Output_section_incremental_inputs::set_final_data_size): Adjust
4114         type of input file entry for shared libraries; adjust size of
4115         shared library info entry.
4116         (Output_section_incremental_inputs::write_input_files): Write
4117         as_needed flag for shared libraries.
4118         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4119         of input file entry for shared libraries; write soname.
4120         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4121         soname from incremental info.
4122         * incremental.h (enum Incremental_input_flags): Add
4123         INCREMENTAL_INPUT_AS_NEEDED.
4124         (Incremental_input_entry::Incremental_input_entry): Initialize new
4125         data member.
4126         (Incremental_input_entry::set_as_needed): New function.
4127         (Incremental_input_entry::as_needed): New function.
4128         (Incremental_input_entry::do_dynobj_entry): New function.
4129         (Incremental_input_entry::as_needed_): New data member.
4130         (Incremental_object_entry::Incremental_object_entry): Don't check
4131         for shared library.
4132         (Incremental_object_entry::do_type): Likewise.
4133         (class Incremental_dynobj_entry): New class.
4134         (Incremental_input_entry_reader::as_needed): New function.
4135         (Incremental_input_entry_reader::get_soname): New function.
4136         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4137         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4138         size of shared library info entry.
4139         * layout.cc (Layout::finish_dynamic_section): Don't test for
4140         incremental link when adding DT_NEEDED entries.
4141         * object.h (Object::Object): Initialize new data member.
4142         (Object::dynobj): New function.
4143         (Object::set_as_needed): New function.
4144         (Object::as_needed): New function.
4145         (Object::do_dynobj): New function.
4146         (Object::as_needed_): New data member.
4147
4148 2011-05-24 Cary Coutant  <ccoutant@google.com>
4149
4150         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4151         info; adjust display of GOT entries.
4152         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4153         vector of input objects; remove file_status_.
4154         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4155         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4156         got_plt reader; call target hooks to reserve GOT entries.
4157         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4158         of input file info header and GOT info entry.
4159         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4160         relocation info.
4161         (Got_plt_view_info::got_descriptor): Remove.
4162         (Got_plt_view_info::sym_index): New data member.
4163         (Got_plt_view_info::input_index): New data member.
4164         (Local_got_offset_visitor::visit): Write input file index.
4165         (Global_got_offset_visitor::visit): Write 0 for input file index.
4166         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4167         with sym_index and input_index.
4168         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4169         incremental info GOT entry; replace got_descriptor with input_index.
4170         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4171         map from input file index to object.
4172         (Sized_relobj_incr::do_layout): Replace direct data member reference
4173         with accessor function.
4174         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4175         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4176         Adjust size of input file info header.
4177         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4178         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4179         (Incremental_input_entry_reader::get_input_section): Adjust size of
4180         input file info header.
4181         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4182         of incremental info GOT entry.
4183         (Incremental_got_plt_reader::get_got_desc): Remove.
4184         (Incremental_got_plt_reader::get_got_symndx): New function.
4185         (Incremental_got_plt_reader::get_got_input_index): New function.
4186         (Sized_incremental_binary::Sized_incremental_binary): Remove
4187         file_status_; add input_objects_.
4188         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4189         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4190         (Sized_incremental_binary::file_is_unchanged): Remove.
4191         (Sized_incremental_binary::set_input_object): New function.
4192         (Sized_incremental_binary::input_object): New function.
4193         (Sized_incremental_binary::file_status_): Remove.
4194         (Sized_incremental_binary::input_objects_): New data member.
4195         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4196         references.
4197         (Sized_relobj_incr::invalid_address): Move to base class.
4198         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4199         class.
4200         (Sized_relobj_incr::do_output_section_offset): Likewise.
4201         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4202         (Sized_relobj_incr::section_offsets_): Likewise.
4203         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4204         function.
4205         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4206         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4207         with accessor function.
4208         (Sized_relobj_file::do_layout): Likewise.
4209         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4210         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4211         (Sized_relobj_file::compute_final_local_value): Replace refs to
4212         section_offsets_ with accessor function.
4213         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4214         * object.h (Relobj::Relobj): Initialize new data members.
4215         (Relobj::add_dyn_reloc): New function.
4216         (Relobj::first_dyn_reloc): New function.
4217         (Relobj::dyn_reloc_count): New function.
4218         (Relobj::first_dyn_reloc_): New data member.
4219         (Relobj::dyn_reloc_count_): New data member.
4220         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4221         references.
4222         (Sized_relobj::Address): New typedef.
4223         (Sized_relobj::invalid_address): Move here from child class.
4224         (Sized_relobj::Sized_relobj): Initialize new data members.
4225         (Sized_relobj::sized_relobj): New function.
4226         (Sized_relobj::is_output_section_offset_invalid): Move here from
4227         child class.
4228         (Sized_relobj::get_output_section_offset): Likewise.
4229         (Sized_relobj::local_has_got_offset): Likewise.
4230         (Sized_relobj::local_got_offset): Likewise.
4231         (Sized_relobj::set_local_got_offset): Likewise.
4232         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4233         (Sized_relobj::clear_got_offsets): New function.
4234         (Sized_relobj::section_offsets): Move here from child class.
4235         (Sized_relobj::do_output_section_offset): Likewise.
4236         (Sized_relobj::do_set_section_offset): Likewise.
4237         (Sized_relobj::Local_got_offsets): Likewise.
4238         (Sized_relobj::local_got_offsets_): Likewise.
4239         (Sized_relobj::section_offsets_): Likewise.
4240         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4241         references.
4242         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4243         class.
4244         (Sized_relobj_file::sized_relobj): New function
4245         (Sized_relobj_file::local_has_got_offset): Move to base class.
4246         (Sized_relobj_file::local_got_offset): Likewise.
4247         (Sized_relobj_file::set_local_got_offset): Likewise.
4248         (Sized_relobj_file::get_output_section_offset): Likewise.
4249         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4250         (Sized_relobj_file::do_output_section_offset): Likewise.
4251         (Sized_relobj_file::do_set_section_offset): Likewise.
4252         (Sized_relobj_file::Local_got_offsets): Likewise.
4253         (Sized_relobj_file::local_got_offsets_): Likewise.
4254         (Sized_relobj_file::section_offsets_): Likewise.
4255         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4256         (all constructors).
4257         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4258         (Output_reloc::get_symbol_index): Likewise.
4259         (Output_reloc::local_section_offset): Likewise.
4260         (Output_reloc::get_address): Likewise.
4261         (Output_reloc::symbol_value): Likewise.
4262         (Output_data_got::reserve_slot): Move to class definition.
4263         (Output_data_got::reserve_local): New function.
4264         (Output_data_got::reserve_slot_for_global): Remove.
4265         (Output_data_got::reserve_global): New function.
4266         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4267         (all constructors, two instantiations).
4268         (Output_reloc::get_relobj): New function (two instantiations).
4269         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4270         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4271         (Output_data_reloc::add_global): Adjust type of relobj.
4272         (Output_data_reloc::add_global_relative): Likewise.
4273         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4274         (Output_data_reloc::add_local): Likewise.
4275         (Output_data_reloc::add_local_relative): Likewise.
4276         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4277         (Output_data_reloc::add_local_section): Likewise.
4278         (Output_data_reloc::add_output_section): Likewise.
4279         (Output_data_reloc::add_absolute): Likewise.
4280         (Output_data_reloc::add_target_specific): Likewise.
4281         (Output_data_got::reserve_slot): Move definition here.
4282         (Output_data_got::reserve_local): New function.
4283         (Output_data_got::reserve_global): New function.
4284         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4285         section_offsets_ with accessor function.
4286         (Sized_relobj_file::write_sections): Likewise.
4287         (Sized_relobj_file::do_relocate_sections): Likewise.
4288         * target.h (Sized_target::reserve_local_got_entry): New function.
4289         (Sized_target::reserve_global_got_entry): New function.
4290         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4291         (Target_x86_64::reserve_global_got_entry): New function.
4292         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4293
4294 2011-05-23 Cary Coutant  <ccoutant@google.com>
4295
4296         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4297         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4298         bit when checking got_type.
4299         * incremental.cc (Sized_incremental_binary::setup_readers):
4300         Store symbol table and string table locations; initialize bit vector
4301         of file status flags.
4302         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4303         unchanged files.
4304         (Sized_incremental_binary::do_process_got_plt): New function.
4305         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4306         (Output_section_incremental_inputs::set_final_data_size): Record
4307         file index for each input file.
4308         (Output_section_incremental_inputs::write_got_plt): Store file index
4309         instead of input entry offset for each GOT entry.
4310         * incremental.h
4311         (Incremental_input_entry::Incremental_input_entry): Initialize new
4312         data member.
4313         (Incremental_input_entry::set_offset): Store file index.
4314         (Incremental_input_entry::get_file_index): New function.
4315         (Incremental_input_entry::file_index_): New data member.
4316         (Incremental_binary::process_got_plt): New function.
4317         (Incremental_binary::do_process_got_plt): New function.
4318         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4319         data members.
4320         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4321         (Sized_incremental_binary::set_file_is_unchanged): New function.
4322         (Sized_incremental_binary::file_is_unchanged): New function.
4323         (Sized_incremental_binary::do_process_got_plt): New function.
4324         (Sized_incremental_binary::file_status_): New data member.
4325         (Sized_incremental_binary::main_symtab_loc_): New data member.
4326         (Sized_incremental_binary::main_strtab_loc_): New data member.
4327         * output.cc (Output_data_got::Got_entry::write): Add case
4328         RESERVED_CODE.
4329         (Output_data_got::add_global): Call add_got_entry.
4330         (Output_data_got::add_global_plt): Likewise.
4331         (Output_data_got::add_global_with_rel): Likewise.
4332         (Output_data_got::add_global_with_rela): Likewise.
4333         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4334         (Output_data_got::add_global_pair_with_rela): Likewise.
4335         (Output_data_got::add_local): Call add_got_entry.
4336         (Output_data_got::add_local_plt): Likewise.
4337         (Output_data_got::add_local_with_rel): Likewise.
4338         (Output_data_got::add_local_with_rela): Likewise.
4339         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4340         (Output_data_got::add_local_pair_with_rela): Likewise.
4341         (Output_data_got::reserve_slot): New function.
4342         (Output_data_got::reserve_slot_for_global): New function.
4343         (Output_data_got::add_got_entry): New function.
4344         (Output_data_got::add_got_entry_pair): New function.
4345         (Output_section::add_output_section_data): Edit FIXME.
4346         * output.h
4347         (Output_section_data_build::Output_section_data_build): New
4348         constructor with size parameter.
4349         (Output_data_space::Output_data_space): Likewise.
4350         (Output_data_got::Output_data_got): Initialize new data member; new
4351         constructor with size parameter.
4352         (Output_data_got::add_constant): Call add_got_entry.
4353         (Output_data_got::reserve_slot): New function.
4354         (Output_data_got::reserve_slot_for_global): New function.
4355         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4356         (Output_data_got::add_got_entry): New function.
4357         (Output_data_got::add_got_entry_pair): New function.
4358         (Output_data_got::free_list_): New data member.
4359         * target.h (Sized_target::init_got_plt_for_update): New function.
4360         (Sized_target::register_global_plt_entry): New function.
4361         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4362         Initialize new data member; call init; add constructor with PLT count.
4363         (Output_data_plt_x86_64::init): New function.
4364         (Output_data_plt_x86_64::add_relocation): New function.
4365         (Output_data_plt_x86_64::reserve_slot): New function.
4366         (Output_data_plt_x86_64::free_list_): New data member.
4367         (Target_x86_64::init_got_plt_for_update): New function.
4368         (Target_x86_64::register_global_plt_entry): New function.
4369         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4370         incremental updates.
4371         (Output_data_plt_x86_64::add_relocation): New function.
4372         * testsuite/object_unittest.cc (Object_test): Set default options.
4373
4374 2011-05-16  Ian Lance Taylor  <iant@google.com>
4375
4376         * options.h (class General_options): Make -i a synonym for -r.
4377
4378 2011-05-16  Ian Lance Taylor  <iant@google.com>
4379
4380         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4381
4382 2011-05-10 Cary Coutant  <ccoutant@google.com>
4383
4384         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4385         strip_all (-s).
4386
4387 2011-05-06  Ian Lance Taylor  <iant@google.com>
4388
4389         * layout.cc (Layout::layout): If the output section flags change,
4390         update the ordering.
4391
4392 2011-04-25 Cary Coutant  <ccoutant@google.com>
4393
4394         * incremental-dump.cc (dump_incremental_inputs): Print local
4395         symbol info for each input file.
4396         * incremental.cc
4397         (Output_section_incremental_inputs::set_final_data_size): Add local
4398         symbol info to input file entries in incremental info.
4399         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4400         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4401         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4402         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4403         implementation.
4404         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4405         (Sized_incr_relobj::do_relocate): Write the local symbols.
4406         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4407         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4408         Adjust size of input file header.
4409         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4410         (Incremental_inputs_reader::get_local_symbol_count): New function.
4411         (Incremental_inputs_reader::get_input_section): Adjust size of input
4412         file header.
4413         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4414         (Sized_incr_relobj::This): New typedef.
4415         (Sized_incr_relobj::sym_size): New const data member.
4416         (Sized_incr_relobj::Local_symbol): New struct.
4417         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4418         (Sized_incr_relobj::do_local_symbol_offset): New function.
4419         (Sized_incr_relobj::local_symbol_count_): New data member.
4420         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4421         (Sized_incr_relobj::local_symbol_index_): New data member.
4422         (Sized_incr_relobj::local_symbol_offset_): New data member.
4423         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4424         (Sized_incr_relobj::local_symbols_): New data member.
4425         * object.h (Relobj::output_local_symbol_count): New function.
4426         (Relobj::local_symbol_offset): New function.
4427         (Relobj::do_output_local_symbol_count): New function.
4428         (Relobj::do_local_symbol_offset): New function.
4429         (Sized_relobj::do_output_local_symbol_count): New function.
4430         (Sized_relobj::do_local_symbol_offset): New function.
4431
4432 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4433
4434         * descriptors.cc (set_close_on_exec): New function.
4435         (Descriptors::open): Use set_close_on_exec.
4436         * output.cc (S_ISLNK): Define if not defined.
4437
4438 2011-04-22 Cary Coutant  <ccoutant@google.com>
4439
4440         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4441         global symbol map.
4442         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4443         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4444         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4445         relocations.
4446         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4447         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4448         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4449         * incremental.h
4450         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4451         function.
4452         (Incremental_binary::apply_incremental_relocs): New function.
4453         (Incremental_binary::do_apply_incremental_relocs): New function.
4454         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4455         data member.
4456         (Sized_incremental_binary::add_global_symbol): New function.
4457         (Sized_incremental_binary::global_symbol): New function.
4458         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4459         (Sized_incremental_binary::symbol_map_): New data member.
4460         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4461         * target.h (Sized_target::apply_relocation): New function.
4462         * target-reloc.h (apply_relocation): New function.
4463         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4464
4465 2011-04-22  Doug Kwan  <dougkwan@google.com>
4466
4467         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4468         flag of a SHT_ARM_EXIDX section.
4469         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4470         * testsuite/Makefile.in: Regenerate.
4471         * testsuite/arm_exidx_test.s: New file.
4472         * testsuite/arm_exidx_test.sh: Same.
4473
4474 2011-04-20 Cary Coutant  <ccoutant@google.com>
4475
4476         PR gold/12689
4477         * archive.h (Incremental_archive_entry::Archive_member):
4478         Initialize arg_serial_ (second constructor).
4479
4480 2011-04-17  Ian Lance Taylor  <iant@google.com>
4481
4482         * object.cc (Relocate_info::location): Simplify location string.
4483         * errors.cc (Errors::error_at_location): Don't print program
4484         name.
4485         (Errors::warning_at_location): Likewise.
4486         (Errors::undefined_symbol): Likewise.
4487         * testsuite/debug_msg.sh: Update accordingly.
4488
4489 2011-04-14 Cary Coutant  <ccoutant@google.com>
4490
4491         * gold/layout.cc (Layout::symtab_section_offset): New function.
4492         * gold/layout.h (Layout::symtab_section_offset): New function.
4493         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4494
4495 2011-04-12  Ian Lance Taylor  <iant@google.com>
4496
4497         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4498         with MREMAP_MAYMOVE.
4499         * output.h (class Output_file): Add map_is_allocated_ field.
4500         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4501         not available, provide stubs.  If mremap is not available, #define
4502         it to gold_mremap.
4503         (MREMAP_MAYMOVE): Define if not defined.
4504         (Output_file::Output_file): Initialize map_is_allocated_.
4505         (Output_file::resize): Check map_is_allocated_.
4506         (Output_file::map_anonymous): If mmap fails, use malloc.
4507         (Output_file::unmap): Don't do anything for an anonymous map.
4508         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4509         is not available, provide stubs.
4510         (File_read::View::~View): Use free rather than delete[].
4511         (File_read::make_view): Use malloc rather than new[].  If mmap
4512         fails, use malloc.
4513         (File_read::find_or_make_view): Use malloc rather than new[].
4514         * gold.h: Remove HAVE_REMAP code.
4515         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4516         exists.  Rename mremap to gold_mremap.  If mmap is not available
4517         don't do anything.
4518         * configure, config.in: Rebuild.
4519
4520 2011-04-11  Ian Lance Taylor  <iant@google.com>
4521
4522         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4523         initialize local variable v.
4524
4525 2011-04-11  Cary Coutant  <ccoutant@google.com>
4526
4527         * archive.cc (Archive::include_member): Adjust call to
4528         report_object.
4529         (Add_archive_symbols::run): Track argument serial numbers.
4530         (Lib_group::include_member): Likewise.
4531         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4532         * archive.h (Incremental_archive_entry::Archive_member):
4533         Initialize arg_serial_.
4534         (Archive_member::arg_serial_): New data member.
4535         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4536         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4537         incremental link.
4538         (Sized_dynobj::do_for_all_local_got_entries): New function.
4539         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4540         function.
4541         * fileread.cc (get_mtime): New function.
4542         * fileread.h (get_mtime): New function.
4543         * gold.cc (queue_initial_tasks): Check for incremental update.
4544         (process_incremental_input): New function.
4545         (queue_middle_tasks): Don't force valid target for incremental
4546         update.
4547         * incremental-dump.cc (find_input_containing_global): Adjust
4548         size of symbol info entry.
4549         (dump_incremental_inputs): Dump argument serial number and
4550         in_system_directory flag; bias shndx by 1; print symbol names
4551         when dumping per-file symbol lists; use new symbol info readers.
4552         * incremental.cc
4553         (Output_section_incremental_inputs:update_data_size): New function.
4554         (Sized_incremental_binary::setup_readers): Setup input readers
4555         for each input file; build maps for files added from libraries
4556         and scripts.
4557         (Sized_incremental_binary::check_input_args): New function.
4558         (Sized_incremental_binary::do_check_inputs): Build map of argument
4559         serial numbers to input arguments.
4560         (Sized_incremental_binary::do_file_has_changed): Rename
4561         do_file_is_unchanged to this; compare file modification times.
4562         (Sized_incremental_binary::do_init_layout): New function.
4563         (Sized_incremental_binary::do_reserve_layout): New function.
4564         (Sized_incremental_binary::do_get_input_reader): Remove.
4565         (Sized_incremental_binary::get_symtab_view): New function.
4566         (Incremental_checker::can_incrementally_link_output_file): Remove.
4567         (Incremental_inputs::report_command_line): Exclude --debug options.
4568         (Incremental_inputs::report_archive_begin): Add parameter; track
4569         argument serial numbers; don't put input file entry for archive
4570         before archive members.
4571         (Incremental_inputs::report_archive_end): Put input file entry
4572         for archive after archive members.
4573         (Incremental_inputs::report_object): Add parameter; track argument
4574         serial numbers and in_system_directory flag.
4575         (Incremental_inputs::report_script): Add parameter; track argument
4576         serial numbers.
4577         (Output_section_incremental_inputs::set_final_data_size): Adjust
4578         size of symbol info entry; check for forwarding symbols.
4579         (Output_section_incremental_inputs::write_input_files): Write
4580         in_system_directory flag and argument serial number.
4581         (Output_section_incremental_inputs::write_info_blocks): Map section
4582         indices between incremental info and original input file; store
4583         input section index for each symbol.
4584         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4585         change operator() to visit().
4586         (class Global_got_offset_visitor): Likewise.
4587         (class Global_symbol_visitor_got_plt):
4588         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4589         classes.
4590         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4591         (Sized_incr_relobj::do_read_symbols): New function.
4592         (Sized_incr_relobj::do_layout): New function.
4593         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4594         (Sized_incr_relobj::do_add_symbols): New function.
4595         (Sized_incr_relobj::do_should_include_member): New function.
4596         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4597         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4598         (Sized_incr_relobj::do_section_size): New function.
4599         (Sized_incr_relobj::do_section_name): New function.
4600         (Sized_incr_relobj::do_section_contents): New function.
4601         (Sized_incr_relobj::do_section_flags): New function.
4602         (Sized_incr_relobj::do_section_entsize): New function.
4603         (Sized_incr_relobj::do_section_address): New function.
4604         (Sized_incr_relobj::do_section_type): New function.
4605         (Sized_incr_relobj::do_section_link): New function.
4606         (Sized_incr_relobj::do_section_info): New function.
4607         (Sized_incr_relobj::do_section_addralign): New function.
4608         (Sized_incr_relobj::do_initialize_xindex): New function.
4609         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4610         (Sized_incr_relobj::do_read_relocs): New function.
4611         (Sized_incr_relobj::do_gc_process_relocs): New function.
4612         (Sized_incr_relobj::do_scan_relocs): New function.
4613         (Sized_incr_relobj::do_count_local_symbols): New function.
4614         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4615         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4616         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4617         (Sized_incr_relobj::do_relocate): New function.
4618         (Sized_incr_relobj::do_set_section_offset): New function.
4619         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4620         (Sized_incr_dynobj::do_read_symbols): New function.
4621         (Sized_incr_dynobj::do_layout): New function.
4622         (Sized_incr_dynobj::do_add_symbols): New function.
4623         (Sized_incr_dynobj::do_should_include_member): New function.
4624         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4625         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4626         (Sized_incr_dynobj::do_section_size): New function.
4627         (Sized_incr_dynobj::do_section_name): New function.
4628         (Sized_incr_dynobj::do_section_contents): New function.
4629         (Sized_incr_dynobj::do_section_flags): New function.
4630         (Sized_incr_dynobj::do_section_entsize): New function.
4631         (Sized_incr_dynobj::do_section_address): New function.
4632         (Sized_incr_dynobj::do_section_type): New function.
4633         (Sized_incr_dynobj::do_section_link): New function.
4634         (Sized_incr_dynobj::do_section_info): New function.
4635         (Sized_incr_dynobj::do_section_addralign): New function.
4636         (Sized_incr_dynobj::do_initialize_xindex): New function.
4637         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4638         (make_sized_incremental_object): New function.
4639         (Incremental_library::copy_unused_symbols): New function.
4640         (Incremental_library::do_for_all_unused_symbols): New function.
4641         * incremental.h (enum Incremental_input_flags): New type.
4642         (class Incremental_checker): Remove.
4643         (Incremental_input_entry::Incremental_input_entry): Add argument
4644         serial number.
4645         (Incremental_input_entry::arg_serial): New function.
4646         (Incremental_input_entry::set_is_in_system_directory): New function.
4647         (Incremental_input_entry::is_in_system_directory): New function.
4648         (Incremental_input_entry::arg_serial_): New data member.
4649         (Incremental_input_entry::is_in_system_directory_): New data member.
4650         (class Script_info): Move here from script.h.
4651         (Script_info::Script_info): Add filename parameter.
4652         (Script_info::filename): New function.
4653         (Script_info::filename_): New data member.
4654         (Incremental_script_entry::Incremental_script_entry): Add argument
4655         serial number.
4656         (Incremental_object_entry::Incremental_object_entry): Likewise.
4657         (Incremental_object_entry::add_input_section): Build list of input
4658         sections with map to original shndx.
4659         (Incremental_object_entry::get_input_section_index): New function.
4660         (Incremental_object_entry::shndx_): New data member.
4661         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4662         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4663         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4664         serial number.
4665         (Incremental_inputs::report_archive_begin): Likewise.
4666         (Incremental_inputs::report_object): Likewise.
4667         (Incremental_inputs::report_script): Likewise.
4668         (class Incremental_global_symbol_reader): New class.
4669         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4670         and store flags and input file type.
4671         (Incremental_input_entry_reader::arg_serial): New function.
4672         (Incremental_input_entry_reader::type): Extract type from flags.
4673         (Incremental_input_entry_reader::is_in_system_directory): New function.
4674         (Incremental_input_entry_reader::get_input_section_count): Call
4675         accessor function for type.
4676         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4677         function for type; adjust size of global symbol entry.
4678         (Incremental_input_entry_reader::get_global_symbol_count): Call
4679         accessor function for type.
4680         (Incremental_input_entry_reader::get_object_count): Likewise.
4681         (Incremental_input_entry_reader::get_object_offset): Likewise.
4682         (Incremental_input_entry_reader::get_member_count): Likewise.
4683         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4684         (Incremental_input_entry_reader::get_member_offset): Likewise.
4685         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4686         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4687         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4688         (Incremental_input_entry_reader::get_global_symbol_reader): New
4689         function.
4690         (Incremental_input_entry_reader::get_output_symbol_index): New
4691         function.
4692         (Incremental_input_entry_reader::type_): Remove.
4693         (Incremental_input_entry_reader::flags_): New data member.
4694         (Incremental_inputs_reader::input_file_offset): New function.
4695         (Incremental_inputs_reader::input_file_index): New function.
4696         (Incremental_inputs_reader::input_file): Call input_file_offset.
4697         (Incremental_inputs_reader::input_file_at_offset): New function.
4698         (Incremental_relocs_reader::get_r_type): Reformat.
4699         (Incremental_relocs_reader::get_r_shndx): Reformat.
4700         (Incremental_relocs_reader::get_r_offset): Reformat.
4701         (Incremental_relocs_reader::data): New function.
4702         (Incremental_binary::Incremental_binary): Initialize new data members.
4703         (Incremental_binary::check_inputs): Add cmdline parameter.
4704         (Incremental_binary::file_is_unchanged): Remove.
4705         (Input_reader::arg_serial): New function.
4706         (Input_reader::get_unused_symbol_count): New function.
4707         (Input_reader::get_unused_symbol): New function.
4708         (Input_reader::do_arg_serial): New function.
4709         (Input_reader::do_get_unused_symbol_count): New function.
4710         (Input_reader::do_get_unused_symbol): New function.
4711         (Incremental_binary::input_file_count): New function.
4712         (Incremental_binary::get_input_reader): Change signature to use
4713         index instead of filename.
4714         (Incremental_binary::file_has_changed): New function.
4715         (Incremental_binary::get_input_argument): New function.
4716         (Incremental_binary::get_library): New function.
4717         (Incremental_binary::get_script_info): New function.
4718         (Incremental_binary::init_layout): New function.
4719         (Incremental_binary::reserve_layout): New function.
4720         (Incremental_binary::output_file): New function.
4721         (Incremental_binary::do_check_inputs): New function.
4722         (Incremental_binary::do_file_is_unchanged): Remove.
4723         (Incremental_binary::do_file_has_changed): New function.
4724         (Incremental_binary::do_init_layout): New function.
4725         (Incremental_binary::do_reserve_layout): New function.
4726         (Incremental_binary::do_input_file_count): New function.
4727         (Incremental_binary::do_get_input_reader): Change signature.
4728         (Incremental_binary::input_args_map_): New data member.
4729         (Incremental_binary::library_map_): New data member.
4730         (Incremental_binary::script_map_): New data member.
4731         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4732         new data members.
4733         (Sized_incremental_binary::output_section): New function.
4734         (Sized_incremental_binary::inputs_reader): Add const.
4735         (Sized_incremental_binary::symtab_reader): Add const.
4736         (Sized_incremental_binary::relocs_reader): Add const.
4737         (Sized_incremental_binary::got_plt_reader): Add const.
4738         (Sized_incremental_binary::get_symtab_view): New function.
4739         (Sized_incremental_binary::Inputs_reader): New typedef.
4740         (Sized_incremental_binary::Input_entry_reader): New typedef.
4741         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4742         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4743         (Sized_incremental_binary::do_file_has_changed): New function.
4744         (Sized_incremental_binary::do_init_layout): New function.
4745         (Sized_incremental_binary::do_reserve_layout): New function.
4746         (Sized_input_reader::Inputs_reader): Remove.
4747         (Sized_input_reader::Input_entry_reader): Remove.
4748         (Sized_input_reader::do_arg_serial): New function.
4749         (Sized_input_reader::do_get_unused_symbol_count): New function.
4750         (Sized_input_reader::do_get_unused_symbol): New function.
4751         (Sized_incremental_binary::do_input_file_count): New function.
4752         (Sized_incremental_binary::do_get_input_reader): Change signature;
4753         use index instead of filename.
4754         (Sized_incremental_binary::section_map_): New data member.
4755         (Sized_incremental_binary::input_entry_readers_): New data member.
4756         (class Sized_incr_relobj): New class.
4757         (class Sized_incr_dynobj): New class.
4758         (make_sized_incremental_object): New function.
4759         (class Incremental_library): New class.
4760         * layout.cc (Free_list::num_lists): New static data member.
4761         (Free_list::num_nodes): New static data member.
4762         (Free_list::num_removes): New static data member.
4763         (Free_list::num_remove_visits): New static data member.
4764         (Free_list::num_allocates): New static data member.
4765         (Free_list::num_allocate_visits): New static data member.
4766         (Free_list::init): New function.
4767         (Free_list::remove): New function.
4768         (Free_list::allocate): New function.
4769         (Free_list::dump): New function.
4770         (Free_list::print_stats): New function.
4771         (Layout_task_runner::run): Resize output file for incremental updates.
4772         (Layout::Layout): Initialize new data members.
4773         (Layout::set_incremental_base): New function.
4774         (Layout::init_fixed_output_section): New function.
4775         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4776         incremental updates.
4777         (Layout::create_gold_note): Do not create gold note section for
4778         incremental updates.
4779         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4780         for incremental updates.
4781         (Layout::set_section_offsets): For incremental updates, allocate space
4782         from free list.
4783         (Layout::create_symtab_sections): Layout with offsets relative to
4784         start of section; for incremental updates, allocate space from free
4785         list.
4786         (Layout::create_shdrs): For incremental updates, allocate space from
4787         free list.
4788         (Layout::finish_dynamic_section): For incremental updates, do not
4789         check --as-needed (fixed in subsequent patch).
4790         * layout.h (class Free_list): New class.
4791         (Layout::set_incremental_base): New function.
4792         (Layout::incremental_base): New function.
4793         (Layout::init_fixed_output_section): New function.
4794         (Layout::allocate): New function.
4795         (Layout::incremental_base_): New data member.
4796         (Layout::free_list_): New data member.
4797         * main.cc (main): Print Free_list statistics.
4798         * object.cc (Relobj::finalize_incremental_relocs): Add
4799         clear_counts parameter; clear counts only when clear_counts is set.
4800         (Sized_relobj::Sized_relobj): Initialize new base class.
4801         (Sized_relobj::do_layout): Don't report special sections.
4802         (Sized_relobj::do_for_all_local_got_entries): New function.
4803         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4804         symtab_off to all symbol table offsets.
4805         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4806         * object.h (class Got_offset_list): Move to top of file.
4807         (Object::Object): Allow case where input_file == NULL.
4808         (Object::~Object): Likewise.
4809         (Object::input_file): Assert that input_file != NULL.
4810         (Object::lock): Allow case where input_file == NULL.
4811         (Object::unlock): Likewise.
4812         (Object::is_locked): Likewise.
4813         (Object::token): Likewise.
4814         (Object::release): Likewise.
4815         (Object::is_incremental): New function.
4816         (Object::get_mtime): New function.
4817         (Object::for_all_local_got_entries): New function.
4818         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4819         (Object::set_is_in_system_directory): New function.
4820         (Object::is_in_system_directory): New function.
4821         (Object::do_is_incremental): New function.
4822         (Object::do_get_mtime): New function.
4823         (Object::do_for_all_local_got_entries): New function.
4824         (Object::is_in_system_directory_): New data member.
4825         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4826         (class Sized_relobj_base): New class.
4827         (class Sized_relobj): Derive from Sized_relobj_base.
4828         (class Sized_relobj::Symbols): Redeclare from base class.
4829         (class Sized_relobj::local_got_offset_list): Remove.
4830         (class Sized_relobj::Output_sections): Redeclare from base class.
4831         (class Sized_relobj::do_for_all_local_got_entries): New function.
4832         (class Sized_relobj::write_local_symbols): Add offset parameter.
4833         (class Sized_relobj::local_symbol_offset_): Update comment.
4834         (class Sized_relobj::local_dynsym_offset_): Update comment.
4835         * options.cc (Input_arguments::add_file): Remove const.
4836         * options.h (Input_file_argument::Input_file_argument):
4837         Initialize arg_serial_ (all constructors).
4838         (Input_file_argument::set_arg_serial): New function.
4839         (Input_file_argument::arg_serial): New function.
4840         (Input_file_argument::arg_serial_): New data member.
4841         (Input_arguments::Input_arguments): Initialize file_count_.
4842         (Input_arguments::add_file): Remove const.
4843         (Input_arguments::number_of_input_files): New function.
4844         (Input_arguments::file_count_): New data member.
4845         (Command_line::number_of_input_files): Call
4846         Input_arguments::number_of_input_files.
4847         * output.cc (Output_segment_headers::Output_segment_headers):
4848         Set current size.
4849         (Output_section::Input_section::current_data_size): New function.
4850         (Output_section::Output_section): Initialize new data members.
4851         (Output_section::add_input_section): Don't do merge sections for
4852         an incremental link; allocate space from free list for an
4853         incremental update.
4854         (Output_section::add_output_section_data): Allocate space from
4855         free list for an incremental update.
4856         (Output_section::update_data_size): New function.
4857         (Output_section::set_fixed_layout): New function.
4858         (Output_section::reserve): New function.
4859         (Output_segment::set_section_addresses): Remove const.
4860         (Output_segment::set_section_list_addresses): Remove const; allocate
4861         space from free list for an incremental update.
4862         (Output_segment::set_offset): Adjust size of RELRO segment for an
4863         incremental update.
4864         * output.h (Output_data::current_data_size): Move here from
4865         child classes.
4866         (Output_data::pre_finalize_data_size): New function.
4867         (Output_data::update_data_size): New function.
4868         (Output_section_headers::update_data_size): new function.
4869         (Output_section_data_build::current_data_size): Move to Output_data.
4870         (Output_data_strtab::update_data_size): New function.
4871         (Output_section::current_data_size): Move to Output_data.
4872         (Output_section::set_fixed_layout): New function.
4873         (Output_section::has_fixed_layout): New function.
4874         (Output_section::reserve): New function.
4875         (Output_section::update_data_size): New function.
4876         (Output_section::has_fixed_layout_): New data member.
4877         (Output_section::free_list_): New data member.
4878         (Output_segment::set_section_addresses): Remove const.
4879         (Output_segment::set_section_list_addresses): Remove const.
4880         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4881         New function.
4882         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4883         New function.
4884         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4885         parameter when calling Add_symbols constructor; store argument
4886         serial number for members of a lib group.
4887         (Add_symbols::locks): Allow case where token == NULL.
4888         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4889         (Read_member::~Read_member): New function.
4890         (Read_member::is_runnable): New function.
4891         (Read_member::locks): New function.
4892         (Read_member::run): New function.
4893         (Check_script::~Check_script): New function.
4894         (Check_script::is_runnable): New function.
4895         (Check_script::locks): New function.
4896         (Check_script::run): New function.
4897         (Check_library::~Check_library): New function.
4898         (Check_library::is_runnable): New function.
4899         (Check_library::locks): New function.
4900         (Check_library::run): New function.
4901         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4902         (Add_symbols::library_): New data member.
4903         (class Read_member): New class.
4904         (class Check_script): New class.
4905         (class Check_library): New class.
4906         * reloc.cc (Read_relocs::is_runnable): Allow case where
4907         token == NULL.
4908         (Read_relocs::locks): Likewise.
4909         (Scan_relocs::locks): Likewise.
4910         (Relocate_task::locks): Likewise.
4911         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4912         to clear counters.
4913         (Sized_relobj::incremental_relocs_scan): Fix comment.
4914         (Sized_relobj::do_relocate): Pass output file offset to
4915         write_local_symbols.
4916         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4917         from class declaration.
4918         * script.cc (read_input_script): Allocate Script_info; pass
4919         argument serial number to report_script.
4920         * script.h (class Script_info): Move to incremental.h.
4921         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4922         * symtab.h (Symbol_table::add_from_incrobj): New function.
4923         (Symbol_table::set_file_offset): New function.
4924
4925 2011-04-05  Cary Coutant  <ccoutant@google.com>
4926
4927         * incremental-dump.cc (dump_incremental_inputs): Change signature
4928         to take a Sized_incremental_binary; change caller.  Use readers
4929         in Sized_incremental_binary.
4930         * incremental.cc
4931         (Sized_incremental_binary::find_incremental_inputs_sections):
4932         Rename do_find_incremental_inputs_sections to this.
4933         (Sized_incremental_binary::setup_readers): New function.
4934         (Sized_incremental_binary::do_check_inputs): Check
4935         has_incremental_info_ flag; move setup code to setup_readers;
4936         use input readers.
4937         (Sized_incremental_binary::do_file_is_unchanged): New function.
4938         (Sized_incremental_binary::do_get_input_reader): New function.
4939         * incremental.h (class Incremental_binary): Move to end of file.
4940         (Incremental_binary::file_is_unchanged): New function.
4941         (Incremental_binary::do_file_is_unchanged): New function.
4942         (Incremental_binary::Input_reader): New class.
4943         (Incremental_binary::get_input_reader): New function.
4944         (class Sized_incremental_binary): Move to end of file.
4945         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4946         input section reader classes.
4947         (Sized_incremental_binary::has_incremental_info): New function.
4948         (Sized_incremental_binary::inputs_reader): New function.
4949         (Sized_incremental_binary::symtab_reader): New function.
4950         (Sized_incremental_binary::relocs_reader): New function.
4951         (Sized_incremental_binary::got_plt_reader): New function.
4952         (Sized_incremental_binary::do_file_is_unchanged): New function.
4953         (Sized_incremental_binary::Sized_input_reader): New class.
4954         (Sized_incremental_binary::get_input_reader): New function.
4955         (Sized_incremental_binary::find_incremental_inputs_sections):
4956         Rename do_find_incremental_inputs_sections to this.
4957         (Sized_incremental_binary::setup_readers): New function.
4958         (Sized_incremental_binary::has_incremental_info_): New data member.
4959         (Sized_incremental_binary::inputs_reader_): New data member.
4960         (Sized_incremental_binary::symtab_reader_): New data member.
4961         (Sized_incremental_binary::relocs_reader_): New data member.
4962         (Sized_incremental_binary::got_plt_reader_): New data member.
4963         (Sized_incremental_binary::current_input_file_): New data member.
4964
4965 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4966
4967         PR gold/12640
4968         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4969         violation.
4970
4971 2011-03-30  Cary Coutant  <ccoutant@google.com>
4972
4973         * archive.cc (Archive::include_member): Adjust call to report_object.
4974         (Add_archive_symbols::run): Add script_info to call to
4975         report_archive_begin.
4976         (Lib_group::include_member): Adjust call to report_object.
4977         (Add_lib_group_symbols::run): Adjust call to report_object.
4978         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4979         blocks.  Add object count for script input files.
4980         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4981         script_info parameter; change all callers.
4982         (Incremental_inputs::report_object): Add script_info parameter;
4983         change all callers.
4984         (Incremental_inputs::report_script): Store backpointer to
4985         incremental info entry.
4986         (Output_section_incremental_inputs::set_final_data_size): Record
4987         additional information for scripts.
4988         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4989         * incremental.h (Incremental_script_entry::add_object): New function.
4990         (Incremental_script_entry::get_object_count): New function.
4991         (Incremental_script_entry::get_object): New function.
4992         (Incremental_script_entry::objects_): New data member; adjust
4993         constructor.
4994         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4995         (Incremental_inputs::report_object): Add script_info parameter.
4996         (Incremental_inputs_reader::get_object_count): New function.
4997         (Incremental_inputs_reader::get_object_offset): New function.
4998         * options.cc (Input_arguments::add_file): Return reference to
4999         new input argument.
5000         * options.h (Input_argument::set_script_info): New function.
5001         (Input_argument::script_info): New function.
5002         (Input_argument::script_info_): New data member; adjust all
5003         constructors.
5004         (Input_file_group::add_file): Return reference to new input argument.
5005         (Input_file_lib::add_file): Likewise.
5006         (Input_arguments::add_file): Likewise.
5007         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5008         * script.cc (Parser_closure::Parser_closure): Add script_info
5009         parameter; adjust all callers.
5010         (Parser_closure::script_info): New function.
5011         (Parser_closure::script_info_): New data member.
5012         (read_input_script): Report scripts earlier to incremental info.
5013         (script_add_file): Set script_info in Input_argument.
5014         (script_add_library): Likewise.
5015         * script.h (Script_options::Script_info): Rewrite class.
5016
5017 2011-03-29  Cary Coutant  <ccoutant@google.com>
5018
5019         * archive.cc (Library_base::should_include_member): Move
5020         method here from class Archive.
5021         (Archive::Archive): Initialize base class.
5022         (Archive::should_include_member): Move to base class.
5023         (Archive::do_for_all_unused_symbols): New function.
5024         (Add_archive_symbols::run): Remove redundant access to
5025         incremental_inputs.
5026         (Lib_group::Lib_group): Initialize base class.
5027         (Lib_group::do_filename): New function.
5028         (Lib_group::include_member): Pass pointer to Lib_group to
5029         report_object.
5030         (Lib_group::do_for_all_unused_symbols): New function.
5031         (Add_lib_group_symbols::run): Report archive information for
5032         incremental links.
5033         * archive.h (class Library_base): New base class.
5034         (class Archive): Derive from Library_base.
5035         (Archive::filename): Move to base class.
5036         (Archive::set_incremental_info): Likewise.
5037         (Archive::incremental_info): Likewise.
5038         (Archive::Should_include): Likewise.
5039         (Archive::should_include_member): Likewise.
5040         (Archive::Armap_entry): Remove.
5041         (Archive::Unused_symbol_iterator): Remove.
5042         (Archive::unused_symbols_begin): Remove.
5043         (Archive::unused_symbols_end): Remove.
5044         (Archive::do_filename): New function.
5045         (Archive::do_get_mtime): New function.
5046         (Archive::do_for_all_unused_symbols): New function.
5047         (Archive::task_): Move to base class.
5048         (Archive::incremental_info_): Likewise.
5049         (class Lib_group): Derive from Library_base.
5050         (Lib_group::do_filename): New function.
5051         (Lib_group::do_get_mtime): New function.
5052         (Lib_group::do_for_all_unused_symbols): New function.
5053         (Lib_group::task_): Move to base class.
5054         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5055         function.
5056         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5057         function.
5058         * incremental.cc (Incremental_inputs::report_archive_begin):
5059         Use Library_base; call library's get_mtime; add incremental inputs
5060         entry before members.
5061         (class Unused_symbol_visitor): New class.
5062         (Incremental_inputs::report_archive_end): Use Library_base; use
5063         visitor class to record unused symbols; don't add incremental inputs
5064         entry after members.
5065         (Incremental_inputs::report_object): Use Library_base.
5066         * incremental.h
5067         (Incremental_archive_entry::Incremental_archive_entry): Remove
5068         unused Archive parameter.
5069         (Incremental_inputs::report_archive_begin): Use Library_base.
5070         (Incremental_inputs::report_archive_end): Likewise.
5071         (Incremental_inputs::report_object): Likewise.
5072         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5073         function.
5074         * object.h (Object::for_all_global_symbols): New function.
5075         (Object::do_for_all_global_symbols): New function.
5076         (Sized_relobj::do_for_all_global_symbols): New function.
5077         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5078         function.
5079         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5080         function.
5081
5082 2011-03-27  Ian Lance Taylor  <iant@google.com>
5083
5084         * archive.cc (Archive::interpret_header): Return -1 if something
5085         goes wrong.  Change callers accordingly.
5086
5087 2011-03-25  Cary Coutant  <ccoutant@google.com>
5088
5089         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5090         * testsuite/Makefile.in: Regenerate.
5091
5092 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5093
5094         * plugin.cc (get_view): New.
5095         (Plugin::load): Pass get_view to the plugin.
5096         (Plugin_manager::get_view): New.
5097
5098 2011-03-21  Ian Lance Taylor  <iant@google.com>
5099
5100         * testsuite/final_layout.sh: Rewrite to not use dc.
5101         * testsuite/relro_test.sh: Fail if dc is not present.
5102
5103 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5104
5105         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5106         Change == to -eq.
5107         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5108         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5109         Change == to -eq.
5110         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5111         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5112
5113 2011-03-14  Ian Lance Taylor  <iant@google.com>
5114
5115         * script-sections.cc (Sort_output_sections::script_compare):
5116         Rename from is_before, change return type.
5117         (Sort_output_sections::operator()): Adjust accordingly.
5118
5119 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5120
5121         PR gold/12572
5122         * testsuite/odr_violation2.cc: Add comment to make all error line
5123         numbers double digits.
5124         * testsuite/debug_msg.sh: Adjust expected errors.
5125
5126 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5127
5128         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5129         but mark earlier ones as non-canonical
5130         (offset_to_iterator): Update search target and example
5131         (do_addr2line): Return extra lines in a vector*
5132         (format_file_lineno): Extract from do_addr2line
5133         (one_addr2line): Add vector* out-param
5134         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5135         when a lineno entry appeared last for its instruction
5136         (Dwarf_line_info): Add vector* out-param
5137         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5138         * symtab.cc (Odr_violation_compare): Include the lineno in the
5139         comparison again.
5140         (linenos_from_loc): New. Combine the canonical line for an
5141         address with its other lines.
5142         (True_if_intersect): New. Helper functor to make
5143         std::set_intersection a query.
5144         (detect_odr_violations): Compare sets of lines instead of just
5145         one line for each function. This became less deterministic, but
5146         has fewer false positives.
5147         * symtab.h: Declarations.
5148         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5149         mix an optimized and non-optimized object in the same binary
5150         (odr_violation2.so): Same.
5151         * testsuite/Makefile.in: Regenerate from Makefile.am.
5152         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5153         * testsuite/debug_msg.sh: Update line numbers and add
5154         assertions.
5155         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5156         non-optimized context.
5157         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5158         isn't inlined, and use OdrDerived in an optimized context.
5159         * testsuite/odr_header1.h: Defines OdrDerived, where
5160         optimization will change the
5161         first-instruction-in-the-destructor's file and line number.
5162         * testsuite/odr_header2.h: Defines OdrBase.
5163
5164 2011-03-09  Ian Lance Taylor  <iant@google.com>
5165
5166         * fileread.cc (File_read::clear_views): Don't delete the whole
5167         file view.
5168
5169 2011-03-08  Ian Lance Taylor  <iant@google.com>
5170
5171         PR gold/12525
5172         * fileread.cc: #include <climits>.
5173         (GOLD_IOV_MAX): Define.
5174         (File_read::read_multiple): Limit number of entries by iov_max.
5175         * fileread.h (class File_read): Always set max_readv_entries to
5176         128.
5177
5178 2011-03-07  Ian Lance Taylor  <iant@google.com>
5179
5180         PR gold/12525
5181         * options.h (class General_options): Add -dy and -dn.
5182
5183 2011-03-02  Cary Coutant  <ccoutant@google.com>
5184
5185         * testsuite/script_test_9.t: Add TLS segment.
5186
5187 2011-03-02  Simon Baldwin  <simonb@google.com>
5188
5189         * configure.ac: Add check for gnu_indirect_function support in
5190         the toolchain building binutils.
5191         * configure: Rebuild.
5192
5193 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5194
5195         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5196         plugin only symbols.
5197         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5198         in plugin files as not needed in the symbol table.
5199
5200 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5201
5202         * output.cc (Output_section::add_input_section): Delay fill
5203         generation for section ordering.
5204
5205 2011-02-09  Ian Lance Taylor  <iant@google.com>
5206
5207         PR gold/12316
5208         * object.h (class Sized_relobj): Remove clear_local_symbols.
5209         * reloc.cc (Sized_relobj::do_relocate): Don't call
5210         clear_local_symbols.
5211
5212 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5213
5214         * plugin.cc (is_visible_from_outside): Return true for symbols
5215         in the -u option.
5216
5217 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5218
5219         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5220         filename.
5221
5222 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5223
5224         * icf.h (is_section_foldable_candidate): Change type of parameter
5225         to std::string.
5226         * icf.cc (Icf::find_identical_sections): Change type of local variable
5227         section_name to be std::string.
5228         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5229
5230 2011-01-25  Ian Lance Taylor  <iant@google.com>
5231
5232         * script.cc (script_add_extern): Rewrite to use
5233         add_symbol_reference.
5234
5235 2011-01-25  Doug Kwan  <dougkwan@google.com>
5236
5237         * icf.cc (get_section_contents): Always lock section's object.
5238
5239 2011-01-24  Ian Lance Taylor  <iant@google.com>
5240
5241         * options.h (class General_options): Accept
5242         --no-detect-odr-violations.
5243
5244 2011-01-24  Ian Lance Taylor  <iant@google.com>
5245
5246         * version.cc (version_string): Bump to 1.11.
5247
5248 2011-01-24  Ian Lance Taylor  <iant@google.com>
5249
5250         * plugin.cc (class Plugin_rescan): Define new class.
5251         (Plugin_manager::claim_file): Set any_claimed_.
5252         (Plugin_manager::save_archive): New function.
5253         (Plugin_manager::save_input_group): New function.
5254         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5255         necessary.
5256         (Plugin_manager::new_undefined_symbol): New function.
5257         (Plugin_manager::rescan): New function.
5258         (Plugin_manager::rescannable_defines): New function.
5259         (Plugin_manager::add_input_file): Set any_added_.
5260         * plugin.h (class Plugin_manager): define new fields rescannable_,
5261         undefined_symbols_, any_claimed_, and any_added_.  Declare
5262         Plugin_rescan as friend.  Declare new functions.
5263         (Plugin_manager::Rescannable): Define type.
5264         (Plugin_manager::Rescannable_list): Define type.
5265         (Plugin_manager::Undefined_symbol_list): Define type.
5266         (Plugin_manager::Plugin_manager): Initialize new fields.
5267         * archive.cc (Archive::defines_symbol): New function.
5268         (Add_archive_symbols::run): Pass archive to plugins if any.
5269         * archive.h (class Archive): Declare defines_symbol.
5270         * readsyms.cc (Input_group::~Input_group): New function.
5271         (Finish_group::run): Pass input_group to plugins if any.
5272         * readsyms.h (class Input_group): Declare destructor.
5273         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5274         any.
5275
5276 2011-01-10  Ian Lance Taylor  <iant@google.com>
5277
5278         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5279         section as relro.
5280         (Layout::set_segment_offsets): Reset increase_relro before calling
5281         set_section_addresses a second time.
5282
5283 2011-01-04  Cary Coutant  <ccoutant@google.com>
5284
5285         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5286         sections before NOBITS sections.
5287
5288 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5289
5290         * version.cc (print_version): Update copyright to 2011.
5291
5292 2010-12-23  Cary Coutant  <ccoutant@google.com>
5293
5294         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5295         of OS to this->add.  Add OD parameter to second form of the function.
5296
5297 2010-12-20  Ian Lance Taylor  <iant@google.com>
5298
5299         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5300         second of two consecutive entries with same offset.
5301
5302 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5303
5304         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5305         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5306         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5307         to avoid unneeded links against $(LDADD).
5308         * testsuite/Makefile.in: Regenerate.
5309
5310 2010-12-15  Ian Lance Taylor  <iant@google.com>
5311
5312         PR gold/12324
5313         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5314         for R_X86_64_32 and R_X86_64_PC32.
5315         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5316         ver_matching_def_pic.o.
5317         (ver_matching_def_pic.o): New target.
5318
5319 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5320
5321         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5322         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5323         Move definition before File_read::View member definitions.
5324         (File_read::View::~View): Initialize and hold lock before
5325         updating current_mapped_bytes.
5326
5327 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5328
5329         * dwarf_reader.cc: Remove outdated comment.
5330         * gold-threads.cc: Fix typo in error message.
5331         * archive.cc: Fix typos in comments.
5332         * archive.h: Likewise.
5333         * arm-reloc-property.cc: Likewise.
5334         * arm-reloc-property.h: Likewise.
5335         * arm-reloc.def: Likewise.
5336         * arm.cc: Likewise.
5337         * attributes.h: Likewise.
5338         * cref.cc: Likewise.
5339         * ehframe.cc: Likewise.
5340         * fileread.h: Likewise.
5341         * gold.h: Likewise.
5342         * i386.cc: Likewise.
5343         * icf.cc: Likewise.
5344         * incremental.h: Likewise.
5345         * int_encoding.cc: Likewise.
5346         * layout.h: Likewise.
5347         * main.cc: Likewise.
5348         * merge.h: Likewise.
5349         * object.cc: Likewise.
5350         * object.h: Likewise.
5351         * options.cc: Likewise.
5352         * readsyms.cc: Likewise.
5353         * reduced_debug_output.cc: Likewise.
5354         * reloc.cc: Likewise.
5355         * script-sections.cc: Likewise.
5356         * sparc.cc: Likewise.
5357         * symtab.h: Likewise.
5358         * target-reloc.h: Likewise.
5359         * target.cc: Likewise.
5360         * target.h: Likewise.
5361         * timer.cc: Likewise.
5362         * timer.h: Likewise.
5363         * x86_64.cc: Likewise.
5364
5365 2010-12-09  Cary Coutant  <ccoutant@google.com>
5366
5367         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5368         stack.
5369         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5370         parameter; change all callers.
5371         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5372         * options.h (warn_execstack): New option.
5373
5374 2010-12-07  Doug Kwan  <dougkwan@google.com>
5375
5376         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5377         like function call relocations.
5378
5379 2010-12-07  Ian Lance Taylor  <iant@google.com>
5380
5381         * archive.cc (Archive::get_elf_object_for_member): Permit
5382         punconfigured to be NULL.
5383         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5384         (Archive::include_member): Pass NULL to get_elf_object_for_member
5385         if we searched for the archive and this is the first included
5386         object.
5387
5388 2010-12-01  Ian Lance Taylor  <iant@google.com>
5389
5390         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5391         track_relocs_type_ field.
5392         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5393         Set track_relocs_type_.
5394         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5395         contents when using RELA relocs.
5396         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5397         reloc_map_.
5398         * reloc.cc (Track_relocs::next_addend): New function.
5399         * reloc.h (class Track_relocs): Declare next_addend.
5400
5401 2010-12-01  Ian Lance Taylor  <iant@google.com>
5402
5403         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5404         virtual destructor.
5405
5406 2010-12-01  Ian Lance Taylor  <iant@google.com>
5407
5408         * README: Update compilers known to work and fail.
5409
5410 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5411
5412         * configure.in: For --enable-gold, handle value `default' instead of
5413         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5414         not the default.
5415         * configure: Regenerate.
5416
5417 2010-11-18  Doug Kwan  <dougkwan@google.com>
5418
5419         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5420         and right_alignment to be zero.  Store result alignment only if it is
5421         greater than existing alignment.
5422
5423 2010-11-16  Cary Coutant  <ccoutant@google.com>
5424
5425         PR gold/12220
5426         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5427         Check for ".zdebug_line".
5428
5429 2010-11-16  Doug Kwan  <dougkwan@google.com>
5430             Cary Coutant  <ccoutant@google.com>
5431
5432         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5433         by reference; adjust all callers.
5434         * output.cc (Output_segment::set_section_addresses): Adjust references
5435         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5436         list is empty.
5437         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5438         end at page boundary.
5439
5440 2010-11-16  Cary Coutant  <ccoutant@google.com>
5441
5442         PR gold/12220
5443         * layout.cc (Layout::choose_output_section): Transform names of
5444         compressed sections even when using a script with a SECTIONS clause.
5445         (Layout::output_section_name): Remove code to transform
5446         compressed debug section names.
5447         * output.cc (Output_section::add_input_section): Use uncompressed
5448         section size when tracking input sections.
5449
5450 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5451
5452         * symtab.h (Symbol::NON_PIC_REF): Remove.
5453         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5454         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5455         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5456         (Symbol::use_plt_offset): Take a flags argument and pass it
5457         directly to needs_dynamic_reloc.  Restrict check for undefined
5458         weak symbols to function calls.
5459         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5460         (Target_arm::Scan::global): Use it.
5461         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5462         (Target_arm::Relocate::relocate): Likewise.
5463         (Target_arm::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_arm::Relocate::relocate): Update accordingly.
5467         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5468         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5469         (Target_i386::Scan::global): Likewise.
5470         (Target_i386::Relocate::relocate): Likewise.
5471         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5472         parameter with an r_type parameter.  Use get_reference_flags
5473         to get the flags.
5474         (Target_i386::Relocate::relocate): Update accordingly.
5475         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5476         (Target_powerpc::Scan::global): Use it.
5477         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5478         (Target_powerpc::Relocate::relocate): Likewise.
5479         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5480         (Target_sparc::Scan::global): Use it.
5481         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5482         (Target_sparc::Relocate::relocate): Likewise.
5483         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5484         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5485         (Target_x86_64::Scan::global): Likewise.
5486         (Target_x86_64::Relocate::relocate): Likewise.
5487
5488 2010-11-08  Doug Kwan  <dougkwan@google.com>
5489             Cary Coutant  <ccoutant@google.com>
5490
5491         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5492         (Arm_exidx_merge_section::section_contents_): New data member.
5493         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5494         (Arm_input_section::~Arm_input_section): De-allocate memory.
5495         (Arm_input_section::original_contents_): New data member.
5496         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5497         in parameters instead of calling Object::section_contents without
5498         locking.
5499         (Arm_output_section::group_section): New parameter TASK.  Pass it
5500         to callees that need locking objects.
5501         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5502         to lock EXIDX input sections.  Fix a formatting issue.  Call
5503         Arm_exidx_merged_section::build_contents to create merged section
5504         contents.
5505         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5506         to lock object of stub table owner.
5507         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5508         TEXT_SIZE to initialize data member TEXT_SIZE_.
5509         (Arm_exidx_input_section::addralign): Fix typo in comment.
5510         (Arm_exidx_input_section::text_size): New method.
5511         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5512         that require locking objects.  Lock objects before scanning for stubs
5513         and updating local symbols.
5514         (Arm_input_section<big_endian>::init): Copy contents of original
5515         input section.
5516         (Arm_input_section<big_endian>::do_write): Use saved contents of
5517         original input section instead of calling Object::section_contents
5518         without locking.
5519         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5520         size without calling Object::section_size().
5521         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5522         for size.  Allocate a buffer for merged EXIDX entries.
5523         (Arm_exidx_merged_section::build_contents): New method.
5524         (Arm_exidx_merged_section::do_write): Move merge section contents
5525         building code to Arm_exidx_merged_section::build_contetns.  Write
5526         out contetns in buffer instead of building it on the fly.
5527         (Arm_relobj::make_exidx_input_section): Also pass text section size
5528         to Arm_exidx_input_section constructor.
5529         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5530         (Arm_dynobj::do_read_symbols): Fix memory leak.
5531         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5532         * target.h: (class Task): Add forward declaration.
5533         (Target::relax): Add new parameter TASK and pass it to
5534         Target::do_relax().
5535         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5536
5537 2010-11-05  Cary Coutant  <ccoutant@google.com>
5538
5539         PR gold/10708
5540         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5541         object when reading from the file.
5542         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5543         second layout pass.
5544         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5545         when reading section contents.
5546         (get_section_contents): Likewise.
5547         (icf::find_identical_sections): Likewise.
5548         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5549         object when reading from the file.
5550         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5551         the object when doing deferred section layout.
5552
5553 2010-11-03  Nick Clifton  <nickc@redhat.com>
5554
5555         PR gold/12001
5556         * script.h (class Symbol_assignment: name): New member.  Returns
5557         the name of the symbol.
5558         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5559         Returns true if the given symbol name is on the list of
5560         assignments wating to be processed.
5561         * archive.cc (should_incldue_member): If the symbol is undefined,
5562         check to see if it is on the list of symbols pending assignment.
5563
5564 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5565
5566         * script-sections.cc (Script_sections::find_memory_region): Check
5567         for a NULL output section pointer.
5568
5569 2010-10-29  Doug Kwan  <dougkwan@google.com>
5570
5571         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5572         Output_section::add_relaxed_input_section.
5573         * output.cc (Output_section::add_relaxed_input_section): Add new
5574         arguments LAYOUT and NAME.  Set section order index.
5575         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5576         Copy section order index.
5577         * output.h (Output_section::add_relaxed_input_section): Add new
5578         arguments LAYOUT and NAME.
5579
5580 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5581
5582         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5583         NATIVE_OR_CROSS_LINKER.
5584         * testsuite/Makefile.in: Regenerate.
5585
5586 2010-10-20  Doug Kwan  <dougkwan@google.com>
5587
5588         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5589         without SHF_LINK_ORDER flags.
5590         * layout.cc (Layout::choose_output_section): Do not filter
5591         SHF_LINK_ORDER flag in a relocatable link.
5592
5593 2010-10-17  Cary Coutant  <ccoutant@google.com>
5594
5595         * output.h (Output_segment::set_section_addresses): Change function
5596         signature.  Update all callers.
5597         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5598         sections.
5599         (Output_segment::set_section_addresses): Align after last TLS
5600         section.  Add padding before last relro section instead of after.
5601
5602 2010-10-17  Doug Kwan  <dougkwan@google.com>
5603
5604         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5605         GOT output section to be writable.
5606
5607 2010-10-14  Cary Coutant  <ccoutant@google.com>
5608
5609         * debug.h (DEBUG_INCREMENTAL): New flag.
5610         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5611         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5612         mode.
5613         * incremental.cc (report_command_line): Ignore all forms of
5614         --incremental.
5615         * layout.cc (Layout::Layout): Check parameters for incremental link
5616         mode.
5617         * options.cc (General_options::parse_incremental): New function.
5618         (General_options::parse_no_incremental): New function.
5619         (General_options::parse_incremental_full): New function.
5620         (General_options::parse_incremental_update): New function.
5621         (General_options::incremental_mode_): New data member.
5622         (General_options::finalize): Check incremental_mode_.
5623         * options.h (General_options): Update help text for --incremental.
5624         Add --no-incremental, --incremental-full, --incremental-update.
5625         (General_options::Incremental_mode): New enum type.
5626         (General_options::incremental_mode): New function.
5627         (General_options::incremental_mode_): New data member.
5628         * parameters.cc (Parameters::incremental_mode_): New data member.
5629         (Parameters::set_options): Set incremental_mode_.
5630         (Parameters::set_incremental_full): New function.
5631         (Parameters::incremental): New function.
5632         (Parameters::incremental_update): New function.
5633         (set_parameters_incremental_full): New function.
5634         * parameters.h (Parameters::set_incremental_full): New function.
5635         (Parameters::incremental): New function.
5636         (Parameters::incremental_update): New function.
5637         (Parameters::incremental_mode_): New data member.
5638         (set_parameters_incremental_full): New function.
5639         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5640         incremental link mode.
5641         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5642         (Sized_relobj::do_relocate_sections): Likewise.
5643         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5644         option.
5645         * testsuite/Makefile.in: Regenerate.
5646         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5647
5648 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5649
5650         * script-sections.h (class Script_sections): Make
5651         Sections_elements typedef public.
5652         * script-sections.cc (class Sort_output_sections): Add elements_
5653         field.  Add constructor which sets it; change all callers.
5654         (Sort_output_sections::is_before): New function.
5655         (Sort_output_sections::operator()): Call is_before.
5656         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5657         conditional.
5658         * testsuite/script_test_10.sh: New test. Test script section
5659         order.
5660         * testsuite/script_test_10.t: Likewise.
5661         * testsuite/script_test_10.s: Likewise.
5662         * testsuite/Makefile.am: Wrap the cross linker tests and the
5663         common tests into NATIVE_OR_CROSS_LINKER.
5664         (check_SCRIPTS): Add script_test_10.sh.
5665         (check_DATA): Add script_test_10.stdout.
5666         (script_test_10.o, script_test_10): New targets.
5667         (script_test_10.stdout): New target.
5668         * configure, testsuite/Makefile.in: Regenerate.
5669
5670 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5671
5672         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5673         error for the deprecated relocations.
5674         (Target_arm::Scan::global): Likewise.
5675         (Target_arm::Relocate::relocate): Likewise.
5676
5677 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5678
5679         * fileread.cc (Input_file::find_file): Initialize *found_name
5680         and *namep when using the fallback search for case 4.
5681
5682 2010-10-11  Cary Coutant  <ccoutant@google.com>
5683
5684         * options.h (class General_options): Redefine -z lazy as an alias for
5685         the negation of -z now.
5686
5687 2010-10-11  Ian Lance Taylor  <iant@google.com>
5688
5689         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5690         binding.
5691
5692 2010-10-06  Nick Clifton  <nickc@redhat.com>
5693
5694         * script-sections.cc(class Memory_region): Remove
5695         current_lma_offset_ field.  Rename current_vma_offset_ to
5696         current_offset_.  Add last_section_ field.
5697         (Memory_region::get_current_vma_address): Rename to
5698         get_current_address.
5699         (Memory_region::get_current_lma_address): Delete.
5700         (Memory_region::increment_vma_offset): Rename to
5701         increment_offset.
5702         (Memory_region::increment_lma_offset): Delete.
5703         (Memory_region::attributes_compatible): New method.  Returns
5704         true if the provided section is compatible with the region.
5705         (Memory_region::get_last_section): New method.  Returns the last
5706         section to use the region.
5707         (Memory_region::set_last_section): New method.  Stores the last
5708         section to use the region.
5709         (Script_sections::block_in_region): New method.  Returns true if
5710         a block of memory is contained within a region.
5711         (Script_sections::find_memory_region): New method.  Locates a
5712         memory region to be used to set a VMA or LMA address.
5713         (Output_section_definition::set_section_addresses): Add code to
5714         check for addresses set by memory regions.
5715         (Output_segment::set_section_addresses): Remove memory region
5716         walking code.
5717         (Script_sections::create_segment): Add a warning if a header
5718         segment is created outside of any region.
5719         * script-sections.h (class Script_sections): Add prototypes for
5720         find_memory_region and block_in_region methods.
5721         * testsuite/memory_test.s: Use .long instead of .word.
5722         * testsuite/memory_test.t: Add some more output sections.
5723         * testsuite/memory_test.sh: Update expected output.
5724
5725 2010-10-02  Doug Kwan  <dougkwan@google.com>
5726
5727         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5728         defintion to symtab.h
5729         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5730         declaration to defintion.
5731
5732 2010-10-01  Nick Clifton  <nickc@redhat.com>
5733
5734         * expression.cc (eval): Replace dummy argument with NULL.
5735         (eval_maybe_dot): Check for a NULL result section pointer.
5736         (Symbol_expression::value): Likewise.
5737         (Dot_expression::value): Likewise.
5738         (BINARY_EXPRESSION): Likewise.
5739         (Max_expression::value): Likewise.
5740         (Min_expression::value): Likewise.
5741         (Absolute_expression::value): Likewise.
5742         (Addr_expression::value_from_output_section): Likewise.
5743         (Loaddddr_expression::value_from_output_section): Likewise.
5744         (Segment_start_expression::value): Likewise.
5745         * script-sections.cc
5746         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5747         argument with NULL.
5748         (Sections_elememt_dot_assignment::set_section_addresses):
5749         Likewise.
5750         (Output_data_expression::do_write_to_buffer): Likewise.
5751         (Output_section_definition::finalize_symbols): Likewise.
5752         (Output_section_definition::set_section_addresses): Likewise.
5753
5754 2010-09-30  Doug Kwan  <dougkwan@google.com>
5755
5756         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5757
5758 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5759
5760         * target.h (Target::can_icf_inline_merge_sections): New virtual
5761         function.
5762         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5763         virtual function.
5764         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5765         virtual function.
5766         * icf.cc (get_section_contents): Inline merge sections only when
5767         target allows it.
5768
5769 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5770
5771         * configure: Regenerate.
5772
5773 2010-09-17  Ian Lance Taylor  <iant@google.com>
5774
5775         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5776         * testsuite/Makefile.am (memory_test.o): New target.
5777         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5778         memory_test.t.
5779         * testsuite/Makefile.in: Rebuild.
5780
5781 2010-09-17  Doug Kwan  <dougkwan@google.com>
5782
5783         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5784         defintion if relocation uses GOT entries of the symbol.
5785         * testsuite/icf_safe_test.sh: Fix test.
5786         * testsuite/icf_safe_so_test.sh: Fix test.
5787
5788 2010-09-16  Cary Coutant  <ccoutant@google.com>
5789
5790         * script_sections.cc (class Memory_region): Remove "NULL" from
5791         vector initializations.
5792
5793 2010-09-15  Cary Coutant  <ccoutant@google.com>
5794
5795         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5796         Resolve forwarding symbols.
5797
5798 2010-09-15  Doug Kwan  <dougkwan@google.com>
5799
5800         * gold/testsuite/script_test_3.t: Add ARM special sections.
5801         * gold/testsuite/script_test_4.t: Same.
5802         * gold/testsuite/script_test_5.t: Same.
5803         * gold/testsuite/script_test_6.t: Same.
5804         * gold/testsuite/script_test_7.t: Same.
5805         * gold/testsuite/script_test_7.t: Same.
5806         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5807
5808 2010-09-14  Cary Coutant  <ccoutant@google.com>
5809
5810         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5811         (Target_x86_64::Relocate::relocate_tls): Replace check for
5812         saw_tls_block_reloc_ with test for executable section.
5813
5814 2010-09-12  Cary Coutant  <ccoutant@google.com>
5815
5816         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5817         position-independent executables to shared libraries need dynamic
5818         relocations.
5819         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5820         position-independent executables.
5821         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5822         * testsuite/Makefile.in: Regenerate.
5823
5824 2010-09-10  Nick Clifton  <nickc@redhat.com>
5825
5826         PR gold/11997
5827         * testsuite/memory_test.t: Discard any sections that are not
5828         needed.
5829
5830 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5831
5832         PR gold/11996
5833         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5834         "This::" to work around a bug in gcc 4.2.
5835
5836         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5837
5838 2010-09-09  Rafael Espindola  <espindola@google.com>
5839
5840         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5841         sections with different PF_X flags in the same segment.
5842         (Layout::find_first_load_seg): Search all segments to find the first
5843         one.
5844         * options.h (rosegment): New.
5845
5846 2010-09-08  Rafael Espindola  <espindola@google.com>
5847
5848         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5849
5850 2010-09-08  Doug Kwan  <dougkwan@google.com>
5851
5852         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5853         (Arm_relobj::do_relocate_sections): Add new parameter for output
5854         file to match the parent.
5855         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5856         of local symbols instead of input values.  Update code to track
5857         changes in gold::relocate_section.
5858         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5859         (Sized_relobj::compute_final_local_value_internal): New methods.
5860         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5861         body into private version of Sized_relobj::compute_final_local_value.
5862         Call the inline method.
5863         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5864         merged symbol value if there is one.
5865         (Symbol_value::has_output_value): New method defintiion.
5866         (Sized_relobj::Compute_final_local_value_status): New enum type.
5867         (Sized_relobj::compute_final_local_value): New methods.
5868         (Sized_relobj::compute_final_local_value_internal): New methods.
5869         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5870         and arm_cortex_a8.sh.
5871         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5872         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5873         New tests.
5874         * Makefile.in: Regenerate.
5875         * testsuite/arm_bl_out_of_range.s: Update test.
5876         * testsuite/thumb_bl_out_of_range.s: Ditto.
5877         * testsuite/thumb_blx_out_of_range.s: Ditto.
5878         * testsuite/arm_branch_out_of_range.sh: New file.
5879         * testsuite/arm_cortex_a8.sh: Ditto.
5880         * testsuite/arm_cortex_a8_b.s: Ditto.
5881         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5882         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5883         * testsuite/arm_cortex_a8_bl.s: Ditto.
5884         * testsuite/arm_cortex_a8_blx.s: Ditto.
5885         * testsuite/arm_cortex_a8_local.s: Ditto.
5886         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5887         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5888
5889 2010-09-08  Rafael Espindola  <espindola@google.com>
5890
5891         * Makefile.am (memory_test.stdout): Run readelf with -W.
5892         * Makefile.in: Regenerate.
5893         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5894         64 bit output.
5895
5896 2010-09-08  Rafael Espindola  <espindola@google.com>
5897
5898         * script-sections.cc (Script_sections::add_memory_region): Convert
5899         field precision to int.
5900         * script.cc (script_set_section_region, script_set_section_region):
5901         Convert field precision to int.
5902
5903 2010-09-08  Rafael Espindola  <espindola@google.com>
5904
5905         * arm.cc (do_finalize_sections): Create the __exidx_start and
5906         __exdix_end symbols even when the section is missing.
5907
5908 2010-09-08  Nick Clifton  <nickc@redhat.com>
5909
5910         * README: Remove claim that MEMORY is not supported.
5911         * expression.cc (script_exp_function_origin)
5912         (script_exp_function_length): Move from here to ...
5913         * script.cc: ... here.
5914         (script_set_section_region, script_add_memory)
5915         (script_parse_memory_attr, script_include_directive): New
5916         functions.
5917         * script-sections.cc
5918         (class Memory_region): New class.
5919         (class Output_section_definition): Add set_memory_region,
5920         set_section_vma, set_section_lma and get_section_name methods.
5921         (class Script_Sections): Add add_memory_region,
5922         find_memory_region, find_memory_region_origin,
5923         find_memory_region_length and set_memory_region methods.
5924         Have set_section_addresses method walk the list of set memory
5925         regions.
5926         Extend the print methos to display memory regions.
5927         * script-sections.h: Add prototypes for new methods.
5928         Add enum for MEMORY region attributes.
5929         * yyscript.y: Add support for parsing MEMORY regions.
5930         * script-c.h: Add prototypes for new functions.
5931         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5932         * testsuite/Makefile.in: Regenerate.
5933         * testsuite/memory_test.sh: New script.
5934         * testsuite/memory_test.s: New assembler source file.
5935         * testsuite/memory_test.t: New linker script.
5936
5937 2010-08-27  Doug Kwan  <dougkwan@google.com>
5938
5939         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5940         reference override an existing dynamic weak reference.
5941         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5942         * testsuite/Makefile.in: Regenerate.
5943         * testsuite/dyn_weak_ref.sh: New file.
5944         * testsuite/dyn_weak_ref_1.c: Ditto.
5945         * testsuite/dyn_weak_ref_2.c: Ditto.
5946
5947 2010-08-27  Ian Lance Taylor  <iant@google.com>
5948
5949         * incremental.h (class Incremental_input_entry): Add virtual
5950         destructor.
5951
5952 2010-08-27  Ian Lance Taylor  <iant@google.com>
5953
5954         * testsuite/start_lib_test_3.c: Mark t3 as used.
5955
5956 2010-08-27  Nick Clifton  <nickc@redhat.com>
5957
5958         * options.cc (version_script): Fix small typo in previous
5959         whitespace tidyup.
5960
5961 2010-08-25  Nick Clifton  <nickc@redhat.com>
5962
5963         * archive.cc: Formatting fixes: Remove whitespace between
5964         typename and following asterisk.  Remove whitespace between
5965         function name and opening parenthesis.
5966         * archive.h: Likewise.
5967         * arm.cc: Likewise.
5968         * attributes.cc: Likewise.
5969         * attributes.h: Likewise.
5970         * common.cc: Likewise.
5971         * copy-relocs.cc: Likewise.
5972         * dirsearch.h: Likewise.
5973         * dynobj.cc: Likewise.
5974         * ehframe.cc: Likewise.
5975         * ehframe.h: Likewise.
5976         * expression.cc: Likewise.
5977         * fileread.cc: Likewise.
5978         * fileread.h: Likewise.
5979         * gc.h: Likewise.
5980         * gold-threads.cc: Likewise.
5981         * gold.cc: Likewise.
5982         * i386.cc: Likewise.
5983         * icf.h: Likewise.
5984         * incremental-dump.cc: Likewise.
5985         * incremental.cc: Likewise.
5986         * layout.cc: Likewise.
5987         * layout.h: Likewise.
5988         * main.cc: Likewise.
5989         * merge.cc: Likewise.
5990         * merge.h: Likewise.
5991         * object.cc: Likewise.
5992         * object.h: Likewise.
5993         * options.cc: Likewise.
5994         * options.h: Likewise.
5995         * output.cc: Likewise.
5996         * output.h: Likewise.
5997         * plugin.cc: Likewise.
5998         * plugin.h: Likewise.
5999         * powerpc.cc: Likewise.
6000         * reloc.cc: Likewise.
6001         * script-c.h: Likewise.
6002         * script-sections.cc: Likewise.
6003         * script.cc: Likewise.
6004         * stringpool.cc: Likewise.
6005         * symtab.cc: Likewise.
6006         * symtab.h: Likewise.
6007         * target.cc: Likewise.
6008         * timer.cc: Likewise.
6009         * timer.h: Likewise.
6010         * version.cc: Likewise.
6011         * x86_64.cc: Likewise.
6012
6013 2010-08-24  Nick Clifton  <nickc@redhat.com>
6014
6015         PR 11899
6016         * layout.cc (segment_precedes): Sort segments by their physical
6017         addresses, if they have been set.
6018
6019 2010-08-23  Cary Coutant  <ccoutant@google.com>
6020
6021         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6022         symbols data.
6023         (Lib_group::include_member): Unlock object after deleting its
6024         symbols data.
6025         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6026         the bug fixed here.
6027
6028 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6029             Cary Coutant  <ccoutant@google.com>
6030
6031         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6032         constructor, and set_blocker.
6033         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6034         readsyms_blocker_.
6035         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6036         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6037         * testsuite/Makefile.am (start_lib_test): New test case.
6038         * testsuite/Makefile.in: Regenerate.
6039         * testsuite/start_lib_test_main.c: New file.
6040         * testsuite/start_lib_test_1.c: New file.
6041         * testsuite/start_lib_test_2.c: New file.
6042         * testsuite/start_lib_test_3.c: New file.
6043
6044 2010-08-19  Ian Lance Taylor  <iant@google.com>
6045
6046         * Makefile.in: Rebuild with automake 1.11.1.
6047         * aclocal.m4: Likewise.
6048         * testsuite/Makefile.in: Likewise.
6049
6050 2010-08-19  Ian Lance Taylor  <iant@google.com>
6051
6052         PR 10893
6053         * i386.cc (class Output_data_plt_i386): Update declarations.
6054         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6055         local_ifuncs_ fields.
6056         (Target_i386::do_plt_section_for_global): New function.
6057         (Target_i386::do_plt_section_for_local): New function.
6058         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6059         parameter; change all callers.  Initialize global_ifuncs_ and
6060         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6061         __rel_iplt_end.
6062         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6063         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6064         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6065         symbols.
6066         (Target_i386::make_plt_section): New function, broken out of
6067         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6068         (Target_i386::make_plt_entry): Call make_plt_section.
6069         (Target_i386::make_local_ifunc_plt_entry): New function.
6070         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6071         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6072         R_386_IRELATIVE to switch.
6073         (Target_i386::Scan::global): Likewise.
6074         (Target_i386::Relocate::relocate): Likewise.
6075         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6076         switch.
6077         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6078         (Target_x86_64::do_plt_section_for_global): New function.
6079         (Target_x86_64::do_plt_section_for_local): New function.
6080         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6081         parameter; change all callers.  If doing a static link define
6082         __rela_iplt_start and __rela_iplt_end.
6083         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6084         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6085         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6086         to point to .plt.
6087         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6088         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6089         switch.
6090         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6091         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6092         R_X86_64_IRELATIVE to switch.
6093         (Target_x86_64::Scan::global): Likewise.
6094         (Target_x86_64::Relocate::relocate): Likewise.
6095         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6096         switch.
6097         * target.h (class Target): Add plt_section_for_global and
6098         plt_section_for_local functions.  Add do_plt_section_for_global
6099         and do_plt_section_for_local virtual functions.
6100         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6101         clarifying comments.
6102         (Symbol::use_plt_offset): Handle IFUNC symbol.
6103         * object.cc (Sized_relobj::Sized_relobj): Initialize
6104         local_plt_offsets_.
6105         (Sized_relobj::local_has_plt_offset): New function.
6106         (Sized_relobj::local_plt_offset): New function.
6107         (Sized_relobj::set_local_plt_offset): New function.
6108         (Sized_relobj::do_count): Handle IFUNC symbol.
6109         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6110         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6111         is_ifunc_symbol functions.
6112         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6113         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6114         local_plt_offsets_ field.
6115         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6116         * output.h (class Output_section_data): Add non-const
6117         output_section function.
6118         (class Output_data_got): Update declarations.
6119         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6120         Add use_plt_offset parameter to global and local constructors.
6121         Change all callers.  Change local_sym_index_ field to 31 bits.
6122         Change GSYM_CODE and CONSTANT_CODE accordingly.
6123         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6124         doing a static link don't set sh_link field.
6125         (Output_data_got::Got_entry::write): Use PLT offset if
6126         appropriate.
6127         (Output_data_got::add_global_plt): New function.
6128         (Output_data_got::add_local_plt): New function.
6129         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6130         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6131         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6132         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6133         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6134         IFUNC conditional.
6135         * testsuite/ifunc-sel.h: New file.
6136         * testsuite/ifuncmain1.c: New file.
6137         * testsuite/ifuncmain1vis.c: New file.
6138         * testsuite/ifuncmod1.c: New file.
6139         * testsuite/ifuncdep2.c: New file.
6140         * testsuite/ifuncmain2.c: New file.
6141         * testsuite/ifuncmain3.c: New file.
6142         * testsuite/ifuncmod3.c: New file.
6143         * testsuite/ifuncmain4.c: New file.
6144         * testsuite/ifuncmain5.c: New file.
6145         * testsuite/ifuncmod5.c: New file.
6146         * testsuite/ifuncmain6pie.c: New file.
6147         * testsuite/ifuncmod6.c: New file.
6148         * testsuite/ifuncmain7.c: New file.
6149         * configure, testsuite/Makefile.in: Rebuild.
6150
6151 2010-08-18  Ian Lance Taylor  <iant@google.com>
6152
6153         * incremental.cc
6154         (Output_section_incremental_inputs::write_input_files): Add cast
6155         to avoid signed/unsigned comparison warning.
6156         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6157
6158 2010-08-12  Cary Coutant  <ccoutant@google.com>
6159
6160         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6161
6162 2010-08-13  Ian Lance Taylor  <iant@google.com>
6163
6164         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6165
6166 2010-08-12  Cary Coutant  <ccoutant@google.com>
6167             Doug Kwan  <dougkwan@google.com>
6168
6169         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6170         defintion overrides non-weak undef, remember that the original undef
6171         is not weak.
6172         * symtab.cc (Symbol_table::sized_write_global): For undef without
6173         an original weak binding, set binding to global in output.
6174         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6175         * testsuite/Makefile.in: Regenerate.
6176         * testsuite/strong_ref_weak_def.sh: New file.
6177         * testsuite/strong_ref_weak_def_1.c: Ditto.
6178         * testsuite/strong_ref_weak_def_2.c: Ditto.
6179
6180 2010-08-12  Cary Coutant  <ccoutant@google.com>
6181
6182         * testsuite/incremental_test.sh: Rewrite.
6183         * testsuite/incremental_test_1.c: Rewrite.
6184         * testsuite/incremental_test_2.c: Rewrite.
6185
6186 2010-08-12  Cary Coutant  <ccoutant@google.com>
6187
6188         * arm.cc (Target_arm::got_size): Add const.
6189         (Target_arm::got_entry_count): New function.
6190         (Target_arm::plt_entry_count): New function.
6191         (Target_arm::first_plt_entry_offset): New function.
6192         (Target_arm::plt_entry_size): New function.
6193         (Output_data_plt_arm::entry_count): New function.
6194         (Output_data_plt_arm::first_plt_entry_offset): New function.
6195         (Output_data_plt_arm::get_plt_entry_size): New function.
6196         * i386.cc (Target_i386::got_size): Add const.
6197         (Target_i386::got_entry_count): New function.
6198         (Target_i386::plt_entry_count): New function.
6199         (Target_i386::first_plt_entry_offset): New function.
6200         (Target_i386::plt_entry_size): New function.
6201         (Output_data_plt_i386::entry_count): New function.
6202         (Output_data_plt_i386::first_plt_entry_offset): New function.
6203         (Output_data_plt_i386::get_plt_entry_size): New function.
6204         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6205         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6206         * incremental.cc: Include target.h.
6207         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6208         parameter.  Adjust all callers.  Find incremental_got_plt section.
6209         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6210         section.
6211         (Output_section_incremental_inputs::set_final_data_size): Calculate
6212         size of incremental_got_plt section.
6213         (Output_section_incremental_inputs::do_write): Write the
6214         incremental_got_plt section.
6215         (Got_plt_view_info): New struct.
6216         (Local_got_offset_visitor): New class.
6217         (Global_got_offset_visitor): New class.
6218         (Global_symbol_visitor_got_plt): New class.
6219         (Output_section_incremental_inputs::write_got_plt): New function.
6220         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6221         Add parameter.  Adjust all callers.
6222         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6223         (Incremental_inputs::got_plt_section): New function.
6224         (Incremental_inputs::got_plt_section_): New data member.
6225         (Incremental_got_plt_reader): New class.
6226         * layout.cc (Layout::create_incremental_info_sections): Add the
6227         incremental_got_plt section.
6228         * object.h (Got_offset_list::get_list): New function.
6229         (Got offset_list::for_all_got_offsets): New function.
6230         (Sized_relobj::local_got_offset_list): New function.
6231         * powerpc.cc (Target_powerpc::got_size): Add const.
6232         (Target_powerpc::got_entry_count): New function.
6233         (Target_powerpc::plt_entry_count): New function.
6234         (Target_powerpc::first_plt_entry_offset): New function.
6235         (Target_powerpc::plt_entry_size): New function.
6236         (Output_data_plt_powerpc::entry_count): New function.
6237         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6238         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6239         * sparc.cc (Target_sparc::got_size): Add const.
6240         (Target_sparc::got_entry_count): New function.
6241         (Target_sparc::plt_entry_count): New function.
6242         (Target_sparc::first_plt_entry_offset): New function.
6243         (Target_sparc::plt_entry_size): New function.
6244         (Output_data_plt_sparc::entry_count): New function.
6245         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6246         (Output_data_plt_sparc::get_plt_entry_size): New function.
6247         * symtab.h (Symbol::got_offset_list): New function.
6248         (Symbol_table::for_all_symbols): New function.
6249         * target.h (Sized_target::got_entry_count): New function.
6250         (Sized_target::plt_entry_count): New function.
6251         (Sized_target::plt_entry_size): New function.
6252         * x86_64.cc (Target_x86_64::got_size): Add const.
6253         (Target_x86_64::got_entry_count): New function.
6254         (Target_x86_64::plt_entry_count): New function.
6255         (Target_x86_64::first_plt_entry_offset): New function.
6256         (Target_x86_64::plt_entry_size): New function.
6257         (Output_data_plt_x86_64::entry_count): New function.
6258         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6259         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6260
6261 2010-08-12  Cary Coutant  <ccoutant@google.com>
6262
6263         * archive.cc: Include incremental.h.
6264         (Archive::Archive): Initialize incremental_info_.
6265         (Archive::include_member): Record archive members in incremental info.
6266         (Add_archive_symbols::run): Record begin and end of an archive in
6267         incremental info.
6268         (Lib_group::include_member): Record objects in incremental info.
6269         * archive.h (Incremental_archive_entry): Forward declaration.
6270         (Archive::set_incremental_info): New member function.
6271         (Archive::incremental_info): New member function.
6272         (Archive::Unused_symbol_iterator): New class.
6273         (Archive::unused_symbols_begin): New member function.
6274         (Archive::unused_symbols_end): New member function.
6275         (Archive::incremental_info_): New data member.
6276         * incremental-dump.cc (find_input_containing_global): New function.
6277         (dump_incremental_inputs): Dump new incremental info sections.
6278         * incremental.cc: Include symtab.h.
6279         (Output_section_incremental_inputs): New class.
6280         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6281         new incremental info sections.
6282         (Sized_incremental_binary::do_check_inputs): Likewise.
6283         (Incremental_inputs::report_archive): Remove.
6284         (Incremental_inputs::report_archive_begin): New function.
6285         (Incremental_inputs::report_archive_end): New function.
6286         (Incremental_inputs::report_object): New function.
6287         (Incremental_inputs::finalize_inputs): Remove.
6288         (Incremental_inputs::report_input_section): New function.
6289         (Incremental_inputs::report_script): Rewrite.
6290         (Incremental_inputs::finalize): Do nothing but finalize string table.
6291         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6292         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6293         (Incremental_inputs::create_data_sections): New function.
6294         (Incremental_inputs::relocs_entsize): New function.
6295         (Output_section_incremental_inputs::set_final_data_size): New function.
6296         (Output_section_incremental_inputs::do_write): New function.
6297         (Output_section_incremental_inputs::write_header): New function.
6298         (Output_section_incremental_inputs::write_input_files): New function.
6299         (Output_section_incremental_inputs::write_info_blocks): New function.
6300         (Output_section_incremental_inputs::write_symtab): New function.
6301         * incremental.h (Incremental_script_entry): Forward declaration.
6302         (Incremental_object_entry): Forward declaration.
6303         (Incremental_archive_entry): Forward declaration.
6304         (Incremental_inputs): Forward declaration.
6305         (Incremental_inputs_header_data): Remove.
6306         (Incremental_inputs_header): Remove.
6307         (Incremental_inputs_header_write): Remove.
6308         (Incremental_inputs_entry_data): Remove.
6309         (Incremental_inputs_entry): Remove.
6310         (Incremental_inputs_entry_write): Remove.
6311         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6312         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6313         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6314         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6315         Likewise.
6316         (Incremental_input_entry): New class.
6317         (Incremental_script_entry): New class.
6318         (Incremental_object_entry): New class.
6319         (Incremental_archive_entry): New class.
6320         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6321         (Incremental_inputs::report_inputs): Remove.
6322         (Incremental_inputs::report_archive): Remove.
6323         (Incremental_inputs::report_archive_begin): New function.
6324         (Incremental_inputs::report_archive_end): New function.
6325         (Incremental_inputs::report_object): Change prototype.
6326         (Incremental_inputs::report_input_section): New function.
6327         (Incremental_inputs::report_script): Change prototype.
6328         (Incremental_inputs::get_reloc_count): New function.
6329         (Incremental_inputs::set_reloc_count): New function.
6330         (Incremental_inputs::create_data_sections): New function.
6331         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6332         (Incremental_inputs::inputs_section): New function.
6333         (Incremental_inputs::symtab_section): New function.
6334         (Incremental_inputs::relocs_section): New function.
6335         (Incremental_inputs::get_stringpool): Add const.
6336         (Incremental_inputs::command_line): Add const.
6337         (Incremental_inputs::inputs): Remove.
6338         (Incremental_inputs::command_line_key): New function.
6339         (Incremental_inputs::input_file_count): New function.
6340         (Incremental_inputs::input_files): New function.
6341         (Incremental_inputs::relocs_entsize): New function.
6342         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6343         (Incremental_inputs::finalize_inputs): Remove.
6344         (Incremental_inputs::Input_info): Remove.
6345         (Incremental_inputs::lock_): Remove.
6346         (Incremental_inputs::inputs_): Change type.
6347         (Incremental_inputs::inputs_map_): Remove.
6348         (Incremental_inputs::current_object_entry_): New data member.
6349         (Incremental_inputs::inputs_section_): New data member.
6350         (Incremental_inputs::symtab_section_): New data member.
6351         (Incremental_inputs::relocs_section_): New data member.
6352         (Incremental_inputs::reloc_count_): New data member.
6353         (Incremental_inputs_reader): New class.
6354         (Incremental_symtab_reader): New class.
6355         (Incremental_relocs_reader): New class.
6356         * layout.cc (Layout::finalize): Move finalization of incremental info
6357         and creation of incremental info sections to follow finalization of
6358         symbol table.  Set offsets for postprocessing sections.
6359         (Layout::create_incremental_info_sections): Call
6360         Incremental_inputs::create_data_sections.  Add incremental symtab
6361         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6362         sections to layout after input sections.
6363         * layout.h (struct Timespec): Forward declaration.
6364         (Layout::incremental_inputs): Add const.
6365         (Layout::create_incremental_info_sections): Add parameter.
6366         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6367         * object.cc: Include incremental.h.
6368         (Relobj::finalize_incremental_relocs): New function.
6369         (Sized_relobj::do_layout): Record input sections in incremental info.
6370         * object.h (Object::output_section): New function.
6371         (Object::output_section_offset): Moved from Relobj.
6372         (Object::get_incremental_reloc_base): New function.
6373         (Object::get_incremental_reloc_count): New function.
6374         (Object::do_output_section): New function.
6375         (Object::do_output_section_offset): Moved from Relobj.
6376         (Object::do_get_incremental_reloc_base): New function.
6377         (Object::do_get_incremental_reloc_count): New function.
6378         (Object::Object): Initialize new data members.
6379         (Relobj::output_section): Renamed do_output_section and moved to
6380         protected.
6381         (Relobj::output_section_offset): Moved to Object.
6382         (Relobj::do_get_incremental_reloc_base): New function.
6383         (Relobj::do_get_incremental_reloc_count): New function.
6384         (Relobj::allocate_incremental_reloc_counts): New function.
6385         (Relobj::count_incremental_reloc): New function.
6386         (Relobj::finalize_incremental_relocs): New function.
6387         (Relobj::next_incremental_reloc_index): New function.
6388         (Relobj::reloc_counts_): New data member.
6389         (Relobj::reloc_bases_): New data member.
6390         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6391         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6392         (Sized_relobj::incremental_relocs_scan): New function.
6393         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6394         (Sized_relobj::incremental_relocs_write): New function.
6395         (Sized_relobj::incremental_relocs_write_reltype): New function.
6396         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6397         incremental link.
6398         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6399         archives and object files elsewhere.
6400         (Add_symbols::run): Report object files here.
6401         (Finish_group::run): Report end of archive at end of group.
6402         * reloc.cc: Include layout.h, incremental.h.
6403         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6404         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6405         (Sized_relobj::incremental_relocs_scan): New function.
6406         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6407         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6408         (Sized_relobj::incremental_relocs_write): New function.
6409         (Sized_relobj::incremental_relocs_write_reltype): New function.
6410         * script.cc (read_input_script): Rewrite test for incremental link.
6411         Change call to Incremental_inputs::report_script.
6412         * symtab.h (Symbol_table::first_global_index): New function.
6413         (Symbol_table::output_count): New function.
6414
6415 2010-08-12  Doug Kwan  <dougkwan@google.com>
6416
6417         * arm.cc (Target_arm::merge_object_attributes): Check command line
6418         options --no-wchar-size-warning and --no-enum-size-warning.
6419         * options.h (General_options): Add ld-compatible options
6420         --no-enum-size-warning and --no-wchar-size-warning.
6421
6422 2010-08-04  Ian Lance Taylor  <iant@google.com>
6423
6424         * x86_64.cc (Target_x86_64::Scan::local): Use
6425         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6426         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6427         (Target_x86_64::Scan::global): Likewise.
6428         (Target_x86_64::Relocate::relocate): Likewise.
6429         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6430         Likewise.
6431
6432 2010-08-03  Cary Coutant  <ccoutant@google.com>
6433
6434         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6435         to reserve space in merged_strings vector. Keep total input size
6436         for stats.
6437         (Output_merge_string::do_print_merge_stats): Print total input size.
6438         * merge.h (Output_merge_string): Add input_size_ field.
6439         * stringpool.cc (Stringpool_template::string_length): Move
6440         implementations out of Stringpool_template class and place in
6441         stringpool.h.
6442         * stringpool.h (string_length): Move out of Stringpool_template.
6443
6444 2010-08-03  Ian Lance Taylor  <iant@google.com>
6445
6446         PR 11712
6447         * layout.cc (relaxation_loop_body): If address of load segment is
6448         set, adjust address to include headers if possible.
6449
6450 2010-08-03  Ian Lance Taylor  <iant@google.com>
6451
6452         * version.cc (version_string): Bump to 1.10.
6453
6454 2010-08-03  Ian Lance Taylor  <iant@google.com>
6455
6456         PR 11805
6457         * layout.h (enum Output_section_order): Define.
6458         (class Layout): Update declarations.
6459         * layout.cc (Layout::get_output_section): Add order parameter.
6460         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6461         is_first_non_relro parameters.  Change all callers.
6462         (Layout::choose_output_section): Likewise.
6463         (Layout::add_output_section_data): Likewise.
6464         (Layout::make_output_section): Likewise.  Set order.
6465         (Layout::default_section_order): New function.
6466         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6467         * output.cc (Output_section::Output_section): Initialize order_.
6468         Don't initialize deleted fields.
6469         (Output_segment::Output_segment): Don't initialize deleted
6470         fields.
6471         (Output_segment::add_output_section_to_load): New function
6472         replacing add_output_section.  Change all callers to call this or
6473         add_output_section_to_nonload.
6474         (Output_segment::add_output_section_to_nonload): New function.
6475         (Output_segment::remove_output_section): Rewrite.
6476         (Output_segment::add_initial_output_data): Likewise.
6477         (Output_segment::has_any_data_sections): Likewise.
6478         (Output_segment::is_first_section_relro): Likewise.
6479         (Output_segment::maximum_alignment): Likewise.
6480         (Output_segment::has_dynamic_reloc): New function replacing
6481         dynamic_reloc_count.  Change all callers.
6482         (Output_segment::has_dynamic_reloc_list): New function replacing
6483         dynamic_reloc_count_list.  Change all callers.
6484         (Output_segment::set_section_addresses): Rewrite.
6485         (Output_segment::set_offset): Rewrite.
6486         (Output_segment::find_first_and_last_list): Remove.
6487         (Output_segment::set_tls_offsets): Rewrite.
6488         (Output_segment::first_section_load_address): Likewise.
6489         (Output_segment::output_section_count): Likewise.
6490         (Output_segment::section_with_lowest_load_address): Likewise.
6491         (Output_segment::write_section_headers): Likewise.
6492         (Output_segment::print_sections_to_map): Likewise.
6493         * output.h (class Output_data): Remove dynamic_reloc_count_
6494         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6495         (Output_data::add_dynamic_reloc): Rewrite.
6496         (Output_data::has_dynamic_reloc): New function.
6497         (Output_data::dynamic_reloc_count): Remove.
6498         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6499         is_last_relro_, is_first_non_relro_, is_interp_,
6500         is_dynamic_linker_section_ fields.  Add order and set_order
6501         functions.  Remove is_relro_local, set_is_relro_local,
6502         is_last_relro, set_is_last_relro, is_first_non_relro,
6503         set_is_first_non_relro functions, is_interp, set_is_interp,
6504         is_dynamic_linker_section, and set_is_dynamic_linker_section
6505         functions.
6506         (class Output_segment): Change Output_data_list from std::list to
6507         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6508         output_bss_ fields.  Update declarations.
6509
6510 2010-08-02  Ian Lance Taylor  <iant@google.com>
6511
6512         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6513         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6514         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6515
6516 2010-08-02  Ian Lance Taylor  <iant@google.com>
6517
6518         PR 11855
6519         * script.cc (Script_options::Script_options): Initialize
6520         symbol_definitions_ and symbol_references_.
6521         (Script_options::add_symbol_assignment): Update
6522         symbol_definitions_ and symbol_references_.
6523         (Script_options::add_symbol_reference): New function.
6524         (script_symbol): New function.
6525         * script.h (class Script_options): Add symbol_definitions_ and
6526         symbol_references_ fields.
6527         (Script_options::referenced_const_iterator): New type.
6528         (Script_options::referenced_begin): New function.
6529         (Script_options::referenced_end): New function.
6530         (Script_options::is_referenced): New function.
6531         (Script_options::any_unreferenced): New function.
6532         * script-c.h (script_symbol): Declare.
6533         * yyscript.y (exp): Call script_symbol.
6534         * symtab.cc: Include "script.h".
6535         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6536         Change all callers.  Check symbols referenced by scripts.
6537         (Symbol_table::add_undefined_symbols_from_command_line): Add
6538         layout parameter.  Change all callers.
6539         (Symbol_table::do_add_undefined_symbols_from_command_line):
6540         Likewise.  Break out loop body.  Check symbols referenced by
6541         scripts.
6542         (Symbol_table::add_undefined_symbol_from_command_line): New
6543         function broken out of
6544         do_add_undefined_symbols_from_command_line.
6545         * symtab.h (class Symbol_table): Update declarations.
6546         * archive.cc: Include "layout.h".
6547         (Archive::should_include_member): Add layout parameter.  Change
6548         all callers.  Check for symbol mentioned in expression.
6549         * archive.h (class Archive): Update declaration.
6550         * object.cc (Sized_relobj::do_should_include_member): Add layout
6551         parameter.
6552         * object.h (Object::should_include_member): Add layout parameter.
6553         Change all callers.
6554         (Object::do_should_include_member): Add layout parameter.
6555         (class Sized_relobj): Update declaration.
6556         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6557         parameter.
6558         * dynobj.h (class Sized_dynobj): Update declaration.
6559         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6560         layout parameter.
6561         * plugin.h (class Sized_pluginobj): Update declaration.
6562
6563 2010-08-02  Ian Lance Taylor  <iant@google.com>
6564
6565         PR 11866
6566         * output.cc (Output_segment::set_offset): Search for the first and
6567         last sections rather than assuming that the list is in order.
6568         (Output_segment::find_first_and_last_list): New function.
6569         * output.h (class Output_segment): Update declarations.
6570         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6571         (relro_strip_test_SOURCES): New variable.
6572         (relro_strip_test_DEPENDENCIES): New variable.
6573         (relro_strip_test_LDFLAGS): New variable.
6574         (relro_strip_test_LDADD): New variable.
6575         (relro_strip_test.so): New target.
6576
6577 2010-08-02  Ian Lance Taylor  <iant@google.com>
6578
6579         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6580         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6581         (Target_i386::got_tlsdesc_section): New function.
6582         (Target_i386::got_section): Create space for GOT entries for
6583         TLSDESC relocations.
6584         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6585         R_386_TLS_GOTDESC.
6586         (Target_i386::Scan::global): Likewise.
6587         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6588         using TLSDESC GOT.
6589         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6590         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6591         (Target_x86_64::got_tlsdesc_section): New function.
6592         (Target_x86_64::got_section): Create space for GOT entries for
6593         TLSDESC relocations.
6594         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6595         R_386_TLS_GOTDESC.
6596         (Target_x86_64::Scan::global): Likewise.
6597         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6598         using TLSDESC GOT.
6599
6600 2010-08-02  Ian Lance Taylor  <iant@google.com>
6601
6602         * testsuite/final_layout.sh: Use dc to convert from hex to
6603         decimal.
6604
6605 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6606
6607         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6608         paramter to the call to gold::gc_process_relocs.
6609         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6610         paramter to the call to gold::gc_process_relocs.
6611         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6612         parameter to the call to gold::gc_process_relocs.
6613         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6614         template parameter to the call to gold::gc_process_relocs.
6615         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6616         paramter to the call to gold::gc_process_relocs.
6617         * gc.h (get_embedded_addend_size): New function.
6618         (gc_process_relocs): Save the size of the reloc for use by ICF.
6619         * icf.cc (get_section_contents): Get the addend from the text section
6620         for SHT_REL relocation sections.
6621         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6622         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6623         * int_encoding.h (read_from_pointer): New overloaded function.
6624         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6625         * testsuite/icf_sht_rel_addend_test.sh: New file.
6626         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6627         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6628
6629 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6630
6631         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6632         * Makefile.in: Regenerate.
6633         * testsuite/Makefile.in: Regenerate.
6634
6635 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6636
6637         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6638         * gold/testsuite/debug_msg.cc: Likewise.
6639         * gold/testsuite/odr_violation1.cc
6640         * gold/testsuite/odr_violation2.cc
6641
6642 2010-07-21  Cary Coutant  <ccoutant@google.com>
6643
6644         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6645         string, and length fields.
6646         (Output_merge_string::Merged_strings_list): New type.
6647         (Output_merge_string::Merged_strings_lists): New typedef.
6648         (Output_merge_string): Replace merged_strings_ with
6649         merged_strings_lists_.
6650         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6651         Merged_strings_list per input object and section.  Don't store pointer
6652         to the string.  Don't store length with each merged string entry.
6653         (Output_merge_string::finalize_merged_data): Loop over list of merged
6654         strings lists.  Recompute length of each merged string.
6655
6656 2010-07-15  Cary Coutant  <ccoutant@google.com>
6657
6658         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6659         here.
6660
6661 2010-07-14  Ian Lance Taylor  <iant@google.com>
6662
6663         * descriptors.cc (Descriptors::open): Report correct name in error
6664         message.
6665
6666 2010-07-13  Doug Kwan  <dougkwan@google.com>
6667
6668         * arm.cc (Arm_input_section::Arm_input_section): For a
6669         SHT_ARM_EXIDX section, always keeps the input sections.
6670         (Arm_input_section::set_exidx_section_link): New method.
6671         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6672         has_errors_ to false.
6673         (Arm_exidx_input_section::has_errors,
6674         Arm_exidx_input_section::set_has_errors): New methods.
6675         (Arm_exidx_input_section::has_errors_): New data member.
6676         (Arm_relobj::get_exidx_shndx_list): New method.
6677         (Arm_output_section::append_text_sections_to_list): Do not skip
6678         section without SHF_EXECINSTR.
6679         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6680         errors.
6681         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6682         section header.  Make error messages more verbose.  Check for
6683         a non-executable section linked to an EXIDX section.
6684         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6685         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6686         check that there is no deferred EXIDX section if we exit early.
6687         Instead of not making an EXIDX section in case of an error, make one
6688         and set the has_errors flag of it.
6689         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6690         in a relocatable link.
6691         (Target_arm::do_relax): Look for the EXIDX output section instead of
6692         assuming that it is called .ARM.exidx.
6693         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6694         section list.  Do not check for SHF_EXECINSTR section flags but
6695         skip any input section with errors.
6696         * output.cc (Output_section::Output_section): Initialize
6697         always_keeps_input_sections_ to false.
6698         (Output_section::add_input_section): Check for
6699         always_keeps_input_sections_.
6700         *  output.h (Output_section::always_keeps_input_sections,
6701         Output_section::set_always_keeps_input_sections): New methods.
6702         (Output_section::always_keeps_input_sections): New data member.
6703
6704 2010-07-13  Rafael Espindola  <espindola@google.com>
6705
6706         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6707         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6708
6709 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6710             Ian Lance Taylor  <iant@google.com>
6711
6712         * output.h (Output_section_lookup_maps::add_merge_section):
6713         Correct check of whether value was inserted.
6714         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6715         (Output_section_lookup_maps::add_relaxed_input_section):
6716         Likewise.
6717         * arm.cc (Target_arm::got_section): Remove used local os.
6718         * i386.cc (Target_i386::got_section): Likewise.
6719         * x86_64.cc (Target_x86_64::got_section): Likewise.
6720         * sparc.cc (Target_sparc::got_section): Likewise.
6721         (Target_sparc::relocate): Remove unused local have_got_offset.
6722         * powerpc.cc (Target_powerpc::relocate): Likewise.
6723
6724 2010-07-13  Ian Lance Taylor  <iant@google.com>
6725
6726         * compressed_output.cc (zlib_decompress): Fix signature in
6727         !HAVE_ZLIB_H case.
6728
6729         * archive.cc (Archive::include_member): Unlock an external member
6730         of a thin archive.  Don't bother to delete an object we know is
6731         NULL.
6732
6733 2010-07-12  Cary Coutant  <ccoutant@google.com>
6734
6735         * compressed_output.cc (zlib_decompress): New function.
6736         (get_uncompressed_size): New function.
6737         (decompress_input_section): New function.
6738         * compressed_output.h (get_uncompressed_size): New function.
6739         (decompress_input_section): New function.
6740         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6741         Handle compressed debug sections.
6742         * layout.cc (is_compressed_debug_section): New function.
6743         (Layout::output_section_name): Map compressed section names to
6744         canonical names.
6745         * layout.h (is_compressed_debug_section): New function.
6746         (is_debug_info_section): Recognize compressed debug sections.
6747         * merge.cc: Include compressed_output.h.
6748         (Output_merge_data::do_add_input_section): Handle compressed
6749         debug sections.
6750         (Output_merge_string::do_add_input_section): Handle compressed
6751         debug sections.
6752         * object.cc: Include compressed_output.h.
6753         (Sized_relobj::Sized_relobj): Initialize new data members.
6754         (build_compressed_section_map): New function.
6755         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6756         * object.h (Object::section_is_compressed): New method.
6757         (Object::do_section_is_compressed): New method.
6758         (Sized_relobj::Compressed_section_map): New type.
6759         (Sized_relobj::do_section_is_compressed): New method.
6760         (Sized_relobj::compressed_sections_): New data member.
6761         * output.cc (Output_section::add_input_section): Handle compressed
6762         debug sections.
6763         * reloc.cc: Include compressed_output.h.
6764         (Sized_relobj::write_sections): Handle compressed debug sections.
6765
6766 2010-07-08  Cary Coutant  <ccoutant@google.com>
6767
6768         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6769         weak when resolving to a dynamic def.
6770         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6771         for weak undef/dynamic def cases. Adjust callers.
6772         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6773         undef_binding_weak_.
6774         (Symbol_table::sized_write_globals): Adjust symbol binding.
6775         (Symbol_table::sized_write_symbol): Add binding parameter.
6776         * symtab.h (Symbol::set_undef_binding): New method.
6777         (Symbol::is_undef_binding_weak): New method.
6778         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6779         (Symbol_table::should_override): Add new parameter.
6780         (Symbol_table::sized_write_symbol): Add new parameter.
6781
6782         * testsuite/weak_undef_file1.cc: Add new test case.
6783         * testsuite/weak_undef_file2.cc: Fix header comment.
6784         * testsuite/weak_undef_test.cc: Add new test case.
6785
6786 2010-06-29  Doug Kwan  <dougkwan@google.com>
6787
6788         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6789         Initialize USE_SYMBOL_.
6790         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6791         definition.
6792         (Arm_reloc_property::uses_symbol_): New data member declaration.
6793         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6794         uses symbol value and symbol is undefined but not weakly undefined.
6795
6796 2010-06-28  Rafael Espindola  <espindola@google.com>
6797
6798         * plugin.cc (Plugin::load): Use dlerror.
6799
6800 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6801
6802         * symtab.cc (detect_odr_violations): When reporting an ODR
6803         violation, report an object where the symbol is defined.
6804
6805 2010-06-25  Doug Kwan  <dougkwan@google.com>
6806
6807         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6808         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6809         definition.
6810         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6811         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6812         target hook to detect function points.
6813         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6814         * icf.h (Icf::check_section_for_function_pointers): Change type of
6815         parameter SECTION_NAME to const reference to std::string.  Use
6816         target hook to determine if section may have unsafe pointers.
6817         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6818         method definition.
6819
6820 2010-06-21  Rafael Espindola  <espindola@google.com>
6821
6822         * fileread.cc (Input_file::find_fie): New
6823         (Input_file::open): Use Input_file::find_fie.
6824         * fileread.h (Input_file::find_fie): New
6825         * plugin.cc (set_extra_library_path): New.
6826         (Plugin::load): Add set_extra_library_path to the transfer vector.
6827         (Plugin_manager::set_extra_library_path): New.
6828         (Plugin_manager::add_input_file): Use the extra search path if set.
6829         (set_extra_library_path(): New.
6830         * plugin.h (Plugin_manager): Add set_extra_library_path and
6831         extra_search_path_.
6832
6833 2010-06-19  Cary Coutant  <ccoutant@google.com>
6834
6835         * layout.cc (gdb_sections): Add .debug_types.
6836         (lines_only_debug_sections): Likewise.
6837
6838 2010-06-18  Rafael Espindola  <espindola@google.com>
6839
6840         * plugin.cc (add_input_file,add_input_library)
6841         (Plugin_manager::add_input_file): Make filename arguments const.
6842         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6843         const.
6844
6845 2010-06-16  Doug Kwan  <dougkwan@google.com>
6846
6847         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6848         .ARM.attributes section if we have not merged any input
6849         attributes sections.
6850
6851 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6852
6853         * arm.cc: Allow combining objects with no EABI version
6854         information.
6855
6856 2010-06-15  Rafael Espindola  <espindola@google.com>
6857
6858         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6859
6860 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6861
6862         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6863         (struct iovec): Correct !HAVE_READV definition.
6864
6865 2010-06-10  Cary Coutant  <ccoutant@google.com>
6866
6867         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6868         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6869         reloc sections.
6870         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6871
6872         PR 11683
6873         * symtab.h (Symbol::is_placeholder): New member function.
6874         * target-reloc.h (relocate_section): Check for placeholder symbols.
6875
6876         * testsuite/Makefile.am (plugin_test_8): New test.
6877         (plugin_test_9): New test.
6878         * testsuite/Makefile.in: Regenerate.
6879
6880 2010-06-09  Nick Clifton  <nickc@redhat.com>
6881
6882         * yyscript.y (input_list_element): Allow strings prefixed with
6883         the '-' character.  Treat these as libraries.
6884         * script.cc (script_add_library): New function.  Adds a library
6885         specified by "-l<name>" found in an input script.
6886         * script-c.h: Add prototype for script_add_library.
6887
6888 2010-06-07  Doug Kwan  <dougkwan@google.com>
6889
6890         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6891         Restrict stub-group size to be within long conditional branch
6892         range when working around cortex-A8 erratum.
6893
6894 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6895
6896         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6897         #ifdef typo.
6898
6899 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6900
6901         PR gold/11658
6902         * output.cc
6903         (Output_section::Input_section_sort_entry::compare_section_ordering):
6904         Change to return non-zero correctly.
6905         (Output_section::Input_section_sort_section_order_index_compare
6906         ::operator()): Change to fix ambiguity in comparisons.
6907
6908 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6909
6910         * gold.h (is_wildcard_string): New function.
6911         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6912         (Layout::layout_eh_frame): Ditto.
6913         (Layout::find_section_order_index): New method.
6914         (Layout::read_layout_from_file): New method.
6915         * layout.h (Layout::find_section_order_index): New method.
6916         (Layout::read_layout_from_file): New method.
6917         (Layout::input_section_position_): New private member.
6918         (Layout::input_section_glob_): New private member.
6919         * main.cc (main): Call read_layout_from_file here.
6920         * options.h (--section-ordering-file): New option.
6921         * output.cc (Output_section::input_section_order_specified_): New
6922         member.
6923         (Output_section::Output_section): Initialize new member.
6924         (Output_section::add_input_section): Add new parameter.
6925         Keep input sections when --section-ordering-file is used.
6926         (Output_section::set_final_data_size): Sort input sections when
6927         section ordering file is specified.
6928         (Output_section::Input_section_sort_entry): Add new parameter.
6929         Check sorting type.
6930         (Output_section::Input_section_sort_entry::compare_section_ordering):
6931         New method.
6932         (Output_section::Input_section_sort_compare::operator()): Change to
6933         consider section_order_index.
6934         (Output_section::Input_section_sort_init_fini_compare::operator()):
6935         Change to consider section_order_index.
6936         (Output_section::Input_section_sort_section_order_index_compare
6937         ::operator()): New method.
6938         (Output_section::sort_attached_input_sections): Change to sort
6939         according to section order when specified.
6940         (Output_section::add_input_section<32, true>): Add new parameter.
6941         (Output_section::add_input_section<64, true>): Add new parameter.
6942         (Output_section::add_input_section<32, false>): Add new parameter.
6943         (Output_section::add_input_section<64, false>): Add new parameter.
6944         * output.h (Output_section::add_input_section): Add new parameter.
6945         (Output_section::input_section_order_specified): New
6946         method.
6947         (Output_section::set_input_section_order_specified): New method.
6948         (Input_section::Input_section): Initialize section_order_index_.
6949         (Input_section::section_order_index): New method.
6950         (Input_section::set_section_order_index): New method.
6951         (Input_section::section_order_index_): New member.
6952         (Input_section::Input_section_sort_section_order_index_compare): New
6953         struct.
6954         (Output_section::input_section_order_specified_): New member.
6955         * script-sections.cc (is_wildcard_string): Delete and move modified
6956         method to gold.h.
6957         (Output_section_element_input::Output_section_element_input): Modify
6958         call to is_wildcard_string.
6959         (Output_section_element_input::Input_section_pattern
6960         ::Input_section_pattern): Ditto.
6961         (Output_section_element_input::Output_section_element_input): Ditto.
6962         * testsuite/Makefile.am (final_layout): New test case.
6963         * testsuite/Makefile.in: Regenerate.
6964         * testsuite/final_layout.cc: New file.
6965         * testsuite/final_layout.sh: New file.
6966
6967 2010-06-01  Rafael Espindola  <espindola@google.com>
6968
6969         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6970
6971 2010-06-01  Rafael Espindola  <espindola@google.com>
6972
6973         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6974         visibility of symbols.
6975
6976 2010-05-27  Doug Kwan  <dougkwan@google.com>
6977
6978         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6979         from start of output section instead of address for a local symbol
6980         in a merged or relaxed section when doing a relocatable link.
6981
6982 2010-05-26  Rafael Espindola  <espindola@google.com>
6983
6984         PR 11604
6985         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6986         adding sections the garbage collector removed.
6987         * gold/testsuite/Makefile.am: Add test.
6988         * gold/testsuite/Makefile.in: Regenerate.
6989         * gold/testsuite/plugin_test_7.sh: New.
6990         * gold/testsuite/plugin_test_7_1.c: New.
6991         * gold/testsuite/plugin_test_7_2.c: New.
6992
6993 2010-05-26  Rafael Espindola  <espindola@google.com>
6994
6995         * script-sections.cc (Output_section_definition::set_section_addresses):
6996         Check for --section-start.
6997
6998 2010-05-26  Doug Kwan  <dougkwan@google.com>
6999
7000         * arm.cc (Arm_scan_relocatable_relocs): New class.
7001         (Target_arm::relocate_special_relocatable): New method.
7002         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7003         (Arm_relocate_functions::thumb_branch_common): Same.
7004         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7005         instead of Default_scan_relocatable_relocs.
7006         * target-reloc.h (relocate_for_relocatable): Let target handle
7007         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7008         * target.h (Sized_target::relocate_special_relocatable): New method.
7009
7010 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7011
7012         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7013
7014 2010-05-23  Doug Kwan  <dougkwan@google.com>
7015
7016         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7017         instead of a cast.
7018         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7019         with a direct branch, not a conditional branch, to a stub.
7020         * merge.cc (Output_merge_base::record_input_section): New method
7021         defintion.
7022         (Output_merge_data::do_add_input_section): Record input section if
7023         keeps-input-sections flag is set.
7024         (Output_merge_string::do_add_input_section): Ditto.
7025         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7026         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7027         INPUT_SECTIONS_.
7028         (Output_merge_base::keeps_input_sections,
7029         Output_merge_base::set_keeps_input_sections,
7030         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7031         method definitions.
7032         (Output_merge_base::Input_sections): New type declaration.
7033         (Output_merge_base::input_sections_begin,
7034         Output_merge_base::input_sections_end,
7035         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7036         (Output_merge_base::bool keeps_input_sections_,
7037         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7038         Output_merge_base::input_sections_): New data members.
7039         (Output_merge_data::do_set_keeps_input_sections): New method
7040         defintion.
7041         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7042         * output.cc (Output_section::Input_section::relobj): Move method
7043         defintion from class declaration to here and handle merge sections.
7044         (Output_section::Input_section::shndx): Ditto.
7045         (Output_section::Output_section): Remove initializations of removed
7046         data members and initialize new data member LOOKUP_MAPS_.
7047         (Output_section::add_input_section): Set keeps-input-sections flag
7048         for a newly created merge output section as appropriate.  Adjust code
7049         to use Output_section_lookup_maps class.
7050         (Output_section::add_relaxed_input_section): Adjst code for lookup
7051         maps code refactoring.
7052         (Output_section::add_merge_input_section): Add a new parameter
7053         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7054         class.  If adding input section to a newly created merge output
7055         section fails, remove the new merge section.
7056         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7057         Adjust code for use of the Output_section_lookup_maps class.
7058         (Output_section::find_merge_section): Ditto.
7059         (Output_section::build_lookup_maps): New method defintion.
7060         (Output_section::find_relaxed_input_section): Adjust code to use
7061         Output_section_lookup_maps class.
7062         (Output_section::get_input_sections): Export merge sections.  Adjust
7063         code to use Output_section_lookup_maps class.
7064         (Output_section:::add_script_input_section): Adjust code to use
7065         Output_section_lookup_maps class.  Update lookup maps for merge
7066         sections also.
7067         (Output_section::discard_states): Use Output_section_lookup_maps.
7068         (Output_section::restore_states): Same.
7069         * output.h (Merge_section_properties): Move class defintion out of
7070         Output_section.
7071         (Output_section_lookup_maps): New class.
7072         (Output_section::Input_section::is_merge_section): New method
7073         defintion.
7074         (Output_section::Input_section::relobj): Move defintion out of class
7075         defintion.  Declare method only.
7076         (Output_section::Input_section::shndx): Ditto.
7077         (Output_section::Input_section::output_merge_base): New method defintion.
7078         (Output_section::Input_section::u2_.pomb): New union field.
7079         (Output_section::Merge_section_by_properties_map,
7080         Output_section::Output_section_data_by_input_section_map,
7081         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7082         Remove types.
7083         (Output_section::add_merge_input_section): Add new parameter
7084         KEEPS_INPUT_SECTIONS.
7085         (Output_section::build_lookup_maps): New method declaration.
7086         (Output_section::merge_section_map_,
7087         Output_section::merge_section_by_properties_map_,
7088         Output_section::relaxed_input_section_map_,
7089         Output_section::is_relaxed_input_section_map_valid_): Remove data
7090         members.
7091         (Output_section::lookup_maps_): New data member.
7092
7093 2010-05-21  Doug Kwan  <dougkwan@google.com>
7094
7095         PR gold/11619
7096         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7097         avoid a compilation error.
7098
7099 2010-05-19  Rafael Espindola  <espindola@google.com>
7100
7101         * script-sections.cc (Output_section_definition::allocate_to_segment):
7102         Update the phdrs_list even when the output section is NULL.
7103         * testsuite/Makefile.am: Add test.
7104         * testsuite/Makefile.in: Regenerate.
7105         * testsuite/script_test_9.cc: New.
7106         * testsuite/script_test_9.sh: New.
7107         * testsuite/script_test_9.t: New.
7108
7109 2010-05-19  Doug Kwan  <dougkwan@google.com>
7110
7111         * arm.cc (Arm_input_section::original_size): New method.
7112         (Arm_input_section::do_addralign): Add a cast.
7113         (Arm_input_section::do_output_offset): Remove static cast.
7114         (Arm_input_section::original_addralign,
7115          Arm_input_section::original_size_): Change type to uint32_t.
7116         (Arm_input_section::init): Add safe casts for section alignment
7117         and size.
7118         (Arm_input_section::set_final_data_size): Do not set address and
7119         offset of stub table.
7120         (Arm_output_section::fix_exidx_coverage): Change use of of
7121         Output_section::Simple_input_section to that of
7122         Output_section::Input_section.
7123         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7124         except for the first pass.
7125         * output.cc (Output_section::get_input_sections): Change type of
7126         input_sections to std::list<Input_section>.
7127         (Output_section::add_script_input_section): Rename from
7128         Output_section::add_simple_input_section.  Change type of SIS
7129         parameter from Simple_input_section to Input_section.
7130         * output.h (Output_section::Simple_input_section): Remove class.
7131         (Output_section::Input_section): Change class visibility to public.
7132         (Output_section::Input_section::addralign): Use stored alignments
7133         for special input sections if set.
7134         (Output_section::Input_section::set_addralign): New method.
7135         (Output_section::get_input_sections): Change parameter type from
7136         list of Simple_input_section to list of Input_section.
7137         (Output_section::add_script_input_section): Rename from
7138         Output_section::add_simple_input_section. Change first parameter's
7139         type from Simple_input_section to Input_section and remove the
7140         second and third parameters.
7141         * script-sections.cc (Input_section::Input_section_list): Change
7142         type to list of Output_section::Input_section/
7143         (Input_section_info::Input_section_info): Change parameter type of
7144         INPUT_SECTION to Output_section::Input_section.
7145         (Input_section_info::input_section): Change return type.
7146         (Input_section_info::input_section_): Change type to
7147         Output_section::Input_section.
7148         (Output_section_element_input::set_section_addresses): Adjust code
7149         to use Output_section::Input_section instead of
7150         Output_section::Simple_input_section.  Adjust code for renaming
7151         of Output_section::add_simple_input_section.
7152         (Orphan_output_section::set_section_addresses): Ditto.
7153
7154 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7155
7156         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7157         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7158
7159 2010-05-18  Rafael Espindola  <espindola@google.com>
7160
7161         * options.cc (General_options::finalize): Handle -nostdlib.
7162         * options.h (nostdlib): New option.
7163         * script.cc (script_add_search_dir): Handle -nostdlib.
7164
7165 2010-05-12  Doug Kwan  <dougkwan@google.com>
7166
7167         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7168         attributes section only if there no attributes section after merging.
7169         (Target_arm::merge_object_attributes): Move value of
7170         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7171         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7172         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7173         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7174         and arm_attr_merge_7.stdout.
7175         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7176         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7177         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7178         arm_attr_merge_7b.o): New rules.
7179         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7180         arm_attr_merge_7
7181         * testsuite/Makefile.in: Regenerate.
7182         * testsuite/arm_attr_merge.sh: New file.
7183         * testsuite/arm_attr_merge_[67][ab].s: Same.
7184
7185 2010-05-05  Nick Clifton  <nickc@redhat.com>
7186
7187         * po/es.po: Updated Spanish translation.
7188
7189 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7190
7191         * Makefile.am (install-exec-local): Properly install gold as
7192         default cross linker.
7193         * Makefile.in: Regenerated.
7194
7195 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7196             Nick Clifton  <nickc@redhat.com>
7197
7198         * configure.ac (install_as_default): Define and set to false
7199         unless --enable-gold or --enable-gold=both/gold has been
7200         specified.
7201         * configure: Regenerate.
7202
7203         * Makefile.am (install-exec-local): Install the executable as
7204         'ld.gold'.  If install_as_default is true then also install it as
7205         'ld'.
7206         * Makefile.in: Regenerated.
7207
7208 2010-04-24  Ian Lance Taylor  <iant@google.com>
7209
7210         * layout.cc (Layout::layout_reloc): In relocatable link don't
7211         combine reloc sections for grouped sections.
7212
7213 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7214
7215         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7216         sections that are not ordinary to icf.
7217         * icf.cc (get_section_contents): Handle relocation pointing to section
7218         with no object or shndx information.
7219         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7220         * testsuite/Makefile.in: Regenerate.
7221         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7222         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7223
7224 2010-04-22  Ian Lance Taylor  <iant@google.com>
7225
7226         * expression.cc (Expression::Expression_eval_info): Add
7227         result_alignment_pointer field.
7228         (Expression::eval_with_dot): Add result_alignment_pointer
7229         parameter.  Change all callers.
7230         (Expression::eval_maybe_dot): Likewise.
7231         (class Binary_expression): Add alignment_pointer parameter to
7232         left_value and right_value.  Change all callers.
7233         (BINARY_EXPRESSION): Set result alignment.
7234         (class Trinary_expression): Add alignment_pointer parameter to
7235         arg2_value and arg3_value.  Change all callers.
7236         (Trinary_cond::value): Set result alignment.
7237         (Max_expression::value, Min_expression::value): Likewise.
7238         (Align_expression::value): Likewise.
7239         * script-sections.cc (class Sections_element): Add dot_alignment
7240         parameter to set_section_addresses virtual function.  Update
7241         instantiations.
7242         (class Output_section_element): Likewise.
7243         (Script_sections::create_segments): Add dot_alignment parameter.
7244         Change all callers.
7245         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7246         (Script_sections::set_phdrs_clause_addresses): Likewise.
7247         * script-sections.h: Update declarations.
7248         * script.h: Update declarations.
7249         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7250         min_p_align.
7251         * testsuite/script_test_3.t: Set large alignment.
7252         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7253         segment has expected alignment.
7254
7255 2010-04-22  Nick Clifton  <nickc@redhat.com>
7256
7257         * po/gold.pot: Updated by the Translation project.
7258         * po/vi.po: Updated Vietnamese translation.
7259
7260 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7261
7262         * testsuite/Makefile.am (check_PROGRAMS): Add
7263         icf_virtual_function_folding_test.
7264         * testsuite/Makefile.in: Regenerated.
7265
7266 2010-04-15  Andrew Haley  <aph@redhat.com>
7267
7268         * options.h (merge_exidx_entries): New option.
7269         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7270         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7271         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7272         (Target_arm::merge_exidx_entries): New function.
7273         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7274         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7275         to Arm_exidx_fixup constructor.
7276         Add new arg, merge_exidx_entries.
7277         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7278         Arm_output_section::fix_exidx_coverage.
7279
7280 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7281
7282         * icf.cc (get_section_contents): Check for preemptible functions.
7283         Ignore addend when appropriate.
7284         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7285         section folded.
7286         (add_from_relobj): Check for section folded.
7287         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7288         * symtab.h (should_add_dynsym_entry): Add new parameter.
7289         * target-reloc.h (scan_relocs): Check for section folded.
7290         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7291         Check reloc types for function pointers in shared objects.
7292         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7293         case.
7294         (icf_preemptible_functions_test): New test case.
7295         (icf_string_merge_test): New test case.
7296         * testsuite.Makefile.in: Regenerate.
7297         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7298         bar_glob.  Refactor code.
7299         * testsuite/icf_preemptible_functions_test.cc: New file.
7300         * testsuite/icf_preemptible_functions_test.sh: New file.
7301         * testsuite/icf_string_merge_test.cc: New file.
7302         * testsuite/icf_string_merge_test.sh: New file.
7303         * testsuite/icf_virtual_function_folding_test.cc: New file.
7304         * testsuite/icf_virtual_function_folding_test.sh: New file.
7305
7306 2010-04-14  Doug Kwan  <dougkwan@google.com>
7307
7308         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7309         for local symbol recounting if we remove a section due to ICF.
7310         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7311         there are no regular objects in input.
7312
7313 2010-04-13  Doug Kwan  <dougkwan@google.com>
7314
7315         * arm.cc (Arm_input_section::set_final_data_size): Compute
7316         accurate final data size instead of using current data size.
7317
7318 2010-04-09  Doug Kwan  <dougkwan@google.com>
7319
7320         * layout.cc (Layout::choose_output_section): Handle script section
7321         types.
7322         (Layout::make_output_section_for_script): Add section type parameter.
7323         Handle script section types.
7324         * layout.h (Layout::make_output_section_for_script): Add section
7325         type parameter.
7326         * output.cc (Output_section::Output_section): Initialize data member
7327         is_noload_.
7328         (Output_section::do_reset_address_and_file_offset): Do not set address
7329         to 0 if section is a NOLOAD section.
7330         * output.h (Output_section::is_noload): New method.
7331         (Output_section::set_is_noload): Ditto.
7332         (Output_section::is_noload_): New data member.
7333         * script-c.h (Script_section_type): New enum type.
7334         (struct Parser_output_section_header): Add new file section_type.
7335         * script-sections.cc (Sections_element::output_section_name): Add
7336         parameter for returning script section type.
7337         (Output_section_definition::output_section_name): Ditto.
7338         (Output_section_definition::section_type)P; New method.
7339         (Output_section_definiton::script_section_type_name): Ditto.
7340         (Output_section_definition::script_section_type_): New data member.
7341         (Output_section_definition::Output_section_definition): Initialize
7342         data member Output_section_definition::script_section_type_.
7343         (Output_section_definition::create_sections): Pass script section type
7344         to Layout::make_output_section_for_script.
7345         (Output_section_definition::output_section_name): Return script
7346         section type to caller.
7347         (Output_section_definition::set_section_address): Do not advance
7348         dot value and load address if section type is NOLOAD.  Set address
7349         of NOLOAD sections regardless of section flags.
7350         (Output_section_definition::print): Print section type if it is
7351         not SCRIPT_SECTION_TYPE_NONE.
7352         (Output_section_definition::section_type): New method.
7353         (Output_section_definition::script_section_type_name): Ditto.
7354         (Script_sections::output_section_name): Add new parameter
7355         PSECTION_TYPE for returning script section type.  Pass it to
7356         section elements.  Handle discard sections.
7357         (Sort_output_sections::operator()): Handle NOLOAD sections.
7358         * script-sections.h (Script_sections::Section_type): New enum type.
7359         (Script_sections::output_section_name): Add a new parameter for
7360         returning script section type.
7361         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7362         INFO and NOLOAD.
7363         * yyscript.y (union): Add new field SECTION_TYPE.
7364         (COPY, DSECT, INFO, NOLOAD): New tokens.
7365         (opt_address_and_section_type): Change type to output_section_header.
7366         (section_type): New non-terminal
7367         (section_header): Handle section type.
7368         (opt_address_and_section_type): Return section type value.
7369
7370 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7371
7372         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7373         * testsuite/plugin_common_test_2.c (foo): Likewise.
7374
7375 2010-04-08  Doug Kwan  <dougkwan@google.com>
7376
7377         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7378         Output_merge_data.
7379         * output.cc (Output_section::add_merge_input_section): Simplify
7380         code and return status of Output_merge_base::add_input_section.
7381         Update merge section map only if Output_merge_base::add_input_section
7382         returns true.
7383
7384 2010-04-07  Doug Kwan  <dougkwan@google.com>
7385
7386         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7387         if section is marked as containing instructions but has no mapping
7388         symbols.
7389         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7390         correct section index.
7391         (Arm_relobj::find_linked_text_section): Ditto.
7392
7393 2010-04-07  Cary Coutant  <ccoutant@google.com>
7394
7395         * archive.cc (include_member): Destroy Read_symbols_data object before
7396         releasing file.
7397         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7398         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7399         (Read_symbols_data::~Read_symbols_data) New destructor.
7400         (Section_relocs::Section_relocs) New constructor.
7401         (Section_relocs::~Section_relocs) New destructor.
7402         (Read_relocs_data::Read_relocs_data) New constructor.
7403         (Read_relocs_data::~Read_relocs_data) New destructor.
7404         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7405         pointers to NULL after deleting.
7406
7407 2010-04-07  Doug Kwan  <dougkwan@google.com>
7408
7409         * arm.cc: Replace "endianity" with "endianness" in comments.
7410         (Arm_exidx_cantunwind): Ditto.
7411         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7412         (Arm_relobj::merge_flags_and_attributes): New method.
7413         (Arm_relobj::merge_flags_and_attributes_): New data member.
7414         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7415         (Arm_relobj::scan_sections_for_stubs): Ditto.
7416         (Arm_relobj::do_read_symbols): Check to see if we really want to
7417         merge processor-specific flags and attributes.  Exit early if
7418         an object is empty except for section names and the undefined symbol.
7419         (Target_arm::do_finalize_sections): Move check for ELF format to
7420         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7421         attributes from a regular object only when we have determined that
7422         it is aapropriate.  Do not create an .ARM.attributes section in
7423         output if there is no regular input object.
7424         (Target_arm::merge_processor_specific_flags): Check
7425         --warn-mismatch before printing any error.
7426         (Target_arm::merge_object_attributes): Ditto.
7427         * gold.cc (queue_middle_tasks): Handle the case in which there is
7428         no regular object in input.
7429         * options.cc (General_options::parse_EB): New method.
7430         (General_options::parse_EL): Same.
7431         (General_options::General_options): Initialize endianness_.
7432         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7433         New options.
7434         (General_options::Endianness): New enum.
7435         (General_options::endianness): New method.
7436         (General_options::endianness_): New data member.
7437         * parameters.cc (Parameters::set_options): Check target endianness.
7438         (Parameters::set_target_once): Ditto.
7439         (Parameters::check_target_endianness): New method.
7440         (parameters_force_valid_target): If either -EL or -EB is specified,
7441         use it to define endianness of default target.
7442         * parameters.h (Parameters::check_target_endianness): New method
7443         declaration.
7444         * target.h (class Target): Change "endianity" to "endianness"
7445         in comments.
7446
7447 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7448
7449         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7450         * configure: Regenerate.
7451         * Makefile.in: Regenerate.
7452         * testsuite/Makefile.in: Regenerate.
7453
7454 2010-04-06  Cary Coutant  <ccoutant@google.com>
7455
7456         gcc PR lto/42757
7457         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7458         prevailing definitions of common symbols.
7459         * testsuite/plugin_test_6.sh: New test case.
7460         * testsuite/plugin_common_test_1.c: New test case.
7461         * testsuite/plugin_common_test_2.c: New test case.
7462         * testsuite/Makefile.am (plugin_test_6): New test case.
7463         * testsuite/Makefile.in: Regenerate.
7464
7465 2010-04-06  Nick Clifton  <nickc@redhat.com>
7466
7467         * po/vi.po: New Vietnamese translation.
7468
7469 2010-03-30  Doug Kwan  <dougkwan@google.com>
7470
7471         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7472
7473 2010-03-25  Doug Kwan  <dougkwan@google.com>
7474
7475         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7476         to avoid a conversion warning on a 32-bit host.
7477
7478 2010-03-24  Ian Lance Taylor  <iant@google.com>
7479
7480         * testsuite/script_test_3.t: Add a TLS segment.
7481         * testsuite/Makefile.am (check_PROGRAMS): Add
7482         tls_phdrs_script_test.
7483         (tls_phdrs_script_test_SOURCES): Define.
7484         (tls_phdrs_script_test_DEPENDENCIES): Define.
7485         (tls_phdrs_script_test_LDFLAGS): Define.
7486         (tls_phdrs_script_test_LDADD): Define.
7487         * testsuite/Makefile.in: Rebuild.
7488
7489 2010-03-23  Cary Coutant  <ccoutant@google.com>
7490
7491         * fileread.cc (find_or_make_view): Fix comment.
7492
7493 2010-03-23  Ian Lance Taylor  <iant@google.com>
7494
7495         * script-sections.cc (class Orphan_section_placement): Define
7496         PLACE_TLS and PLACE_TLS_BSS.
7497         (Orphan_section_placement::Orphan_section_placement): Initialize
7498         new places.
7499         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7500         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7501         (tls_script_test_SOURCES): Define.
7502         (tls_script_test_DEPENDENCIES): Define.
7503         (tls_script_test_LDFLAGS): Define.
7504         (tls_script_test_LDADD): Define.
7505         * testsuite/Makefile.in: Rebuild.
7506
7507 2010-03-22  Doug Kwan  <dougkwan@google.com>
7508
7509         * arm.cc (Arm_relocate_functions::abs8,
7510         Arm_relocate_functions::abs16): Use correct check for overflow
7511         specified in the ARM ELF specs.
7512         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7513         target of a BLX instruction specially.
7514         (Reloc_stub::stub_type_for_reloc): Ditto.
7515         (Relocate::relocate): Use symbolic names instead of numeric relocation
7516         codes to report error.
7517         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7518         workaround.
7519         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7520         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7521         thumb2_blx_out_of_range.stdout
7522         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7523         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7524         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7525         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7526         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7527         thumb2_blx_in_range, thumb2_blx_in_range.o,
7528         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7529         thumb2_blx_out_of_range.o): New rules.
7530         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7531         thumb2_blx_in_range and thumb2_blx_out_of_range.
7532         * testsuite/Makefile.in: Regenerate.
7533         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7534         * testsuite/thumb_blx_in_range.s: New file.
7535         * testsuite/thumb_blx_out_of_range.s: New file.
7536
7537 2010-03-22  Rafael Espindola  <espindola@google.com>
7538
7539         * archive.cc (Should_include): Move to archive.h.
7540         (should_include_member): Make it a member of Archive.
7541         (Lib_group): New.
7542         (Add_lib_group_symbols): New.
7543         * archive.h: Include options.h.
7544         (Archive_member): Moved from Archive.
7545         (Should_include): Moved from archive.cc.
7546         (Lib_group): New.
7547         (Add_lib_group_symbols): New.
7548         * dynobj.cc (do_should_include_member): New.
7549         * dynobj.h (do_should_include_member): New.
7550         * gold.cc (queue_initial_tasks): Update call to queue.
7551         * main.cc (main): Print lib group stats.
7552         * object.cc (do_should_include_member): New.
7553         * object.h: Include archive.h.
7554         (Object::should_include_member): New.
7555         (Object::do_should_include_member): New.
7556         (Sized_relobj::do_should_include_member): New.
7557         * options.cc (General_options::parse_start_lib): New.
7558         (General_options::parse_end_lib): New.
7559         (Input_arguments::add_file): Handle lib groups.
7560         (Input_arguments::start_group): Check we are not in a lib.
7561         (Input_arguments::start_lib): New.
7562         (Input_arguments::end_lib): New.
7563         * options.h (General_options): Add start_lib and end_lib.
7564         (Input_argument::lib_): New.
7565         (Input_argument::lib): New.
7566         (Input_argument::is_lib): New.
7567         (Input_file_lib): New.
7568         (Input_arguments::in_lib_): New.
7569         (Input_arguments::in_lib): New.
7570         (Input_arguments::start_lib): New.
7571         (Input_arguments::end_lib_): New.
7572         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7573         in unused members as preempted.
7574         (Sized_pluginobj::do_should_include_member): New.
7575         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7576         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7577         return the blocker.
7578         (Read_symbols::do_whole_lib_group): New.
7579         (Read_symbols::do_lib_group): New.
7580         (Read_symbols::do_read_symbols): Handle lib groups.
7581         (Read_symbols::get_name): Handle lib groups.
7582         * readsyms.h (Read_symbols): Add an archive member pointer.
7583         (Read_symbols::do_whole_lib_group): New.
7584         (Read_symbols::do_lib_group): New.
7585         (Read_symbols::member_): New.
7586         * script.cc (read_input_script): Update call to queue_soon.
7587
7588 2010-03-19  Doug Kwan  <dougkwan@google.com>
7589
7590         * arm.cc (Stub_table::Stub_table): Initialize new data members
7591         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7592         (Stub_table::add_reloc_stub): Assign stub offset and update
7593         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7594         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7595         New data members.
7596         (Stub_table::update_data_size_and_addralign): Use
7597         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7598         instead of going over all reloc stubs.
7599         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7600         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7601         Stringpool_template::offset_ to size of Stringpool_char.
7602         (Stringpool_template::new_key_offset): Remove code to initialize
7603         Stringpool_template::offset_.
7604         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7605         Stringpool_template::offset_ to zero.
7606
7607 2010-03-15  Doug Kwan  <dougkwan@google.com>
7608
7609         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7610         offset_.
7611         (Stringpool_template::new_key_offset): New method.
7612         (Stringpool_template::add_string): Assign offsets when adding new
7613         strings.
7614         (Stringpool_template::set_string_offsets): Do not set string offsets
7615         when not optimizing.
7616         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7617         member size_.
7618         (Chunked_vector::clear): Clear size_.
7619         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7620         (Chunked_vector::size): Return size_.
7621         (Chunked_vector::push_back): Use size_ to find insert position.
7622         (Chunked_vector::size_): New data member.
7623         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7624         (Stringpool_template::new_key_offset): New method declaration.
7625         (Stringpool_template::offset_): New data member.
7626
7627 2010-03-15   Rafael Espindola  <espindola@google.com>
7628
7629         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7630         Add_symbols' constructor.
7631         * readsyms.h (Add_symbols): Remove the input_group member.
7632
7633 2010-03-10  Ian Lance Taylor  <iant@google.com>
7634
7635         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7636         target to ask whether a reference to a symbol requires a stack
7637         split.
7638         * target.h (Target::is_call_to_non_split): New function.
7639         (Target::do_is_call_to_non_split): Declare virtual function.
7640         * target.cc: Include "symtab.h".
7641         (Target::do_is_call_to_non_split): New function.
7642         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7643
7644 2010-03-10  Cary Coutant  <ccoutant@google.com>
7645
7646         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7647         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7648         (File_read::open[2]): Add whole_file_view_ to list of views.
7649         (File_read::make_view): Remove test of whole_file_view_.
7650         (File_read::find_or_make_view): Create whole_file_view_ if
7651         necessary.
7652         (File_read::clear_views): Replace bool parameter with enum;
7653         adjust all callers.  Don't delete views with permanent data;
7654         do delete cached views and views from archives if
7655         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7656         if clearing the corresponding view.
7657         * fileread.h (File_read::Clear_views_mode): New enum.
7658         (File_read::View::is_permanent_view): New method.
7659         (File_read::clear_views): Replace bool parameter
7660         with enum; adjust all callers.
7661         * options.h (General_options): Change keep_files_mapped option;
7662         add map_whole_files.
7663         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7664         releasing the file.
7665         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7666         the file.
7667
7668 2010-03-10  David S. Miller  <davem@davemloft.net>
7669
7670         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7671
7672 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7673
7674         * icf.cc (get_section_contents): Add '@' marker after processing the
7675         merge reloc.
7676
7677 2010-03-08  Doug Kwan  <dougkwan@google.com>
7678
7679         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7680         due to a conversion warning.
7681         (Arm_relobj::update_output_local_symbol_count): Check for local
7682         symbol with unset output index.
7683
7684 2010-03-05  Ian Lance Taylor  <iant@google.com>
7685
7686         * options.h (class General_options): Add --spare-dynamic-tags.
7687         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7688         --spare-dynamic-tags.
7689
7690 2010-03-05  Ian Lance Taylor  <iant@google.com>
7691
7692         * incremental.cc: Include "libiberty.h".
7693
7694 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7695
7696         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7697         function, is_info_ member.
7698         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7699         (Versions::Versions): Update caller.
7700         (Versions::define_base_version): Likewise.
7701         (Versions::add_def): Likewise.
7702
7703 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7704
7705         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7706         (Scan::possible_function_pointer_reloc): New function.
7707         (Scan::local_reloc_may_be_function_pointer): Change to call
7708         possible_function_pointer_reloc.
7709         (Scan::global_reloc_may_be_function_pointer): Ditto.
7710         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7711         relocations in ".data.rel.ro._ZTV" section.
7712         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7713         * testsuite/icf_safe_so_test.cc: Ditto.
7714         * testsuite/icf_safe_test.cc: Ditto.
7715         * testsuite/icf_safe_test.sh: Ditto.
7716
7717 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7718             Ian Lance Taylor  <iant@google.com>
7719
7720         * target-reloc.h (relocate_section): Check the symbol table index
7721         for -1U before setting the local symbol index.
7722         (scan_relocatable_relocs): If copying the relocation, record that
7723         the local symbol is required.
7724         * object.h (Symbol_value::is_output_symtab_index_set): New
7725         function.
7726         (Symbol_value::may_be_discarded_from_output_symtab): New
7727         function.
7728         (Symbol_value::has_output_symtab_entry): New function.
7729         (Symbol_value::needs_output_symtab_entry): Remove.
7730         (Symbol_value::output_symtab_index): Make sure the symbol index is
7731         set.
7732         (Symbol_value::set_output_symtab_index): Make sure the symbol
7733         index is not set.  Make sure the new index is valid.
7734         (Symbol_value::set_must_have_output_symtab_entry): New function.
7735         (Symbol_value::has_output_dynsym_entry): New function.
7736         (Symbol_value::set_output_dynsym_index): Make sure the new index
7737         is valid.
7738         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7739         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7740         local symbol if permitted.
7741         (Sized_relobj::do_finalize_local_symbols): Call
7742         is_output_symtab_index_set rather than needs_output_symtab_entry.
7743         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7744         rather than needs_output_symtab_entry.  Call
7745         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7746         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7747         is_output_symtab_index_set rather than needs_output_symtab_entry.
7748         * testsuite/discard_locals_relocatable_test.c: New file.
7749         * testsuite/discard_locals_test.sh: Test -r.
7750         * testsuite/Makefile.am (check_DATA): Add
7751         discard_locals_relocatable_test1.syms,
7752         discard_local_relocatable_test2.syms.
7753         (MOSTLYCLEANFILES): Likewise.  Also add
7754         discard_locals_relocatable_test1.lout and
7755         discard_locals_relocatable_test2.out.
7756         (discard_locals_relocatable_test1.syms): New target.
7757         (discard_locals_relocatable_test.o): New target.
7758         (discard_locals_relocatable_test1.out): New target.
7759         (discard_locals_relocatable_test2.syms): New target.
7760         (discard_locals_relocatable_test2.out): New target.
7761         (various): Add missing ../ld-new dependencies.
7762         * testsuite/Makefile.in: Rebuild.
7763
7764 2010-03-03  Nick Clifton  <nickc@redhat.com>
7765
7766         * po/fi.po: New Finnish translation.
7767
7768 2010-03-01  Doug Kwan  <dougkwan@google.com>
7769
7770         * layout.cc (Layout::Layout): Force section types of .init_array*,
7771         .preinit_array* and .fini_array* sections.
7772         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7773         Fix check of return value of std::string::find.().
7774         (Output_section::Input_section_sort_compare::operator()): Remove
7775         comment about .init_array.
7776         (Output_section::Input_section_sort_init_fini_compare::operator()):
7777         New method.
7778         (Output_section::sort_attached_input_sections): Handle .init_array
7779         and .fini_array specially.
7780         * output.h (Output_section::Inut_section_sort_compare): Update
7781         comment.
7782         (Output_section::Input_section_sort_init_fini_compare): New struct.
7783
7784 2010-02-26  Doug Kwan  <dougkwan@google.com>
7785
7786         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7787         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7788         * testsuite/debug_msg.sh: Avoid matching source line number for
7789         use of global variable undef_int.
7790
7791 2010-02-26  Doug Kwan  <dougkwan@google.com>
7792
7793         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7794         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7795         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7796         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7797         * options.cc (General_options::General_options): Initialize member
7798         fix_v4bx_.
7799         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7800         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7801         and rm_no_fix_v4bx.stdout
7802         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7803         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7804         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7805         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7806         and arm_no_fix_v4bx.
7807         * Makefile.in: Regenerate.
7808         * testsuite/arm_fix_v4bx.s: New file.
7809         * testsuite/arm_fix_v4bx.sh: Ditto.
7810
7811 2010-02-24  Doug Kwan  <dougkwan@google.com>
7812
7813         * arm.cc (Target_arm::got_section): Make the .got section the first
7814         non RELRO section in the data segment.
7815         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7816         suffixes of section names.
7817
7818 2010-02-24  Doug Kwan  <dougkwan@google.com>
7819
7820         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7821         flags and attributes merging if an input file is a binary file.
7822         * fileread.cc (Input_file::open): Record format of original file.
7823         * fileread.h (Input_file::Format): New enum type.
7824         (Input_file::Input_file): Initialize data member format_.
7825         (Input_file::format): New method definition.
7826         (Input_file::format_):: New data member.
7827
7828 2010-02-24  Doug Kwan  <dougkwan@google.com>
7829
7830         * arm.cc (Arm_output_data_got): New class.
7831         (ARM_TCB_SIZE): New constant
7832         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7833         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7834         If user uses a script with a SECTIONS clause, issue only a warning
7835         for a misplaced EXIDX input section.  Otherwise, issue an error.
7836         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7837         garbage collection.
7838         (Target_arm::got_mode_index_entry): Handle static linking.
7839         (Target_arm::Scan::local): Ditto.
7840         (Target_arm::Scan::global): Ditto.
7841         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7842         all incorrectly implemented relocations.
7843         (Target_arm::fix_exidx_coverage): Pass layout to
7844         Arm_output_section::fix_exidx_coverage.
7845         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7846         from ".ARM.exidx." and ".ARM.extab.".
7847
7848 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7849
7850         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7851         section if it does not already exist.
7852         * attributes.cc (Attributes_section_data::Attributes_section_data):
7853         Don't crash if size is zero.
7854
7855 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7856             Ian Lance Taylor  <iant@google.com>
7857
7858         * gold.cc (queue_middle_tasks): If no input files were opened,
7859         exit.
7860         * workqueue.h (Task_function::Task_function): Assert that there is
7861         a blocker.
7862
7863 2010-02-22  Doug Kwan  <dougkwan@google.com>
7864
7865         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7866         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7867         types to avoid warnings due to different uint64_t implementations
7868         on different hosts.
7869
7870 2010-02-21  Doug Kwan  <dougkwan@google.com>
7871
7872         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7873         handling of the maximum backward branch offset.
7874         (Arm_relocate_functions::thumb_branch_common): Ditto.
7875         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7876         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7877         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7878         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7879         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7880         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7881         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7882         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7883         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7884         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7885         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7886         thumb2_bl_out_of_range.o): New rules.
7887         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7888         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7889         thumb2_bl_out_of_range
7890         * testsuite/Makefile.in: Regenerate.
7891         * testsuite/arm_bl_in_range.s: New file.
7892         * testsuite/arm_bl_out_of_range.s: Ditto.
7893         * testsuite/arm_branch_in_range.sh: Ditto.
7894         * testsuite/arm_branch_range.t: Ditto.
7895         * testsuite/thumb2_branch_range.t: Ditto.
7896         * testsuite/thumb_bl_in_range.s: Ditto.
7897         * testsuite/thumb_bl_out_of_range.s: Ditto.
7898         * testsuite/thumb_branch_range.t: Ditto.
7899
7900 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7901
7902         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7903         Add reloc offset information.
7904         * icf.cc (get_section_contents): Change iterators to point to the new
7905         vectors. Add reloc offset information to the contents.
7906         * icf.h (Icf::Sections_reachable_info): New typedef.
7907         (Icf::Sections_reachable_list): New typedef.
7908         (Icf::Offset_info): New typedef.
7909         (Icf::Reloc_info): New struct typedef.
7910         (Icf::Reloc_info_list): New typedef.
7911         (Icf::symbol_reloc_list): Delete method.
7912         (Icf::addend_reloc_list): Delete method.
7913         (Icf::section_reloc_list): Delete method.
7914         (Icf::reloc_info_list): New method.
7915         (Icf::reloc_info_list_): New member.
7916
7917 2010-02-19  Doug Kwan  <dougkwan@google.com>
7918
7919         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7920         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7921         * arm.cc (Arm_relocation_functions): New forward declaration.
7922         (Target_arm::Target_arm): Initialize new data members
7923         got_mod_index_offset_ and tls_base_symbol_defined_.
7924         (Target_arm::Relocate::relocate_tls): New method.
7925         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7926          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7927         New methods.
7928         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7929         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7930         (Target_arm::got_mod_index_offset_,
7931         Target_arm::tls_base_symbol_defined_): New data members.
7932         (Target_arm::Scan::local, Target::Scan::global,
7933         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7934         relocations.
7935
7936 2010-02-18  Doug Kwan  <dougkwan@google.com>
7937
7938         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7939         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7940         text section as a parameter becuase some broken tools may not set
7941         the link in section header.
7942         (Target_arm::has_got_section): New method.
7943         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7944         without any mapping symbol as data only.  Remove warning.
7945         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7946         link in its section header, try to discover the link by inspecting the
7947         REL31 relocation at the beginning of the section.
7948         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7949         in error message.
7950         (Target_arm::Scan::global): Treat any reference to the symbol
7951         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7952
7953 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7954
7955         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7956         (Scan::global_reloc_may_be_function_pointer): New function.
7957         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7958         (Scan::global_reloc_may_be_function_pointer): New function.
7959         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7960         (Scan::global_reloc_may_be_function_pointer): New function.
7961         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7962         (Scan::global_reloc_may_be_function_pointer): New function.
7963         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7964         (Scan::global_reloc_may_be_function_pointer): New function.
7965         (Scan::possible_function_pointer_reloc): New function.
7966         (Target_x86_64::can_check_for_function_pointers): New function.
7967         * gc.h (gc_process_relocs): Scan relocation types to determine if
7968         function pointers were taken for targets that support it.
7969         * icf.cc (Icf::find_identical_sections): Include functions for
7970         folding in safe ICF whose pointer is not taken.
7971         * icf.h (Secn_fptr_taken_set): New typedef.
7972         (fptr_section_id_): New member.
7973         (section_has_function_pointers): New function.
7974         (set_section_has_function_pointers): New function.
7975         (check_section_for_function_pointers): New function.
7976         * options.h: Fix comment for safe ICF option.
7977         * target.h (can_check_for_function_pointers): New function.
7978         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7979         Modify icf_safe_test for X86-64.
7980         * testsuite/Makefile.in: Regenerate.
7981         * testsuite/icf_safe_so_test.cc: New file.
7982         * testsuite/icf_safe_so_test.sh: New file.
7983         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7984         (main): Change to take pointer to function kept_func_3.
7985         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7986         folding is done correctly for X86-64.
7987
7988 2010-02-12  David S. Miller  <davem@davemloft.net>
7989
7990         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7991         is_symbolless parameter.
7992         (Output_reloc<SHT_REL>::is_symbolless): New.
7993         (Output_reloc<SHT_REL>::is_symbolless_): New.
7994         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7995         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7996         (Output_reloc<SHT_RELA>::is_symbolless): New.
7997         (Output_data_reloc::add_global): Handle is_symbolless.
7998         (Output_data_reloc::add_global_relative): Likewise.
7999         (Output_data_reloc::add_local): Likewise.
8000         (Output_data_reloc::add_local_relative): Likewise.
8001         (Output_data_reloc::add_symbolless_global_addend): New.
8002         (Output_data_reloc::add_symbolless_local_addend): New.
8003         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8004         is_symbolless.
8005         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8006         instead of ->is_relative_
8007         (Output_reloc::write): Likewise.
8008         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8009         (Output_reloc::write_rel): Simplify.
8010
8011         * sparc.cc (Target_sparc::Scan::local): Use
8012         ->add_symbolless_local_addend as needed.
8013         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8014         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8015         based upon relocation offset.
8016
8017 2010-02-11  Doug Kwan  <dougkwan@google.com>
8018
8019         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8020         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8021         beginning of function.
8022         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8023         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8024         parameter is_32bit in calls to should_apply_static_reloc.
8025         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8026         (check_DATA): Add arm_abs_global.stdout.
8027         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8028         arm_abs_global.stdout): New rules.
8029         (MOSTLLYCLEANFILES): Add arm_abs_global
8030         * Makefile.in: Regenerate.
8031         * testsuite/arm_abs_global.s: New file.
8032         * testsuite/arm_abs_global.sh: Ditto.
8033         * testsuite/arm_abs_lib.s: Ditto.
8034
8035 2010-02-11  Ian Lance Taylor  <iant@google.com>
8036
8037         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8038         Read_relocs task.
8039         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8040         Allocate_commons_task first.
8041         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8042         task, rather than symtab_lock_.
8043         (Gc_process_relocs::~Gc_process_relocs): New function.
8044         (Gc_process_relocs::is_runnable): Check this_blocker_.
8045         (Gc_process_relocs::locks): Use next_blocker_ rather than
8046         blocker_.
8047         (Scan_relocs::~Scan_relocs): New function.
8048         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8049         symtab_lock_.
8050         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8051         next_blocker_.
8052         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8053         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8054         constructor accordingly.
8055         (class Gc_process_relocs): Likewise.
8056         (class Scan_relocs): Likewise.
8057         * common.h (class Allocate_commons_task): Remove symtab_lock_
8058         field, and corresponding constructor parameter.
8059         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8060         symtab_lock_.
8061         (Allocate_commons_task::locks): Likewise.
8062
8063 2010-02-11  Ian Lance Taylor  <iant@google.com>
8064
8065         * gold-threads.h (class Once): Define.
8066         (class Initialize_lock): Rewrite as child of Once.
8067         * gold-threads.cc (class Once_initialize): Define.
8068         (once_pointer_control): New static variable.
8069         (once_pointer, once_arg): New static variables.
8070         (c_run_once): New static function.
8071         (Once::Once, Once::run_once, Once::internal_run): New functions.
8072         (class Initialize_lock_once): Remove.
8073         (initialize_lock_control): Remove.
8074         (initialize_lock_pointer): Remove.
8075         (initialize_lock_once): Remove.
8076         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8077         (Initialize_lock::initialize): Rewrite.
8078         (Initialize_lock::do_run_once): New function.
8079         * archive.cc (Archive::interpret_header): Only clear name if it is
8080         not already empty.
8081         * fileread.cc: Include "gold-threads.h"
8082         (file_counts_lock): New static variable.
8083         (file_counts_initialize_lock): Likewise.
8084         (File_read::release): Only increment counts when using --stats.
8085         Use a lock around the increment.
8086         * parameters.cc (class Set_parameters_target_once): Define.
8087         (set_parameters_target_once): New static variable.
8088         (Parameters::Parameters): Move here from parameters.h.
8089         (Parameters::set_target): Rewrite.
8090         (Parameters::set_target_once): New function.
8091         (Parameters::clear_target): Move here and rewrite.
8092         * parameters.h (class Parameters): Update declarations.  Add
8093         set_parameters_target_once_ field.
8094         (Parameters::Parameters): Move to parameters.cc.
8095         (Parameters::clear_target): Likewise.
8096         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8097         task.
8098         (Start_group::~Start_group): New function.
8099         (Start_group::is_runnable): New function.
8100         (Start_group::locks, Start_group::run): New functions.
8101         (Finish_group::run): Change saw_undefined to size_t.
8102         * readsyms.h (class Start_group): Define.
8103         (class Finish_group): Change saw_undefined_ field to size_t.
8104         (Finish_group::Finish_group): Remove saw_undefined and
8105         this_blocker parameters.  Change all callers.
8106         (Finish_group::set_saw_undefined): New function.
8107         (Finish_group::set_blocker): New function.
8108         * symtab.h (class Symbol_table): Change saw_undefined to return
8109         size_t.  Change saw_undefined_ field to size_t.
8110         * target-select.cc (Set_target_once::do_run_once): New function.
8111         (Target_selector::Target_selector): Initialize set_target_once_
8112         field.  Don't initialize lock_ and initialize_lock_ fields.
8113         (Target_selector::instantiate_target): Rewrite.
8114         (Target_selector::set_target): New function.
8115         * target-select.h (class Set_target_once): Define.
8116         (class Target_selector): Update declarations.  Make
8117         Set_target_once a friend.  Remove lock_ and initialize_lock_
8118         fields.  Add set_target_once_ field.
8119
8120 2010-02-10  Ian Lance Taylor  <iant@google.com>
8121
8122         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8123         queueing any tasks.
8124         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8125         (queue_middle_tasks): Add all blockers before queueing any tasks.
8126         (queue_final_tasks): Likewise.
8127         * token.h (Task_token::add_blockers): New function.
8128         * object.h (Input_objects::number_of_relobjs): New function.
8129
8130 2010-02-10  Ian Lance Taylor  <iant@google.com>
8131
8132         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8133         shared, not if not position independent.
8134         * x86_64.cc (Relocate::relocate_tls): Likewise.
8135         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8136         (tls_pie_pic_test): New target.
8137         * testsuite/Makefile.in: Rebuild.
8138
8139         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8140         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8141         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8142         * testsuite/Makefile.in: Rebuild.
8143
8144 2010-02-09  David S. Miller  <davem@davemloft.net>
8145
8146         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8147         R_SPARC_RELATIVE using ->add_local_relative().
8148         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8149
8150         * output.h (Output_data_dynamic::add_section_size): New method
8151         that takes two Output_data objects.
8152         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8153         entry param.  Handle it in initializers.
8154         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8155         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8156         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8157         arg.
8158         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8159         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8160         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8161         for dynrel_includes_plt.
8162         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8163         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8164         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8165         before .rela.plt
8166         (Target_sparc::do_finalize_sections): Update to pass true for
8167         dynrel_includes_plt.
8168         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8169         output before .rela.plt
8170         (Target_powerpc::do_finalize_sections): Update to pass true for
8171         dynrel_includes_plt when 32-bit.
8172
8173 2010-02-08  Doug Kwan  <dougkwan@google.com>
8174
8175         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8176         method.
8177         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8178         Arm_relobj::scan_section_for_cortex_a8_stubs,
8179         Arm_relobj::do_relocation_section): Instead of calling
8180         Output_section::output_address, use faster
8181         Arm_relobj::simple_input_section_output_address.
8182
8183 2010-02-08  David S. Miller  <davem@davemloft.net>
8184
8185         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8186         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8187         relocation helper function.
8188
8189         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8190         just like R_SPARC_GOT{10,13,22}.
8191         (Target_sparc::Scan::local): Likewise.
8192         (Target_sparc::Relocate:relocate): Likewise.
8193
8194 2010-02-06  Ian Lance Taylor  <iant@google.com>
8195
8196         * configure.ac: Rewrite targetobjs duplicate removal code to use
8197         only shell constructs.
8198         * configure: Rebuild.
8199
8200 2010-02-05  Doug Kwan  <dougkwan@google.com>
8201
8202         PR 11247
8203         * arm.cc (Arm_relobj::section_is_scannable): New method.
8204         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8205         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8206
8207 2010-02-04  Doug Kwan  <dougkwan@google.com>
8208
8209         PR 11247
8210         * arm-reloc-property.cc (cstdio): Include.
8211         * configure.ac (targetobjs): Remove duplicates.
8212         * configure: Regenerate.
8213         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8214         big and little endian version for a given address size.
8215
8216 2010-02-03  Doug Kwan  <dougkwan@google.com>
8217
8218         * arm-reloc-property.cc
8219         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8220         definition.
8221         * arm-reloc-property.h
8222         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8223         New method definition.
8224         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8225         declaration.
8226         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8227         overflow to N.
8228         (GOT_PREL): Change implemented to Y.
8229         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8230         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8231         (Arm_relocate_functions::movw_abs_nc): Remove method.
8232         (Arm_relocate_functions::movt_abs): Ditto.
8233         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8234         (Arm_relocate_functions::thm_movt_abs): Ditto.
8235         (Arm_relocate_functions::movw_rel_nc): Ditto.
8236         (Arm_relocate_functions::movw_rel): Ditto.
8237         (Arm_relocate_functions::movt_rel): Ditto.
8238         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8239         (Arm_relocate_functions:thm_movw_rel): Ditto.
8240         (Arm_relocate_functions:thm_movt_rel): Ditto.
8241         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8242         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8243         New method definitions.
8244         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8245         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8246         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8247         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8248         (Target_arm::Relocate::relocate): Check for non-static or
8249         unimplemented relocation code and exit early.  Change calls to
8250         Target_arm::reloc_uses_thumb_bit and
8251         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8252         instead.  Refactor code to handle similar relocations to increase
8253         code sharing.  Remove check for unsupported relocation code in switch
8254         statement.
8255         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8256         relocation property table to find out size.  Change error message to
8257         print out the name of a relocation code instead of the numeric value.
8258         (Target_arm::scan_reloc_for_stub): Use relocation property table
8259         instead of calling Target_arm::reloc_uses_thumb_bit().
8260
8261 2010-02-02  Doug Kwan  <dougkwan@google.com>
8262
8263         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8264         types of relaxed input section.
8265
8266 2010-02-02  Doug Kwan  <dougkwan@google.com>
8267
8268         * Makefile.am (HFILES): Add arm-reloc-property.h.
8269         (DEFFILES): New.
8270         (TARGETSOURCES): Add arm-reloc-property.cc
8271         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8272         (libgold_a_SOURCES): $(DEFFILES)
8273         * Makefile.in: Regenerate.
8274         * arm-reloc-property.cc: New file.
8275         * arm-reloc-property.h: New file.
8276         * arm-reloc.def: New file.
8277         * arm.cc: Update comments.
8278         (arm-reloc-property.h): New included header.
8279         (arm_reloc_property_table): New global variable.
8280         (Target_arm::do_select_as_default_target): New method definition.
8281         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8282         arm-reloc-property to targ_extra_obj.
8283         * parameters.cc (set_parameters_target): Call
8284         Target::select_as_default_target().
8285         * target.h (Target::select_as_default_target): New method definition.
8286         (Target::do_select_as_default_target): Same.
8287
8288 2010-02-01  Doug Kwan  <dougkwan@google.com>
8289
8290         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8291         first_output_text_section_.
8292         (Arm_exidx_fixup::first_output_text_section): New method definition.
8293         (Arm_exidx_fixup::first_output_text_section_): New data member.
8294         (Arm_exidx_fixup::process_exidx_section): Record the first text
8295         output section seen.
8296         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8297         and entsize in output section header.
8298
8299 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8300
8301         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8302         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8303         (Arm_relocate_functions::thm_alu11): New Method.
8304         (Arm_relocate_functions::thm_pc8): New Method.
8305         (Arm_relocate_functions::thm_pc12): New Method.
8306         (Target_arm::Scan::local): Handle the relocations.
8307         (Target_arm::Scan::global): Likewise.
8308         (Target_arm::Relocate::relocate): Likewise.
8309         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8310
8311 2010-01-29  Doug Kwan  <dougkwan@google.com>
8312
8313         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8314         of relocation types as ld.
8315
8316 2010-01-29  Doug Kwan  <dougkwan@google.com>
8317
8318         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8319         to public.
8320         (Arm_relocate_functions::thumb_branch_common): Ditto.
8321         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8322         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8323         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8324         Arm_relocate_functions::jump24): Remove.
8325         (Target_arm::Relocate::relocate): Adjust code to call
8326         Arm_relocation_functions::arm_branch_common and
8327         Arm_relocation_functions::thumb_branch_common instead of their removed
8328         wrappers.  Merge switch-cases together to reduce source code size.
8329
8330 2010-01-29  Doug Kwan  <dougkwan@google.com>
8331
8332         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8333         output_local_symbol_count_needs_update_.
8334         (Arm_relobj::output_local_symbol_count_needs_update,
8335          Arm_relobj::set_output_local_symbol_count_needs_update,
8336          Arm_relobj::update_output_local_symbol_count): New methods.
8337         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8338         member.
8339         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8340         of pointed function as in a R_ARM_PREL31 relocation.
8341         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8342         for output local symbol count updating.
8343         (Target_arm::do_relax): Update output local symbol counts in objects
8344         if necessary.
8345         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8346
8347 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8348
8349         * arm.cc: Added support for the ARM relocations:
8350         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8351         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8352         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8353         movw_prel_nc).
8354         (Arm_relocate_functions::movw_rel): New method.
8355         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8356         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8357         thm_movw_prel_nc).
8358         (Arm_relocate_functions::thm_movw_rel): New method.
8359         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8360         thm_movt_prel).
8361         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8362         relocations.
8363         (Target_arm::Scan::global): Likewise.
8364         (Target_arm::Relocate::relocate): Likewise.
8365         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8366         Likewise.
8367
8368 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8369
8370         * arm.cc: Added support for ARM group relocations.
8371         (Target_arm::reloc_needs_sym_origin): New method.
8372         (Arm_relocate_functions::calc_grp_kn): New method.
8373         (Arm_relocate_functions::calc_grp_residual): New method.
8374         (Arm_relocate_functions::calc_grp_gn): New method.
8375         (Arm_relocate_functions::arm_grp_alu): New Method.
8376         (Arm_relocate_functions::arm_grp_ldr): New Method.
8377         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8378         (Arm_relocate_functions::arm_grp_ldc): New Method.
8379         (Target_arm::Scan::local): Handle the ARM group relocations.
8380         (Target_arm::Scan::global): Likewise.
8381         (Target_arm::Relocate::relocate): Likewise.
8382         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8383         Likewise.
8384
8385 2010-01-26  Doug Kwan  <dougkwan@google.com>
8386
8387         * arm.cc (set): Include.
8388         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8389         pointer type.
8390         (Arm_output_section::Text_section_list): New type.
8391         (Arm_output_section::append_text_sections_to_list): New method.
8392         (Arm_output_section::fix_exidx_coverage): Ditto.
8393         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8394         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8395         Relobj::set_section_offset() instead of
8396         Sized_relobj::invalidate_section_offset().
8397         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8398         parameter for section headers. Ignore relocation sections for
8399         unallocated sections and EXIDX sections.
8400         (Target_arm::fix_exidx_coverage): New method.
8401         (Target_arm::output_section_address_less_than): New type.
8402         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8403         linked text section instead of the EXIDX section.
8404         (Arm_output_section::create_stub_group): Add an assertion to check
8405         that this is not an EXIDX output section.
8406         (Arm_output_section::append_text_sections_to_list): New method.
8407         (Arm_output_section::fix_exidx_coverage): Ditto.
8408         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8409         Arm_relobj::section_needs_reloc_stub_scanning.
8410         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8411         first pass.
8412         (Target_arm::fix_exidx_coverage): New method.
8413         * object.h (Relobj::set_output_section): New method.
8414         (Sized_relobj::invalidate_section_offset): Remove method.
8415         (Sized_relobj::do_invalidate_section_offset): Remove method.
8416         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8417
8418 2010-01-25  Doug Kwan  <dougkwan@google.com>
8419
8420         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8421         Fix warning due to signed and unsigned comparison on a 32-bit host.
8422
8423 2010-01-22  Doug Kwan  <dougkwan@google.com>
8424
8425         * arm.cc (Target_arm::do_relax): Record an output section for section
8426         offset adjustment it contains any stub table that has changed.
8427         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8428         offsets in an output section if necessary.
8429         * output.cc (Output_section::Output_section): Initialize
8430         section_offsets_need_adjustments_.
8431         (Output_section::add_input_section_for_script): Renamed to
8432         Output_section::add_simple_input_section.
8433         (Output_section::save_states): Add a comment.
8434         (Output_section::discard_states): New method defintion.
8435         (Output_section::adjust_section_offsets): Same.
8436         * output.h (Output_section::add_input_section_for_script): Renamed to
8437         Output_section::add_simple_input_section.
8438         (Output_section::discard_states): New method declaration.
8439         (Output_section::adjust_section_offsets): Same.
8440         (Output_section::section_offsets_need_adjustment,
8441         Output_section::set_section_offsets_need_adjustment): New method
8442         definitions.
8443         (Output_section::section_offsets_need_adjustment_): New data member.
8444         * script-sections.cc
8445         (Output_section_element_input::set_section_address): Adjust code for
8446         renaming of Output_section::add_input_section_for_script.
8447         (Orphan_output_section::set_section_address): Same.
8448
8449 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8450
8451         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8452         Fix_v4bx enum values .
8453         * gold/options.h (General_options): New option definitions.
8454         (General_options::fix_v4bx): New method.
8455         (General_options::Fix_v4bx): New enum.
8456         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8457         (General_options::parse_fix_v4bx_interworking): New method.
8458
8459 2010-01-22  Doug Kwan  <dougkwan@google.com>
8460
8461         * arm.cc (Arm_exidx_fixup): New class.
8462
8463 2010-01-21  Doug Kwan  <dougkwan@google.com>
8464
8465         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8466         classes.
8467         (Arm_exidx_section_offset_map): New type.
8468
8469 2010-01-21  Doug Kwan  <dougkwan@google.com>
8470
8471         * arm.cc (Arm_exidx_input_section): New class.
8472         (Arm_relobj::exidx_input_section_by_link,
8473         Arm_relobj::exidx_input_section_by_shndx,
8474         Arm_relobj::make_exidx_input_section): New methods.
8475         (read_arm_attributes_section): Remove.
8476         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8477         information about them.
8478         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8479         to here.
8480
8481 2010-01-20  Doug Kwan  <dougkwan@google.com>
8482
8483         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8484         Input_section_specifier to Section_id.
8485         (Target_arm::new_arm_input_section: Adjust code for change of key
8486         type.
8487         (Target_arm::find_arm_input_section): Ditto.
8488         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8489         (Section_id): Remove.
8490         (Garbage_collection::Section_id_hash): Remove.
8491         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8492         (Section_id): Remove.
8493         (Icf::Section_id_hash): Remove.
8494         * object.h (Section_id, Const_section_id, Section_id_hash,
8495         Const_section_id_hash): New type definitions.
8496         * output.cc (Output_section::add_relaxed_input_section): Change to
8497         use Const_section_id instead of Input_section_specifier as key type.
8498         (Output_section::add_merge_input_section): Ditto.
8499         (Output_section::build_relaxation_map): Change to use Section_id
8500         instead of Input_section_specifier as key type.
8501         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8502         Ditto.
8503         (Output_section::convert_input_sections_to_relaxed_sections): Change
8504         to use Const_section_id instead of Input_section_specifier as key type.
8505         (Output_section::find_merge_section): Ditto.
8506         (Output_section::find_relaxed_input_section): Ditto.
8507         * output.h (Input_section_specifier): Remove class.
8508         (Output_section::Output_section_data_by_input_section_map): Change
8509         key type to Const_section_id.
8510         (Output_section::Output_relaxed_input_section_by_input_section_map):
8511         Ditto.
8512         (Output_section::Relaxation_map): Change key type to Section_id.
8513
8514 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8515
8516         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8517         (class Arm_v4bx_stub): New class.
8518         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8519         (Stub_factory::make_arm_v4bx_stub): New method.
8520         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8521         (Stub_table::empty): Handle v4bx stubs.
8522         (Stub_table::add_arm_v4bx_stub): New method.
8523         (Stub_table::find_arm_v4bx_stub): New method.
8524         (Arm_relocate_functions::v4bx): New method.
8525         (Target_arm::fix_v4bx): New method.
8526         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8527         (Stub_table::relocate_stubs): Likewise.
8528         (Stub_table::do_write): Likewise.
8529         (Stub_table::update_data_size_and_addralign): Likewise.
8530         (Stub_table::finalize_stubs):  Likewise.
8531         (Target_arm::Scan::local): Likewise.
8532         (Target_arm::Scan::global): Likewise.
8533         (Target_arm::do_finalize_sections): Likewise.
8534         (Target_arm::Relocate::relocate): Likewise.
8535         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8536         Likewise.
8537         (Target_arm::scan_reloc_for_stub): Likewise.
8538         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8539
8540 2010-01-19  Ian Lance Taylor  <iant@google.com>
8541
8542         * output.cc (Output_section_headers::do_sized_write): Write large
8543         segment count to sh_info field.
8544         (Output_file_header::do_sized_write): For large segment count,
8545         write PN_XNUM to e_phnum field.
8546
8547 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8548
8549         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8550         (Arm_relocate_functions::thm_jump8): New function.
8551         (Arm_relocate_functions::thm_jump11): New function.
8552         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8553         R_ARM_THM_JUMP11.
8554         (Target_arm::Scan::global): Likewise.
8555         (Target_arm::Relocate::relocate): Likewise.
8556         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8557         Likewise.
8558
8559 2010-01-14  Doug Kwan  <dougkwan@google.com>
8560
8561         * arm.cc (map, utility): Include headers.
8562         (Target_arm::apply_cortex_a8_workaround): New method.
8563         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8564         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8565         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8566         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8567         the --[no-]fix-cortex-a8 command line options.
8568         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8569         (Target_arm::relocate_stub): Use addend in instruction template.
8570         * options.h (DEFINE_bool): Set the user-set flag.
8571         (General_options): Add --[no-]-fix-cortex options.
8572         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8573         : Update fast look-up map after conversion.
8574
8575 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8576
8577         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8578         in the first pass of do_layout.
8579
8580 2010-01-13  Doug Kwan  <dougkwan@google.com>
8581
8582         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8583         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8584         apparent compiler problem of not folding static constant integral
8585         data members of elfcpp::Elf_sizes<32>.
8586
8587 2010-01-13  Doug Kwan  <dougkwan@google.com>
8588
8589         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8590         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8591         Arm_relobj::scan_section_for_cortex_a8_erratum,
8592         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8593         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8594         sections to scan for relocation stubs into a new method
8595         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8596         relocation and Cortex-A8 stub scanning.
8597         (Target_arm::do_relax): Force stubs to be after stubbed sections
8598         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8599         the beginning of a new relaxation pass.  Update a comment.
8600         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8601
8602 2010-01-12  Ian Lance Taylor  <iant@google.com>
8603
8604         * target-reloc.h (visibility_error): New inline function.
8605         (relocate_section): Call visibility_error.
8606         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8607         (MOSTLYCLEANFILES): Likewise.
8608         (protected_4_pic.o, protected_3.err): New targets.
8609         * testsuite/protected_4.cc: New file.
8610
8611 2010-01-12  Doug Kwan  <dougkwan@google.com>
8612
8613         * arm.cc (Cortex_a8_reloc): New class.
8614         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8615         and cortex_a8_relocs_info_.
8616         (Target_arm::fix_cortex_a8): New method definition.
8617         (Target_arm::Cortex_a8_relocs_info): New type.
8618         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8619         New data member declarations.
8620         (Target_arm::scan_reloc_for_stub): Record information about
8621         relocations for THUMB branches that might be exempted from the
8622         Cortex-A8 workaround.
8623         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8624         at the beginning of a relaxation pass.
8625
8626 2010-01-12  Doug Kwan  <dougkwan@google.com>
8627
8628         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8629         (Arm_relobj::Mapping_symbol_position,
8630          Arm_reloj::Mapping_symbol_position_less,
8631          Arm_relobj::Mapping_symbols_info): New types.
8632         (Target_arm::is_mapping_symbol_name): New method definition.
8633         (Arm_relobj::do_count_local_symbols): Save information about mapping
8634         symbols.
8635
8636 2010-01-11  Doug Kwan  <dougkwan@google.com>
8637
8638         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8639         Arm_relocate_functions::thumb32_branch_upper,
8640         Arm_relocate_functions::thumb32_branch_lower,
8641         Arm_relocate_functions::thumb32_cond_branch_offset,
8642         Arm_relocate_functions::thumb32_cond_branch_upper,
8643         Arm_relocate_functions::thumb32_cond_branch_lower,
8644         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8645         branch offset encoding.
8646         (Arm_relocate_functions::thumb_branch_common): Use new branch
8647         offset encoding methods to avoid code duplication.
8648         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8649         (Stub_addend_reader::operator()): Use new branch encoding method
8650         to avoid code duplication.
8651
8652 2010-01-11  Doug Kwan  <dougkwan@google.com>
8653
8654         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8655         (Target_arm::do_finalize_sections): Define special EXIDX section
8656         symbols only if referenced.
8657         * gc.h (Garbage_collection::add_reference): New method.
8658         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8659         code duplication.
8660
8661 2010-01-11  Ian Lance Taylor  <iant@google.com>
8662
8663         * script.cc (Version_script_info::build_expression_list_lookup):
8664         Change complaing about duplicate wildcard match from error to
8665         warning.
8666
8667         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8668         of 2009-12-30.
8669         (Version_script_info::Version_script_info): Initialize globs_,
8670         default_version_, default_is_global_, and exact_.  Don't
8671         initialize globals_ or locals_.
8672         (Version_script_info::build_lookup_tables): Build local symbols
8673         first.
8674         (Version_script_info::unquote): New function.
8675         (Version_script_info::add_exact_match): New function.
8676         (Version_script_info::build_expression_list_lookup): Remove lookup
8677         parameter.  Add is_global parameter.  Change all callers.  Handle
8678         wildcard pattern specially.  Unquote pattern.  Call
8679         add_exact_match.
8680         (Version_script_info::get_name_to_match): New function.
8681         (Version_script_info::get_symbol_version): New function.
8682         (Version_script_info::get_symbol_version_helper): Remove.
8683         (Version_script_info::check_unmatched_names): Call unquote.
8684         * script.h (class Version_script_info): Change get_symbol_version
8685         to be non-inline and add is_global parameter; change all callers.
8686         Rewrite symbol_is_local.  Update declarations.  Define struct
8687         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8688         Remove globals_ and locals_ members.  Add exact_, globs_,
8689         default_version_, is_global_.
8690         (Version_script_info::Glob): Remove pattern, add expression and
8691         is_global.  Update constructor.  Change all callers.
8692         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8693         default version.
8694         (Versions::symbol_section_contents): If a symbol is undefined, or
8695         defined in a dynamic object, set the version index to
8696         VER_NDX_LOCAL.
8697         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8698         symbol_is_local.
8699         (Symbol_table::add_from_pluginobj): Likewise.
8700         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8701
8702 2010-01-11  Doug Kwan  <dougkwan@google.com>
8703
8704         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8705         (incremental_dump_LDADD): Add linking option for libintl.
8706         * Makefile.in: Regenerate.
8707
8708 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8709
8710         PR gold/11144
8711         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8712         instead of -Ds.
8713         * testsuite/Makefile.in: Regenerated.
8714
8715 2010-01-10  Doug Kwan  <dougkwan@google.com>
8716
8717         * options.h (DEFINE_var): Use parentheses around argument varname__
8718         in macro body to avoid any unintended subsequent substitutions.
8719
8720 2010-01-10  Ian Lance Taylor  <iant@google.com>
8721
8722         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8723         candidates before doing symbol resolution.
8724
8725         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8726         ODR candidates if only one is weak.
8727
8728 2010-01-08  Ian Lance Taylor  <iant@google.com>
8729
8730         * script.cc (Version_script_info::build_expression_list_lookup):
8731         Don't warn about ambiguous version, just record the ambiguity.
8732         (Version_script_info::get_symbol_version_helper): Give error if
8733         version is ambiguous.
8734
8735 2010-01-08  Doug Kwan  <dougkwan@google.com>
8736
8737         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8738         prev_data_size_ and prev_addralign_.  Remove initializer for
8739         deleted data member has_been_changed_.
8740         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8741         to determine if the table is empty.
8742         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8743         Remove.
8744         (Stub_table::add_reloc_stub): Define method in class definition
8745         instead of just declaring it there.
8746         (Stub_table::add_cortex_a8_stub): New method definition.
8747         (Stub_table::update_data_size_and_addralign): Ditto.
8748         (Stub_table::finalize_stubs): Ditto.
8749         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8750         (Stub_table::do_addralign_): Return address alignment in the
8751         (Stub_table::do_reset_address_and_file_offset): Define method in
8752         class definition instead of declaring it there.  Set current data
8753         size to be the data size of the previous pass.
8754         (Stub_table::set_final_data_size): Use current data size as the
8755         final data size.
8756         (Stub_table::relocate_stub): Change parameter type of stub from
8757         Reloc_stub pointer to Stub pointer.
8758         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8759         (Stub_table::Cortex_a8_stub_list): New typedef.
8760         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8761          Stub_table::prev_addralign_): New data member.
8762         (Arm_relobj::Arm_relobj): Initialize data member
8763         section_has_cortex_a8_workaround_.
8764         (Arm_relobj::section_has_cortex_a8_workaround,
8765          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8766          definitions.
8767         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8768         declarations.
8769         (Target_arm::relocate_stub): Change parameter type of stub from
8770         Reloc_stub pointer to Stub pointer.
8771         (Insn_template::size, Insn_template::alignment): Handle
8772         THUMB16_SPECIAL_TYPE.
8773         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8774          Stub_table::update_data_size_and_addralign,
8775          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8776         definitions.
8777         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8778         (Stub_table::do_write): Ditto.
8779         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8780
8781 2010-01-08  Ian Lance Taylor  <iant@google.com>
8782
8783         PR 11108
8784         * symtab.h (class Symbol): Remove fields is_target_special_ and
8785         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8786         (Symbol::is_defined_in_discarded_section): New function.
8787         (Symbol::set_is_defined_in_discarded_section): New function.
8788         (Symbol::has_plt_offset): Rewrite.
8789         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8790         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8791         Don't initialize is_target_special_ or has_plt_offset_.
8792         Initialize is_defined_in_discarded_section_.
8793         (Symbol_table::add_from_relobj): If appropriate, set
8794         is_defined_in_discarded_section.
8795         * resolve.cc (Symbol::override_base_with_special): Don't test
8796         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8797         * target-reloc.h (relocate_section): Do special handling for
8798         symbols defined in discarded sections for global symbols as well
8799         as local symbols.
8800
8801 2010-01-08  Ian Lance Taylor  <iant@google.com>
8802
8803         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8804         the SHT_SYMTAB case.
8805
8806 2010-01-08  Ian Lance Taylor  <iant@google.com>
8807
8808         * object.cc (Sized_relobj::do_layout): Don't get confused if
8809         layout_eh_frame returns NULL.
8810
8811 2010-01-08  Ian Lance Taylor  <iant@google.com>
8812
8813         PR 11084
8814         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8815         dynamic symbol table, use the normal symbol table.
8816         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8817         symbol table.
8818
8819 2010-01-08  Ian Lance Taylor  <iant@google.com>
8820
8821         PR 11072
8822         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8823         sections.
8824
8825 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8826
8827         * version.cc (print_version): Change to "Copyright 2010".
8828
8829 2010-01-08  Ian Lance Taylor  <iant@google.com>
8830
8831         PR 10287
8832         PR 11063
8833         * i386.cc (class Target_i386): Change return type of plt_section
8834         to be non-const.
8835         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8836         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8837         tls_desc_rel_ field.
8838         (Output_data_plt_i386::rel_tls_desc): New function.
8839         (Target_i386::rel_tls_desc_section): New function.
8840         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8841         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8842         R_386_TLS_DESC reloc in rel_tls_desc_section.
8843         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8844         Define struct Tlsdesc_info.
8845         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8846         (Target_x86_64::do_reloc_symbol_index): New function.
8847         (Target_x86_64::add_tlsdesc_info): New function.
8848         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8849         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8850         tlsdesc_rel_ field.
8851         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8852         all callers.
8853         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8854         (Target_x86_64::rela_tlsdesc_section): New function.
8855         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8856         handling.
8857         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8858         (Target_x86_64::do_reloc_addend): New function.
8859         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8860         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8861         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8862         (Output_reloc::type): New function.
8863         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8864         (Output_reloc::is_target_specific): New function.
8865         (Output_reloc::target_arg): New function.
8866         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8867         absolute relocs and target specific relocs.
8868         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8869         add_target_specific.
8870         (class Output_data_reloc) [SHT_RELA]: Likewise.
8871         * output.cc (Output_reloc::Output_reloc): Add four new versions
8872         for absolute relocs and target specific relocs.
8873         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8874         (Output_reloc::get_symbol_index): Likewise.
8875         (Output_reloc::local_section_offset): Check that local_sym_index_
8876         is not TARGET_CODE or 0.
8877         (Output_reloc::symbol_value): Likewise.
8878         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8879         reloc.
8880         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8881         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8882         functions.
8883         * layout.cc (add_target_dynamic_tags): Use output section for
8884         DT_PLTRELSZ and DT_JMPREL.
8885
8886 2010-01-07  Ian Lance Taylor  <iant@google.com>
8887
8888         PR 11061
8889         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8890         function.
8891         (class Output_data_reloc_generic): Define.
8892         (class Output_data_reloc_base): Change base class to
8893         Output_data_reloc_generic.  Change add() method to call
8894         bump_relative_reloc_count for a relative reloc.  Remove
8895         sort_relocs_ field.
8896         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8897         to sort_relocs().
8898         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8899         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8900         appropriate.
8901         * layout.h (class Layout): Update declaration.
8902
8903 2010-01-07  Ian Lance Taylor  <iant@google.com>
8904
8905         * output.h (class Output_data): Add const version of
8906         output_section and do_output_section.
8907         (class Output_section_data): Add const version of
8908         do_output_section.
8909         (class Output_section): Likewise.
8910         * layout.cc (Layout::add_target_dynamic_tags): New function.
8911         * layout.h (class Layout): Update declarations.
8912         * arm.cc (Target_arm::do_finalize_sections): Use
8913         add_target_dynamic_tags.
8914         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8915         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8916         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8917         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8918
8919 2010-01-07  Ian Lance Taylor  <iant@google.com>
8920
8921         PR 11042
8922         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8923         object as needed.
8924
8925 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8926             Ian Lance Taylor  <iant@google.com>
8927
8928         PR 11019
8929         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8930         Xindex::read_symtab_xindex.
8931
8932 2010-01-07  Doug Kwan  <dougkwan@google.com>
8933
8934         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8935         (Insn_template::thumb16_bcond_insn): New method declaration.
8936         (Insn_template): Fix spelling.
8937         (Stub::thumb16_special): New method declaration.
8938         (Stub::do_write): Define virtual method which was previously pure
8939         virtual.
8940         (Stub::do_thumb16_special): New method declaration.
8941         (Stub::do_fixed_endian_write): New template member.
8942         (Reloc_stub::do_write): Remove.
8943         (Reloc_stub::do_fixed_endian_write): Remove.
8944         (Cortex_a8_stub): New class definition.
8945         (Stub_factory::make_cortex_a8_stub): New method definition.
8946         (Stub_factory::Stub_factory): Add missing static storage class
8947         qualifier for elf32_arm_stub_a8_veneer_blx.
8948
8949 2010-01-07  Ian Lance Taylor  <iant@google.com>
8950
8951         PR 10980
8952         * options.h (class General_options): Add --warn-unresolved-symbols
8953         and --error-unresolved-symbols.
8954         * errors.cc (Errors::undefined_symbol): Implement
8955         --warn-unresolved-symbols.
8956
8957         * options.h (class General_options): Add -z text and -z textoff.
8958         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8959
8960 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8961
8962         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8963         (Garbage_collection::cident_sections): New function.
8964         (Garbage_collection::add_cident_section): New function.
8965         (Garbage_collection::cident_sections_): New member.
8966         (gc_process_relocs): Add references to sections whose names are C
8967         identifiers.
8968         * gold.h (cident_section_start_prefix): New constant.
8969         (cident_section_stop_prefix): New constant.
8970         (is_cident): New function.
8971         * layout.cc (Layout::define_section_symbols): Replace string constants
8972         with the newly defined constants.
8973         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8974         C identifiers.
8975         * testsuite/Makefile.am: Add gc_orphan_section_test.
8976         * testsuite/Makefile.in: Regenerate.
8977         * testsuite/gc_orphan_section_test.cc: New file.
8978         * testsuite/gc_orphan_section_test.sh: New file.
8979
8980 2010-01-06  Ian Lance Taylor  <iant@google.com>
8981
8982         PR 10980
8983         * options.h (class General_options): Add --warn-shared-textrel.
8984         * layout.cc (Layout::finish_dynamic_section): Implement
8985         --warn-shared-textrel.
8986
8987         PR 10980
8988         * options.h (class General_options): Add --warn-multiple-gp.
8989
8990 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8991
8992         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8993         $(THREADSLIB) and $(LIBDL).
8994         * Makefile.in: Rebuild.
8995
8996 2010-01-06  Ian Lance Taylor  <iant@google.com>
8997
8998         PR 10980
8999         * options.cc (General_options::parse_section_start): New function.
9000         (General_options::section_start): New function.
9001         (General_options::General_options): Initialize all members.
9002         * options.h: Include <map>
9003         (class General_options): Add --section-start.  Add section_starts_
9004         member.
9005         * layout.cc (Layout::attach_allocated_section_to_segment): If
9006         --section-start was used, set the address of the segment.  Remove
9007         local sort_sections.
9008         (Layout::relaxation_loop_body): If the address of the load segment
9009         has been set by --section-start, don't use it.
9010         * output.h (Output_segment::update_flags_for_output_section): New
9011         function.
9012         * output.cc (Output_segment::add_output_section): Call
9013         update_flags_for_output_section.
9014
9015 2010-01-05  Ian Lance Taylor  <iant@google.com>
9016
9017         PR 10980
9018         * options.h (class General_options): Add --undefined-version.
9019         * script.cc (struct Version_expression): Add was_matched_by_symbol
9020         field.
9021         (Version_script_info::matched_symbol): New function.
9022         (Version_script_info::get_symbol_version_helper): Call
9023         matched_symbol.
9024         (Version_script_info::check_unmatched_names): New function.
9025         * script.h (class Version_script_info): Update declarations.
9026         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9027
9028         * options.h (class General_options): Use DEFINE_bool_alias for
9029         allow_multiple_definition.
9030         * resolve.cc (Symbol_table::should_override): Don't test
9031         allow_multiple_definition.
9032
9033         PR 10980
9034         * options.h (class General_options): Add --cref.
9035         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9036         until after printing cref table.
9037         * cref.cc: Include "symtab.h".
9038         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9039         (Cref_table_compare::operator()): New function.
9040         (Cref_inputs::gather_cref): New function.
9041         (filecol): New static const.
9042         (Cref_inputs::print_cref): New function.
9043         (Cref::print_cref): New function.
9044         * cref.h: Include <cstdio>.
9045         (class Cref): Update declarations.
9046         * mapfile.h (Mapfile::file): New function.
9047         * object.h (class Object): Define Symbols.  Declare virtual
9048         do_get_global_symbols.
9049         (Object::get_global_symbols): New function.
9050         * object.cc (Input_objects::add_object): Pass object to cref_ if
9051         --cref.
9052         (Input_objects::archive_start): Likewise.
9053         (Input_objects::archive_stop): Likewise.
9054         (Input_objects::print_cref): New function.
9055         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9056         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9057         --cref.
9058         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9059         function.
9060         * plugin.h (class Sized_pluginobj): Update declarations.
9061
9062 2010-01-05  Ian Lance Taylor  <iant@google.com>
9063
9064         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9065         to is_default_version.  Rename insdef to insdefault.
9066         (Symbol_table::add_from_relobj): Rename def to is_default_version
9067         and local to is_forced_local.
9068         (Symbol_table::add_from_pluginobj): Likewise.
9069         (Symbol_table::add_from_dynobj): Likewise.
9070         (Symbol_table::define_special_symbol): Rename insdef to
9071         insdefault.
9072
9073 2010-01-04  Ian Lance Taylor  <iant@google.com>
9074
9075         PR 10980
9076         * options.h (class General_options): Add
9077         --allow-multiple-definition and -z muldefs.
9078         * resolve.cc (Symbol_table::should_override): Don't warn about a
9079         multiple symbol definition if --allow-multiple-definition or -z
9080         muldefs.
9081
9082         PR 10980
9083         * options.h (class General_options): Add --add-needed and
9084         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9085         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9086         error if --copy-dt-needed-entries aka --add-needed is used and
9087         would cause a change in behaviour.
9088
9089         PR 10980
9090         * options.h (class General_options): Add -G as a short version of
9091         --shared.  Add no-op options -assert, -g, and -i.
9092
9093 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9094
9095         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9096         check for .text or .gnu.linkonce.t sections.
9097         * icf.cc (Icf::find_identical_sections): Ditto.
9098         Change the detection for mangled function name within the section
9099         name.
9100         * icf.h (is_section_foldable_candidate): New function.
9101
9102 2009-12-30  Ian Lance Taylor  <iant@google.com>
9103
9104         PR 10980
9105         * options.h (class General_options): Permit two dashes with
9106         --retain-symbols-file.
9107
9108 2009-12-30  Ian Lance Taylor  <iant@google.com>
9109
9110         PR 10979
9111         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9112         don't put the file header and segment headers in the text
9113         segment.
9114
9115         PR 10979
9116         * common.cc (Sort_commons::operator()): Stabilize sort when both
9117         entries are NULL.
9118         (Symbol_table::do_allocate_commons_list): When allocating common
9119         symbols, skip a symbol which is no longer common.
9120         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9121         an object before checking its type.
9122         * testsuite/common_test_2.c: New file.
9123         * testsuite/common_test_3.c: New file.
9124         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9125         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9126         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9127         (common_test_2_pic.o, common_test_2.so): New targets.
9128         (common_test_3_pic.o, common_test_3.so): New targets.
9129         * testsuite/Makefile.in: Rebuild.
9130
9131         PR 10979
9132         * script.cc (read_input_script): If we see a new SECTIONS clause,
9133         and we have added an input section, give an error.
9134         * layout.h (class Layout): Add have_added_input_section function.
9135         Add have_added_input_section_ field.
9136         * layout.cc (Layout::Layout): Initialize
9137         have_added_input_section_.
9138         (Layout::layout): Set have_added_input_section_.
9139         (Layout::layout_eh_frame): Likewise.
9140
9141 2009-12-30  Ian Lance Taylor  <iant@google.com>
9142
9143         PR 10931
9144         * options.h (class General_options): Add --sort-common option.
9145         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9146         * common.cc (Sort_common): Add sort_order parameter to
9147         constructor.  Add sort_order_ field.
9148         (Sort_commons::operator): Check sort_order_.
9149         (Symbol_table::allocate_commons): Determine the sort order.
9150         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9151         Change all callers.
9152         (Symbol_table::do_allocate_commons_list): Likewise.
9153
9154 2009-12-30  Ian Lance Taylor  <iant@google.com>
9155
9156         PR 10916
9157         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9158         symbols from this object, don't change the visibility of an
9159         undefined symbol.
9160         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9161
9162 2009-12-30  Ian Lance Taylor  <iant@google.com>
9163
9164         PR 10861
9165         * script.h (class Version_script_info): Define Language enum.
9166         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9167         new fields globals_, locals_, and is_finalized_.
9168         * script.cc: Various formatting fixes.
9169         (class Parser_closure): Change language_stack_ from a vector of
9170         std::string to one of Version_script_info::Language.  Adjust all
9171         uses accordingly.
9172         (class Lazy_demangler): Remove.
9173         (struct Version_expression): Change language from std::string to
9174         Version_script_info::Language.
9175         (Version_script_info::Version_script_info): New function.
9176         (Version_script_info::~Version_script_info): Don't call clear.
9177         (Version_script_info::finalize): New function.
9178         (Version_script_info::build_lookup_tables): New function.
9179         (Version_script_info::build_expression_list_lookup): New
9180         function.
9181         (Version_script_info::get_symbol_version_helper): Rewrite to use
9182         lookup tables.
9183         (Version_script_info::print_expression_list): Adjust to use
9184         Version_script_info::Language.
9185         (script_push_lex_into_version_mode): Check that the version script
9186         has not been finalized.
9187         (version_script_push_lang): Change language string to
9188         Version_script_info::Language.
9189         * options.cc (Command_line::version_script): New function.
9190         * options.h (class General_options): Add finalize_dynamic_list
9191         function.  Change version_script from declaration to definition.
9192         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9193         * testsuite/version_script.map: Remove duplicate def of foo.
9194         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9195         version_script.map.
9196         * testsuite/Makefile.in: Rebuild.
9197
9198 2009-12-30  Ian Lance Taylor  <iant@google.com>
9199
9200         PR 10843
9201         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9202         if the input symbol index is 0, make the output symbol index 0.
9203
9204 2009-12-30  Ian Lance Taylor  <iant@google.com>
9205
9206         PR 10670
9207         * options.h (class General_options): Add -x/--discard-all.
9208         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9209         --discard-all.  If the local symbol needs a dynamic entry, check
9210         that before handling --discard-locals.
9211
9212 2009-12-30  Ian Lance Taylor  <iant@google.com>
9213
9214         PR 10450
9215         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9216         flags to PF_R.
9217         (Output_segment::add_output_section): Don't change the flags if
9218         the type is PT_TLS.
9219
9220         PR 10450
9221         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9222         GNU hash table if they need a dynamic value.  Otherwise, don't add
9223         them if they are defined in a dynamic object or are forced local.
9224
9225 2009-12-29  Ian Lance Taylor  <iant@google.com>
9226
9227         PR 10450
9228         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9229         .gnu.hash table for a 32-bit target.
9230
9231         PR 10450
9232         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9233         regular and a dynamic object only needs a dynamic symbol table
9234         entry if it is externally visible.
9235
9236         PR 10450
9237         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9238         constructor.  Add global_offset_table_ field.
9239         (Target_i386::got_section): Set global_offset_table_.
9240         (Target_i386::do_finalize_sections): Set global_offset_table_
9241         size.
9242         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9243         in constructor.  Add global_offset_table_ field.
9244         (Target_x86_64::got_section): Set global_offset_table_.
9245         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9246         size.
9247
9248         * layout.cc (Layout::Layout): Initialize increase_relro_.
9249         (Layout::get_output_section): Add is_relro, is_last_relro, and
9250         is_first_non_relro parameters.  Change all callers.
9251         (Layout::choose_output_section): Likewise.
9252         (Layout::add_output_section_data): Likewise.
9253         (Layout::make_output_section): Likewise.
9254         (Layout::set_segment_offsets): Clear increase_relro when using a
9255         linker script.
9256         * layout.h (class Layout): Add increase_relro method.  Add
9257         increase_relro_ field.  Update declarations.
9258         * output.cc (Output_section::Output_section): Initialize
9259         is_last_relro_ and is_first_non_relro_.
9260         (Output_segment::add_output_section): Group relro sections is
9261         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9262         (Output_segment::maximum_alignment): Remove relro handling.
9263         (Output_segment::set_section_addresses): Add increase_relro
9264         parameter.  Change all callers.  Add initial alignment to align
9265         relro sections on separate page.  Remove old relro handling.
9266         (Output_segment::set_section_list_addresses): Remove in_relro
9267         parameter.  Change all callers.
9268         (Output_segment::set_offset): Add increase parameter.  Change all
9269         callers.  Remove old relro handling.
9270         * output.h (class Output_section): Add new methods: is_last_relro,
9271         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9272         Add is_last_relro_ and is_first_non_relro_ fields.
9273         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9274         Create separate .got.plt section.  Call increase_relro.
9275         * x86_64.cc (Target_x86_64::got_section): Likewise.
9276         * testsuite/relro_script_test.t: Add .got.plt.
9277
9278         PR 10450
9279         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9280         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9281         (Layout::finalize): Call set_dynamic_symbol_size.
9282         (Layout::set_dynamic_symbol_size): New function.
9283         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9284         set_dynamic_symbol_size.
9285
9286         PR 10450
9287         * output.h (class Output_section): Add is_entsize_zero_ field.
9288         * output.cc (Output_section::Output_section): Initialize
9289         is_entsize_zero_.
9290         (Output_section::set_entsize): If two different entsizes are
9291         requested, force it to zero.
9292         (Output_section::add_input_section): Set flags for .debug_str
9293         before updating section flags.  Set entsize.
9294         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9295         and SHF_STRING if all input sections have those flags.
9296
9297 2009-12-29   Rafael Espindola  <espindola@google.com>
9298
9299         * main.cc (main): Fix the sys time reporting.
9300         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9301         reporting.
9302
9303 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9304
9305         * options.cc (General_options::parse_version): Allow -v to exit
9306         without an error if there is nothing to link.
9307
9308 2009-12-29  Ian Lance Taylor  <iant@google.com>
9309
9310         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9311         using a version of gcc before 4.1.
9312         * configure: Rebuild.
9313
9314 2009-12-28  Chris Demetriou  <cgd@google.com>
9315
9316         * attributes.cc (Output_attributes_section_data::do_write): Use
9317         std::vector::front rather than std::vector::data.
9318
9319 2009-12-28  Ian Lance Taylor  <iant@google.com>
9320
9321         * symtab.h (class Symbol_table): Add enum Defined.
9322         * resolve.cc (Symbol_table::should_override): Add defined
9323         parameter.  Change all callers.  Test whether object is NULL
9324         before calling a method on it.
9325         (Symbol_table::report_resolve_problem): Add defined parameter.
9326         Change all callers.
9327         (Symbol_table::should_override_with_special): Likewise.
9328         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9329         parameter.  Change all callers.
9330         (Symbol_table::do_define_in_output_data): Likewise.
9331         (Symbol_table::define_in_output_segment): Likewise.
9332         (Symbol_table::do_define_in_output_segment): Likewise.
9333         (Symbol_table::define_as_constant): Likewise.
9334         (Symbol_table::do_define_as_constant): Likewise.
9335         * script.h (class Symbol_assignment): Add is_defsym parameter to
9336         constructor; change all callers.
9337         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9338         parameter.  Change all callers.  Add is_defsym_ field.
9339         (class Parser_closure): Add parsing_defsym parameter to
9340         constructor; change all callers.  Add parsing_defsym accessor
9341         function.  Add parsing_defsym_ field.
9342
9343 2009-12-28  Ian Lance Taylor  <iant@google.com>
9344
9345         * gold.cc (queue_middle_tasks): Fix formatting.
9346         * object.cc (Relobj::is_section_name_included): Likewise.
9347
9348 2009-12-23  Ian Lance Taylor  <iant@google.com>
9349
9350         * i386.cc (Target_i386::do_calls_non_split): Recognize
9351         -fsplit-stack prologue for a function with a static chain.
9352         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9353         -fsplit-stack prologue when using %r11.
9354
9355 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9356
9357         * options.cc (General_options::parse_version): Make -v continue and do
9358         the link like GNU ld does.
9359
9360 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9361
9362         * Makefile.am (CCFILES): Add timer.cc.
9363         (HFILES): Add timer.h.
9364         * configure.ac: Check for sysconf and times.
9365         * main.cc: include timer.h.
9366         (main): Use Timer instead of get_run_time.
9367         * timer.cc: New.
9368         * timer.h: New.
9369         * workqueue.cc: include timer.h.
9370         (Workqueue::find_and_run_task):
9371         Report user, sys and wall time.
9372         * Makefile.in: Regenerate.
9373         * config.in: Regenerate.
9374         * configure: Regenerate.
9375
9376 2009-12-16  Doug Kwan  <dougkwan@google.com>
9377
9378         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9379         sections.
9380         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9381         relaxed input sections.
9382         * output.cc (Output_section::find_relaxed_input_section): Change
9383         return type to Output_relaxed_input_section pointer.  Adjust code
9384         for new type of relaxed_input_section_map_.
9385         * output.h (Output_section::find_relaxed_input_section): Change
9386         return type to Output_relaxed_input_section pointer.
9387         (Output_section::Output_relaxed_input_section_by_input_section_map):
9388         New type.
9389         (Output_section::relaxed_input_section_map_): Change type to
9390         Output_section::Output_relaxed_input_section_by_input_section_map.
9391         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9392         input section.
9393
9394 2009-12-15  Ian Lance Taylor  <iant@google.com>
9395
9396         * layout.cc (Layout::create_shstrtab): Only write out after input
9397         sections if we are compressing debug sections.
9398
9399 2009-12-15  Ian Lance Taylor  <iant@google.com>
9400
9401         * archive.cc (Archive::add_symbols): Only look up a symbol without
9402         a version if there is, in fact, a version.
9403
9404 2009-12-14  Ian Lance Taylor  <iant@google.com>
9405
9406         Revert -Wshadow changes, all changes from:
9407         2009-12-11  Doug Kwan  <dougkwan@google.com>
9408         2009-12-11  Nick Clifton  <nickc@redhat.com>
9409         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9410
9411 2009-12-11  Doug Kwan  <dougkwan@google.com>
9412
9413         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9414         due to -Wshadow.
9415         * attributes.cc (Object_attribute::size): Ditto.
9416         (Attributes_section_data::size): Ditto.
9417         (Attributes_section_data::Attributes_section_data): Ditto.
9418         (Output_attributes_section_data::do_write): Ditto.
9419         * attributes.h (Object_attribute::set_type): Ditto.
9420         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9421
9422 2009-12-11  Nick Clifton  <nickc@redhat.com>
9423
9424         * archive.cc: Fix shadowed variable warnings.
9425         * arm.cc: Likewise.
9426         * compressed_output.cc: Likewise.
9427         * compressed_output.h: Likewise.
9428         * configure: Likewise.
9429         * dwarf_reader.cc: Likewise.
9430         * dynobj.cc: Likewise.
9431         * dynobj.h: Likewise.
9432         * ehframe.cc: Likewise.
9433         * ehframe.h: Likewise.
9434         * errors.cc: Likewise.
9435         * expression.cc: Likewise.
9436         * fileread.cc: Likewise.
9437         * fileread.h: Likewise.
9438         * freebsd.h: Likewise.
9439         * i386.cc: Likewise.
9440         * icf.cc: Likewise.
9441         * incremental.h: Likewise.
9442         * layout.cc: Likewise.
9443         * layout.h: Likewise.
9444         * mapfile.cc: Likewise.
9445         * merge.cc: Likewise.
9446         * merge.h: Likewise.
9447         * object.cc: Likewise.
9448         * object.h: Likewise.
9449         * options.h: Likewise.
9450         * output.cc: Likewise.
9451         * output.h: Likewise.
9452         * parameters.cc: Likewise.
9453         * plugin.cc: Likewise.
9454         * powerpc.cc: Likewise.
9455         * reduced_debug_output.cc: Likewise.
9456         * reduced_debug_output.h: Likewise.
9457         * reloc.cc: Likewise.
9458         * reloc.h: Likewise.
9459         * resolve.cc: Likewise.
9460         * script-sections.cc: Likewise.
9461         * script.cc: Likewise.
9462         * script.h: Likewise.
9463         * sparc.cc: Likewise.
9464         * symtab.cc: Likewise.
9465         * symtab.h: Likewise.
9466         * target-select.cc: Likewise.
9467         * target-select.h: Likewise.
9468         * token.h: Likewise.
9469         * workqueue.cc: Likewise.
9470         * workqueue.h: Likewise.
9471         * x86_64.cc: Likewise.
9472
9473 2009-12-10  Doug Kwan  <dougkwan@google.com>
9474
9475         * arm.cc (attributes.h): New include.
9476         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9477         (Arm_relobj::~Arm_relobj): Delete object pointed by
9478         attributes_section_data_.
9479         (Arm_relobj::attributes_section_data): New method definition.
9480         (Arm_relobj::attributes_section_data_): New data member declaration.
9481         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9482         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9483         attributes_section_data_.
9484         (Arm_dynobj::attributes_section_data): New method definition.
9485         (Arm_dynobj::attributes_section_data_): New data member declaration.
9486         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9487         initialization value of may_use_blx_ to false.
9488         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9489         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9490         object attributes to compute results instead of hard-coding.
9491         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9492         Target_arm::get_secondary_compatible_arch,
9493         Target_arm::set_secondary_compatible_arch
9494         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9495         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9496         New method declarations.
9497         (Target_arm::get_aeabi_object_attribute): New method definition.
9498         (Target_arm::attributes_section_data_): New data member declaration.
9499         (read_arm_attributes_section): New template definition.
9500         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9501         (Arm_dynobj::do_read_symbols): Ditto.
9502         (Target_arm::do_finalize_sections): Merge attributes sections from
9503         input.  Check for BLX use after attributes section merging.
9504         Fix __exidx_start and __exidx_end visibility.  Create an
9505         .ARM.attributes section if necessary.
9506         (Target_arm::get_secondary_compatible_arch,
9507         Target_arm::set_secondary_compatible_arch,
9508         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9509         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9510         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9511         New method definitions.
9512
9513 2009-12-09  Ian Lance Taylor  <iant@google.com>
9514
9515         * plugin.cc (Plugin::load): Don't cast from void* to a function
9516         pointer.
9517
9518 2009-12-09  Ian Lance Taylor  <iant@google.com>
9519
9520         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9521         information fields.
9522
9523 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9524
9525         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9526         Replace two_file_shared_1.so with two_file_shared_2.so.
9527         * testsuite/Makefile.in: Regenerated.
9528
9529 2009-12-08  Doug Kwan  <dougkwan@google.com>
9530
9531         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9532         (HFILES): Add attributes.h and int_encoding.h.
9533         * Makefile.in: Regenerate.
9534         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9535         function definitions to int_encoding.cc
9536         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9537         prototypes to int_encoding.h
9538         * reduced_debug_output.cc (int_encoding.h): New include.
9539         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9540         function definitions to int_encoding.cc
9541         (insert_into_vector, read_from_pointer): Move template definitions to
9542         int_encoding.h
9543         * attributes.cc: New file.
9544         * attributes.h: New file.
9545         * int_encoding.cc: New file.
9546         * int_encoding.h: New file.
9547
9548 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9549
9550         PR gold/11055
9551         * incremental-dump.cc (dump_incremental_inputs): New.
9552         (main): Use dump_incremental_inputs.
9553
9554 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9555
9556         PR gold/10893
9557         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9558         checking elfcpp::STT_FUNC.
9559         (Target_i386::Relocate::relocate): Likewise.
9560         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9561
9562         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9563         symbols from shared libraries into normal FUNC symbols.
9564
9565         * symtab.h (Symbol): Add is_func and use it.
9566
9567 2009-12-05  Doug Kwan  <dougkwan@google.com>
9568
9569         * arm.cc (Target_arm::arm_info): Initialize new fields
9570         attributes_section and attributes_vendor.
9571         * i386.cc (Target_i386::i386_info): Same.
9572         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9573         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9574         fields attributes_section and attributes_vendor.
9575         * sparc.cc (Target_sparc::sparc_info): Same.
9576         * target.h (Target::attributes_section, Target::attributes_vendor,
9577         Target::is_attributes_section, Target::attribute_arg_type,
9578         Target::attributes_order): New method definitions.
9579         (Target::Target_info::attributes_section,
9580         Target::Target_info::attributes_vendor): New fields.
9581         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9582         virtual method definitions.
9583         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9584         attributes_section and attributes_vendor.
9585         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9586
9587 2009-12-05  Doug Kwan  <dougkwan@google.com>
9588
9589         * arm.cc: Update comments about interworking and stub generation.
9590         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9591         considered as non-PIC.
9592         (Arm_relocate_functions::base_abs): Fix formatting.
9593         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9594         of function to use GOT entry address instead of offset.
9595         (Target_arm::Scan::global): Issue an error if a symbol would need a
9596         PLT does not get one because it is untyped.  Remove code to create
9597         dynamic symbols for relative branches.
9598         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9599         takes unsigned integer instead of boolean.
9600
9601 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9602
9603         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9604         (two_file_test_LDADD): Likewise.
9605         (common_test_1_LDADD): Likewise.
9606         (exception_test_LDADD) Likewise.
9607         (weak_test_LDADD): Likewise.
9608         (many_sections_test_LDADD): Likewise.
9609         (initpri1_LDADD): Likewise.
9610         (script_test_1_LDADD): Likewise.
9611         (script_test_2_LDADD): Likewise.
9612         (justsyms_LDADD): Likewise.
9613         (binary_test_LDADD): Likewise.
9614         (large_LDADD): Likewise.
9615         * testsuite/Makefile.in: Regenerated.
9616
9617 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9618
9619         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9620         (Symbol_table::override_with_special): Likewise.
9621         (Symbol_table::add_from_object): Likewise.
9622
9623 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9624
9625         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9626         Don't set the data_offset twice.
9627
9628 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9629
9630         * testsuite/Makefile.in: Regenerate.
9631
9632 2009-12-03  Doug Kwan  <dougkwan@google.com>
9633
9634         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9635         (Target_arm::do_finalize_sections): Add parameter for symbol table
9636         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9637         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9638         parameter for symbol table pointer.
9639         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9640         an additional parameter for a pointer to symbol table.
9641         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9642         parameter for a symbol table pointer.
9643         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9644         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9645         Ditto.
9646         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9647         parameter for a symbol table pointer.
9648
9649 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9650
9651         * incremental.cc (Incremental_inputs_header)
9652         (Incremental_inputs_header_write, Incremental_inputs_entry)
9653         (Incremental_inputs_entry_write): Move ...
9654         * incremental.h (Incremental_inputs_header)
9655         (Incremental_inputs_header_write, Incremental_inputs_entry)
9656         (Incremental_inputs_entry_write): here.
9657
9658 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9659
9660         * incremental.cc (make_sized_incremental_binary): Set the target.
9661         Error if it is incompatible.
9662         * output.h (Output_file): Add filename method.
9663
9664 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9665
9666         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9667         from the get_* methods.
9668
9669 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9670
9671         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9672         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9673         Write 0 for the data_offset of scripts.
9674
9675 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9676
9677         * testsuite/Makefile.am: Add the incremental_test.sh test.
9678         * testsuite/incremental_test.sh: New.
9679         * testsuite/incremental_test_1.c: New.
9680         * testsuite/incremental_test_2.c: New.
9681
9682 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9683
9684         * incremental-dump.cc (main): Fix typos.
9685
9686 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9687
9688         PR gold/11025
9689         * incremental-dump.cc (main): Use llu to print 64 bit values.
9690
9691 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9692             H.J. Lu  <hongjiu.lu@intel.com>
9693
9694         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9695         $(LIBDL).
9696         (incremental_dump_LDADD): Likewise.
9697         * Makefile.in: Regenerated.
9698
9699 2009-11-25  Doug Kwan  <dougkwan@google.com>
9700
9701         Revert:
9702
9703         2009-11-25  Doug Kwan  <dougkwan@google.com>
9704
9705                 * arm.cc (Target_arm::Target_arm): Move method definition
9706                 outside of class definition.  Add code to handle
9707                 --target1-rel, --target1-abs and --target2= options.
9708                 (Target_arm::get_reloc_reloc_type): Change method to be
9709                 non-static and const.
9710                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9711                 New data member declaration.
9712                 (Target_arm::Scan::local, Target_arm::Scan::global,
9713                 Target_arm::Relocate::relocate,
9714                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9715                 Adjust call to Target_arm::get_real_reloc_type.
9716                 (Target_arm::get_real_reloc_type): Use command line options
9717                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9718                 * options.h (--target1-rel, --target1-abs, --target2): New
9719                 ARM-only options.
9720
9721 2009-11-25  Doug Kwan  <dougkwan@google.com>
9722
9723         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9724         class definition.  Add code to handle --target1-rel, --target1-abs
9725         and --target2= options.
9726         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9727         and const.
9728         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9729         member declaration.
9730         (Target_arm::Scan::local, Target_arm::Scan::global,
9731         Target_arm::Relocate::relocate,
9732         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9733         call to Target_arm::get_real_reloc_type.
9734         (Target_arm::get_real_reloc_type): Use command line options to
9735         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9736         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9737         options.
9738
9739 2009-11-25  Doug Kwan  <dougkwan@google.com>
9740
9741         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9742         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9743         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9744         formatting.
9745         (Arm_relocate_functions::thm_call): Replace body with a call to
9746         Arm_relocate_functions::thumb_branch_common.
9747         (Arm_relocate_functions::thm_jump24,
9748         Arm_relocate_functions::thm_xpc22): New method definitions.
9749         (Arm_relocate_functions::thumb_branch_common): New method definition.
9750         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9751         operator.
9752         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9753         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9754
9755 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9756
9757         * Makefile.am: Build incremental-dump
9758         * Makefile.in: Regenerate.
9759         * incremental-dump.cc: New.
9760         * incremental.cc (Incremental_inputs_header_data,
9761         Incremental_inputs_entry_data): Move to incremental.h
9762         * incremental.h: (Incremental_inputs_header_data,
9763         Incremental_inputs_entry_data): Move from incremental.cc
9764
9765 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9766
9767         * incremental.cc (Incremental_inputs_header,
9768         Incremental_inputs_header_write, Incremental_inputs_entry,
9769         Incremental_inputs_entry_write): Add a typedef with the data type.
9770
9771 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9772
9773         * incremental.cc (Incremental_inputs_header,
9774         Incremental_inputs_header_write, Incremental_inputs_entry,
9775         Incremental_inputs_entry_write): Update comment about which
9776         type has the filed descriptions.
9777
9778 2009-11-15  Doug Kwan  <dougkwan@google.com>
9779
9780         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9781         (Arm_relocate_functions::arm_branch_common): Change method defintion
9782         in class definition to a method declaration and update list of formal
9783         parameters.
9784         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9785         Arm_relocation_functions::jump24): Adjust call to
9786         Arm_relocate_functions::arm_branch_common.  Update list of formal
9787         parameters.
9788         (Arm_relocate_functions::xpc25): New method definition.
9789         (Arm_relocate_functions::arm_branch_common): Move method defintion
9790         out from class definition.  Use stubs for mode-switching and extending
9791         branch ranges.
9792         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9793         specially.  Change code to enable use of stubs in ARM branches.
9794
9795 2009-11-10  Doug Kwan  <dougkwan@google.com>
9796
9797         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9798         in method declaration.
9799         (Target_arm::relocate_stub): New method declaration.
9800         (Target_arm::default_target): Change to return a pointer instead of
9801         a const reference.
9802         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9803         Target_arm::default_target.
9804         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9805         method definition.
9806         (Target_arm::relocate_section): Adjust view.
9807         (Target_arm::relocate_stub): New method definition.
9808
9809 2009-11-10  Doug Kwan  <dougkwan@google.com>
9810
9811         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9812         a format warning.
9813         * incremental.cc (open_incremental_binary): Initialized local
9814         variables to avoid warnings.
9815         * object.cc (make_elf_object): Ditto.
9816         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9817         a format warning.
9818
9819 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9820
9821         PR gold/10930
9822         * testsuite/plugin_test.c: Include "config.h".
9823
9824 2009-11-09  Doug Kwan  <dougkwan@google.com>
9825
9826         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9827         (arm_symbol_value): Remove.
9828         (Arm_relocate_functions::arm_branch_common,
9829         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9830         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9831         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9832         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9833         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9834         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9835         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9836         Arm_relocate_functions::thm_mobw_abs_nc,
9837         Arm_relocate_functions::thm_mov_abs,
9838         Arm_relocate_functions::movw_prel_nc,
9839         Arm_relocate_functions::thm_movt_abs,
9840         Arm_relocate_functions::movt_prel,
9841         Arm_relocate_functions::thm_movw_prel_nc,
9842         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9843         (Target_arm::Relocate::relocate): Only decompose address into two
9844         parts if relocation type uses the thumb-bit and pass the actual
9845         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9846         calls to methods in Arm_relocate_functions for this change.
9847
9848 2009-11-08  Ian Lance Taylor  <iant@google.com>
9849
9850         PR 10925
9851         * reloc.cc: Instantiate
9852         Sized_relobj::initialize_input_to_output_maps and
9853         Sized_relobj:free_input_to_output_maps.
9854
9855 2009-11-06  Ian Lance Taylor  <iant@google.com>
9856
9857         PR 10876
9858         * defstd.cc (in_segment): Set only_if_ref true for "end".
9859
9860 2009-11-06  Doug Kwan  <dougkwan@google.com>
9861
9862         * arm.cc (class Reloc_stub): Correct a comment.
9863         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9864         (Target_arm::scan_section_for_stubs): New method declaration.
9865         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9866         Change methods from private to protected.
9867         (Target_arm::do_may_relax): New method definition.
9868         (Target_arm::do_relax, Target_arm::group_sections,
9869         Target_arm::scan_reloc_for_stub,
9870         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9871         (Target_arm::arm_input_section_map_): New data member declaration.
9872         (Target_arm::scan_reloc_for_stub,
9873         Target_arm::scan_reloc_section_for_stubs,
9874         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9875         Target_arm::do_relax): New method definitions.
9876
9877 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9878
9879         * configure.ac: Check for (struct stat)::st_mtim
9880         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9881         * config.in: Regenerate.
9882         * configure: Regenerate.
9883
9884 2009-11-05  Ian Lance Taylor  <iant@google.com>
9885
9886         PR 10910
9887         * output.cc (Output_segment::add_output_section): Add missing
9888         return statement.
9889
9890 2009-11-04  Ian Lance Taylor  <iant@google.com>
9891
9892         PR 10880
9893         * object.h (class Object): Add is_needed and set_is_needed
9894         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9895         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9896         defined in a dynamic object and referenced by a regular object,
9897         set is_needed for the dynamic object.
9898         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9899         if the file is marked with as_needed and it is not needed.
9900
9901 2009-11-04  Ian Lance Taylor  <iant@google.com>
9902
9903         PR 10887
9904         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9905         tags if data is discarded by linker script.
9906         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9907         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9908         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9909         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9910
9911 2009-11-04  Ian Lance Taylor  <iant@google.com>
9912
9913         * layout.cc (Layout::get_output_section): Add is_interp and
9914         is_dynamic_linker_section parameters.  Change all callers.
9915         (Layout::choose_output_section): Likewise.
9916         (Layout::make_output_section): Likewise.
9917         (Layout::add_output_section_data): Add is_dynamic_linker_section
9918         parameter.  Change all callers.
9919         * layout.h (class Layout): Update declarations.
9920         * output.h (class Output_section): Add is_interp, set_is_interp,
9921         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9922         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9923         generate_code_fills_at_write_ to a bitfield.
9924         * output.cc (Output_section::Output_sections): Initialize new
9925         fields.
9926         (Output_segment::add_output_section): Add do_sort parameter.
9927         Change all callers.
9928
9929 2009-11-03  Ian Lance Taylor  <iant@google.com>
9930
9931         PR 10860
9932         * options.h (class General_options): Add --warn-common.
9933         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9934         merging two common symbols.
9935         (Symbol_table::should_override): Handle --warn-common when merging
9936         a common symbol with a defined symbol.  Use report_resolve_problem
9937         for multiple definitions.
9938         (Symbol_table::report_resolve_problem): New function.
9939         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9940
9941 2009-11-03  Doug Kwan  <dougkwan@google.com>
9942
9943         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9944         stub_factory_.
9945         (Target_arm::stub_factory): New method definition.
9946         (Target_arm::new_arm_input_section,
9947         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9948         Target_arm::reloc_uses_thumb_bit): New method declarations.
9949         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9950         New type definitions.
9951         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9952         member declarations.
9953         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9954         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9955         New method definitions.
9956
9957 2009-11-03  Ian Lance Taylor  <iant@google.com>
9958
9959         * options.h (class General_options): Add --warn_constructors.
9960
9961 2009-11-03  Ian Lance Taylor  <iant@google.com>
9962
9963         PR 10893
9964         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9965         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9966
9967 2009-11-03  Ian Lance Taylor  <iant@google.com>
9968
9969         PR 10895
9970         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9971         --msgid-bugs-address.
9972         (install-pdf): New target.
9973         (install-data_yes): Look up one directory to find mkinstalldirs.
9974
9975 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9976
9977         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9978         tree.
9979
9980 2009-10-30  Doug Kwan  <dougkwan@google.com>
9981
9982         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9983
9984 2009-10-30  Doug Kwan  <dougkwan@google.com>
9985
9986         * arm.cc (Stub_addend_reader): New struct template definition
9987         and partial specializations.
9988         (Stub_addend_reader::operator()): New method definition for a
9989         partially specialized template.
9990
9991 2009-10-30  Doug Kwan  <dougkwan@google.com>
9992
9993         * arm.cc (Arm_relobj::processor_specific_flags): New method
9994         definition.
9995         (Arm_relobj::do_read_symbols): New method declaration.
9996         (Arm_relobj::processor_specific_flags_): New data member declaration.
9997         (Arm_dynobj): New class definition.
9998         (Target_arm::do_finalize_sections): Add input_objects parameter.
9999         (Target_arm::do_adjust_elf_header): New method declaration.
10000         (Target_arm::are_eabi_versions_compatible,
10001         (Target_arm::merge_processor_specific_flags): New method declaration.
10002         (Target_arm::do_make_elf_object): New overloaded method definitions
10003         and declaration.
10004         (Arm_relobj::do_read_symbols): New method definition.
10005         (Arm_dynobj::do_read_symbols): Ditto.
10006         (Target_arm::do_finalize_sections): Add input_objects parameters.
10007         Merge processor-specific flags from all input objects.
10008         (Target_arm::are_eabi_versions_compatible,
10009         Target_arm::merge_processor_specific_flags,
10010         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10011         New method definitions.
10012         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10013         Input_objects pointer type parameter.
10014         * layout.cc (Layout::finalize): Pass input objects to target's.
10015         finalize_sections function.
10016         * output.cc (Output_file_header::do_sized_write): Set ELF file
10017         header's processor-specific flags.
10018         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10019         Input_objects pointer type parameter.
10020         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10021         * target.h (Input_objects): New forward class declaration.
10022         (Target::processor_specific_flags,
10023         Target::are_processor_specific_flags_sect): New method definitions.
10024         (Target::finalize_sections): Add input_objects parameter.
10025         (Target::Target): Initialize processor_specific_flags_ and
10026         are_processor_specific_flags_set_.
10027         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10028         parameter.
10029         (Target::set_processor_specific_flags): New method definition.
10030         (Target::processor_specific_flags_,
10031         Target::are_processor_specific_flags_set_): New data member
10032         declarations.
10033         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10034         Input_objects pointer type parameter.
10035
10036 2009-10-30  Doug Kwan  <dougkwan@google.com>
10037
10038         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10039
10040 2009-10-28  Ian Lance Taylor  <iant@google.com>
10041
10042         * object.h (class Relobj): Drop options parameter from
10043         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10044         do_scan_relocs, do_relocate.  Change all callers.
10045         (class Sized_relobj): Drop options parameters from
10046         do_gc_process_relocs, do_scan_relocs, do_relocate,
10047         do_relocate_sections, relocate_sections, emit_relocs_scan,
10048         emit_relocs_scan_reltype.  Change all callers.
10049         (struct Relocate_info): Remove options field and all references to
10050         it.
10051         * reloc.h (class Read_relocs): Remove options constructor
10052         parameter and options_ field.  Change all callers.
10053         (class Gc_process_relocs, class Scan_relocs): Likewise.
10054         (class Relocate_task): Likewise.
10055         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10056         all callers.
10057         (scan_relocatable_relocs): Likewise.
10058         * target.h (class Sized_target): Remove options parameter from
10059         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10060         all callers.
10061         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10062         callers.
10063         * arm.cc: Update functions to remove options parameters.
10064         * i386.cc: Likewise.
10065         * powerpc.cc: Likewise.
10066         * sparc.cc: Likewise.
10067         * x86_64.cc: Likewise.
10068         * testsuite/testfile.cc: Likewise.
10069
10070 2009-10-28  Doug Kwan  <dougkwan@google.com>
10071
10072         * arm.cc (Arm_relobj): New class definition.
10073         (Arm_relobj::scan_sections_for_stubs,
10074         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10075         New method definitions.
10076
10077 2009-10-28  Cary Coutant  <ccoutant@google.com>
10078
10079         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10080         (Plugin::cleanup_done_): New member.
10081         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10082         (Plugin_manager::cleanup_done_): Remove.
10083         (Plugin_manager::add_input_file): Edit error message.
10084         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10085         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10086
10087 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10088
10089         * fileread.cc: (File_read::View::~View): Use the new
10090         data_ownership_ filed.
10091         (File_read::~File_read): Dispose the new whole_file_view_.
10092         (File_read::open): Mmap the whole file if needed.
10093         (File_read::open): Use whole_file_view_ instead of contents_.
10094         (File_read::find_view): Use whole_file_view_ if applicable.
10095         (File_read::do_read): Use whole_file_view_ instead of contents_.
10096         (File_read::make_view): Use whole_file_view_ instead of contents_,
10097         update File_read::View::View call.
10098         (File_read::find_or_make_view): Update File_read::View::View
10099         call.
10100         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10101         remove contents_
10102         (File_read::View::Data_ownership): New enum.
10103         (File_read::View::View): Replace bool mapped_ with Data_ownership
10104         argument.
10105         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10106         (File_read::View::data_ownership_): New field.
10107         (File_read::contents_): Remove (replaced by whole_file_view_).
10108         (File_read::whole_file_view_): New field.
10109         * options.h (class General_options): Add --keep-files-mapped.
10110
10111 2009-10-27  Cary Coutant  <ccoutant@google.com>
10112
10113         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10114         * testsuite/Makefile.am (plugin_test_5): New test case.
10115         * testsuite/Makefile.in: Regenerate.
10116
10117 2009-10-25  Doug Kwan  <dougkwan@google.com>
10118
10119         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10120         from private to protected to allow access by child class.
10121         (Sized_relobj::do_relocate_sections): New method declaration.
10122         (Sized_relobj::relocate_sections): Virtualize.
10123         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10124         Sized_relobj::relocate_sections.  Instantiate template explicitly
10125         for different target sizes and endianity.
10126
10127 2009-10-24  Doug Kwan  <dougkwan@google.com>
10128
10129         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10130         (Arm_input_section::as_arm_input_section): New method.
10131         (Arm_output_section): New class definition.
10132         (Arm_output_section::create_stub_group,
10133         Arm_output_section::group_sections): New method definitions.
10134
10135 2009-10-22  Doug Kwan  <dougkwan@google.com>
10136
10137         * arm.cc (Arm_input_section): New class definition.
10138         (Arm_input_section::init, Arm_input_section:do_write,
10139         Arm_input_section::set_final_data_size,
10140         Arm_input_section::do_reset_address_and_file_offset): New method
10141         definitions.
10142
10143 2009-10-21  Doug Kwan  <dougkwan@google.com>
10144
10145         * arm.cc (Stub_table, Arm_input_section): New forward class
10146         declarations.
10147         (Stub_table): New class defintion.
10148         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10149         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10150         New method definition.
10151
10152 2009-10-21  Doug Kwan  <dougkwan@google.com>
10153
10154         * arm.cc: Update copyright comments.
10155         (Target_arm): New forward class template declaration.
10156         (Arm_address): New type.
10157         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10158         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10159         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10160         constants.
10161         (Insn_template): Same.
10162         (DEF_STUBS): New macro.
10163         (Stub_type): New enum type.
10164         (Stub_template): New class definition.
10165         (Stub): Same.
10166         (Reloc_stub): Same.
10167         (Stub_factory): Same.
10168         (Target_arm::Target_arm): Initialize may_use_blx_ and
10169         should_force_pic_veneer_.
10170         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10171         Target_arm::should_force_pic_veneer,
10172         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10173         Target_arm::using_thumb_only, Target_arm:;default_target): New
10174         method defintions.
10175         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10176         New data member declarations.
10177         (Insn_template::size, Insn_template::alignment): New method defintions.
10178         (Stub_template::Stub_template): New method definition.
10179         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10180         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10181         (Stub_factory::Stub_factory): New method definition.
10182         * gold.h (string_hash): New template.
10183         * output.h (Input_section_specifier::hash_value): Use
10184         gold::string_hash.
10185         (Input_section_specifier::string_hash): Remove.
10186         * stringpool.cc (Stringpool_template::string_hash): Use
10187         gold::string_hash.
10188
10189 2009-10-20  Doug Kwan  <dougkwan@google.com>
10190
10191         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10192         symbols of relaxed input sections.
10193         * output.h (Output_section::find_relaxed_input_section): Make
10194         method public.
10195
10196 2009-10-16  Doug Kwan  <dougkwan@google.com>
10197
10198         * dynobj.cc (Versions::Versions): Initialize version_script_.
10199         Only insert base version symbol definition for a shared object
10200         if version script defines any version versions.
10201         (Versions::define_base_version): New method definition.
10202         (Versions::add_def): Check that base version is not needed.
10203         (Versions::add_need): Define base version lazily.
10204         * dynobj.h (Versions::define_base_version): New method declaration.
10205         (Versions::needs_base_version_): New data member declaration.
10206         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10207         (check_DATA): Add no_version_test.stdout.
10208         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10209         New make rules.
10210         * testsuite/Makefile.in: Regenerate.
10211         * testsuite/no_version_test.c: New file.
10212         * testsuite/no_version_test.sh: Ditto.
10213
10214 2009-10-16  Doug Kwan  <dougkwan@google.com>
10215
10216         * expression.cc (class Segment_start_expression): New class definition.
10217         (Segment_start_expression::value): New method definition.
10218         (script_exp_function_segment_start): Return a new
10219         Segment_start_expression.
10220         * gold/script-c.h (script_saw_segment_start_expression): New function
10221         prototype.
10222         * script-sections.cc (Script_sections::Script_sections): Initialize
10223         SAW_SEGMENT_START_EXPRESSION_ to false.
10224         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10225         and -Tbbs options to specify section addresses if given in
10226         command line and no SEGMENT_START expression is seen in a script.
10227         * script-sections.h (Script_sections::saw_segment_start_expression,
10228         Script_sections::set_saw_segment_start_expression): New method
10229         definition.
10230         (Script_sections::saw_segment_start_expression_): New data member
10231         declaration.
10232         * script.cc (script_saw_segment_start_expression): New function.
10233         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10234         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10235         script_test_7.sh and script_test_8.sh.
10236         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10237         script_test_8.stdout.
10238         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10239         (script_test_6, script_test_6.stdout, script_test_7,
10240         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10241         * Makefile.in: Regenerate.
10242         * testsuite/script_test_6.sh: New file.
10243         * testsuite/script_test_6.t: Same.
10244         * testsuite/script_test_7.sh: Same.
10245         * testsuite/script_test_7.t: Same.
10246         * testsuite/script_test_8.sh: Same.
10247
10248 2009-10-16  Doug Kwan  <dougkwan@google.com>
10249
10250         * output.cc (Output_segment::set_section_list_address): Cast
10251         expressions to unsigned long long type to avoid format warnings.
10252
10253 2009-10-15  Ian Lance Taylor  <iant@google.com>
10254
10255         * script.cc (Script_options::add_symbol_assignment): Always add a
10256         dot assignment to script_sections_.
10257         * script-sections.cc (Script_sections::add_dot_assignment):
10258         Initialize if necessary.
10259
10260         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10261         program headers with no load segment if there is a linker script.
10262
10263         * layout.cc (Layout::set_segment_offsets): Align the file offset
10264         to the segment aligment for -N or -n with no load segment.
10265         * output.cc (Output_segment::add_output_section): Don't crash if
10266         the first section is a TLS section.
10267         (Output_segment::set_section_list_addresses): Print an error
10268         message if the address moves backward in a linker script.
10269         * script-sections.cc
10270         (Output_section_element_input::set_section_addresses): Don't
10271         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10272         (Orphan_output_section::set_section_addresses): Likewise.
10273
10274 2009-10-15  Doug Kwan  <dougkwan@google.com>
10275
10276         * layout.cc (Layout::finish_dynamic_section): Generate tags
10277         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10278         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10279         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10280
10281 2009-10-14  Ian Lance Taylor  <iant@google.com>
10282
10283         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10284         fields.
10285         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10286         data_shdr fields of relinfo.
10287         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10288         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10289         R_386_TLS_LDO_32, adjust based on section flags.
10290         (Target_i386::Relocate::fix_up_ldo): Remove.
10291
10292 2009-10-13  Ian Lance Taylor  <iant@google.com>
10293
10294         Add support for -pie.
10295         * options.h (class General_options): Add -pie and
10296         --pic-executable.
10297         (General_options::output_is_position_independent): Test -pie.
10298         (General_options::output_is_executable): Return true if not shared
10299         and not relocatable.
10300         (General_options::output_is_pie): Remove.
10301         * options.cc (General_options::finalize): Reject incompatible uses
10302         of -pie.
10303         * gold.cc (queue_middle_tasks): A -pie link is not static.
10304         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10305         * symtab.cc (Symbol::final_value_is_known): Return false if
10306         output_is_position_independent.
10307         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10308         output_is_position_independent.
10309         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10310         output_is_position_independent.
10311         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10312         output_is_position_independent.
10313         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10314         two_file_pie_test.
10315         (basic_pie_test.o, basic_pie_test): New targets.
10316         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10317         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10318         (two_file_pie_test): New target.
10319         * testsuite/Makefile.in: Rebuild.
10320         * README: Remove note saying that -pie is not supported.
10321
10322 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10323
10324         * options.h (class General_options): Add -init and -fini.
10325         * layout.cc (Layout::finish_dynamic_section): Emit
10326         given init and fini functions.
10327
10328 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10329
10330         * gc.h (gc_process_relocs): Check if icf is enabled using new
10331         function.
10332         * gold.cc (queue_initial_tasks): Likewise.
10333         (queue_middle_tasks): Likewise.
10334         * object.cc (do_layout): Likewise.
10335         * symtab.cc (is_section_folded): Likewise.
10336         * main.cc (main): Likewise.
10337         * reloc.cc (Read_relocs::run): Likewise.
10338         (Sized_relobj::do_scan_relocs): Likewise.
10339         * icf.cc (is_function_ctor_or_dtor): New function.
10340         (Icf::find_identical_sections): Check if function is ctor or dtor when
10341         safe icf is chosen.
10342         * options.h (General_options::icf): Change option to be an enum.
10343         (Icf_status): New enum.
10344         (icf_enabled): New method.
10345         (icf_safe_folding): New method.
10346         (set_icf_status): New method.
10347         (icf_status_): New variable.
10348         * (options.cc) (General_options::finalize): Set icf_status_.
10349         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10350         icf_test and icf_keep_unique_test to use the --icf enum flag.
10351         * testsuite/icf_safe_test.sh: New file.
10352         * testsuite/icf_safe_test.cc: New file.
10353
10354 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10355
10356         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10357         includes to gc.h and icf.h.
10358         * arm.cc: Include gc.h.
10359         * gold.cc: Likewise.
10360         * i386.cc: Likewise.
10361         * powerpc.cc: Likewise.
10362         * sparc.cc: Likewise.
10363         * x86_64.cc: Likewise.
10364         * gc.h: Include icf.h.
10365
10366 2009-10-11  Ian Lance Taylor  <iant@google.com>
10367
10368         * plugin.cc: Include "gold.h" before other header files.
10369
10370 2009-10-10  Chris Demetriou  <cgd@google.com>
10371
10372         * options.h (Input_file_argument::Input_file_type): New enum.
10373         (Input_file_argument::is_lib_): Replace with...
10374         (Input_file_argument::type_): New member.
10375         (Input_file_argument::Input_file_argument): Take Input_file_type
10376         'type' rather than boolean 'is_lib' as second argument.
10377         (Input_file_argument::is_lib): Use type_.
10378         (Input_file_argument::is_searched_file): New function.
10379         (Input_file_argument::may_need_search): Handle is_searched_file.
10380         * options.cc (General_options::parse_library): Support -l:filename.
10381         (General_options::parse_just_symbols): Update for Input_file_argument
10382         changes.
10383         (Command_line::process): Likewise.
10384         * archive.cc (Archive::get_file_and_offset): Likewise.
10385         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10386         * script.cc (read_script_file, script_add_file): Likewise.
10387         * fileread.cc (Input_file::Input_file): Likewise.
10388         (Input_file::will_search_for): Handle is_searched_file.
10389         (Input_file::open): Likewise.
10390         * readsyms.cc (Read_symbols::get_name): Likewise.
10391         * testsuite/Makefile.am (searched_file_test): New test.
10392         * testsuite/Makefile.in: Regenerate.
10393         * testsuite/searched_file_test.cc: New file.
10394         * testsuite/searched_file_test_lib.cc: New file.
10395
10396 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10397             Ian Lance Taylor  <iant@google.com>
10398
10399         * descriptor.cc: Include <cstdio> and "binary-io.h".
10400         (Descriptors::open): Open the files in binary mode always.
10401         * script.cc (Lex::get_token): Treat \r as whitespace.
10402
10403 2009-10-09  Ian Lance Taylor  <iant@google.com>
10404
10405         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10406
10407 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10408             Ian Lance Taylor  <iant@google.com>
10409
10410         * configure.ac: Check for readv function also.
10411         * fileread.cc (readv): Define if not HAVE_READV.
10412         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10413         does not exist.
10414         * config.in: Regenerate.
10415         * configure: Regenerate.
10416
10417 2009-10-09  Doug Kwan  <dougkwan@google.com>
10418
10419         * layout.cc (Layout::make_output_section): Call target hook to make
10420         ordinary output section.
10421         (Layout::finalize): Adjust parameter list of call the
10422         Target::may_relax().
10423         * layout.h (class Layout::section_list): New method.
10424         * merge.h (Output_merge_base::entsize): Change visibility to public.
10425         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10426         New methods.
10427         (Output_merge_string::do_is_string): New method.
10428         * object.cc (Sized_relobj::do_setup): renamed from
10429         Sized_relobj::set_up.
10430         * object.h (Sized_relobj::adjust_shndx,
10431         Sized_relobj::initializ_input_to_output_maps,
10432         Sized_relobj::free_input_to_output_maps): Change visibilities to
10433         protected.
10434         (Sized_relobj::setup): Virtualize.
10435         (Sized_relobj::do_setup): New method declaration.
10436         (Sized_relobj::invalidate_section_offset,
10437         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10438         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10439         * options.cc (parse_int): New function.
10440         * options.h (parse_int): New declaration.
10441         (DEFINE_int): New macro.
10442         (stub_group_size): New option.
10443         * output.cc (Output_section::Output_section): Initialize memebers
10444         merge_section_map_, merge_section_by_properties_map_,
10445         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10446         (Output_section::add_input_section): Handled deferred code-fill
10447         generation and remove an old comment.
10448         (Output_section::add_relaxed_input_section): New method definition.
10449         (Output_section::add_merge_input_section): Use merge section by
10450         properties map to speed to search.  Update merge section maps
10451         as appropriate.
10452         (Output_section::build_relaxation_map): New method definition.
10453         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10454         Same.
10455         (Output_section::relax_input_section): Renamed to
10456         Output_section::convert_input_sections_to_relaxed_sections and change
10457         interface to take a vector of pointers to relaxed sections.
10458         (Output_section::find_merge_section,
10459         Output_section::find_relaxed_input_section): New method definitions.
10460         (Output_section::is_input_address_mapped,
10461         Output_section::output_offset, Output_section::output_address):
10462         Use output section data maps to speed up searching.
10463         (Output_section::find_starting_output_address): Add comments.
10464         (Output_section::do_write,
10465         Output_section::write_to_postprocessing_buffer): Do code-fill
10466         generation as appropriate.
10467         (Output_section::get_input_sections): Invalidate relaxed input section
10468         map.
10469         (Output_section::restore_states): Adjust type of checkpoint .
10470         Invalidate relaxed input section map.
10471         * output.h (Output_merge_base): New class declaration.
10472         (Input_section_specifier): New class defintion.
10473         (class Output_relaxed_input_section) Change base class to
10474         Output_section_data_build.
10475         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10476         base class initializer.
10477         (Output_section::add_relaxed_input_section): New method declaration.
10478         (Output_section::Input_section): Change visibility to protected.
10479         (Output_section::Input_section::relobj,
10480         Output_section::Input_section::shndx): Handle relaxed input sections.
10481         Output_section::input_sections) Change visibility to protected.  Also
10482         define overload to return a non-const pointer.
10483         (Output_section::Merge_section_properties): New class defintion.
10484         (Output_section::Merge_section_by_properties_map,
10485         Output_section::Output_section_data_by_input_section_map,
10486         Output_section::Relaxation_map): New types.
10487         (Output_section::relax_input_section): Rename method to
10488         Output_section::convert_input_sections_to_relaxed_sections and change
10489         interface to take a vector of relaxed section pointers.
10490         (Output_section::find_merge_section,
10491         Output_section::find_relaxed_input_section,
10492         Output_section::build_relaxation_map,
10493         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10494         New method declarations.
10495         (Output_section::merge_section_map_
10496         Output_section::merge_section_by_properties_map_,
10497         Output_section::relaxed_input_section_map_,
10498         Output_section::is_relaxed_input_section_map_valid_,
10499         Output_section::generate_code_fills_at_write_): New data members.
10500         * script-sections.cc
10501         (Output_section_element_input::set_section_addresses): Call
10502         current_data_size and addralign methods of relaxed input sections.
10503         (Orphan_output_section::set_section_addresses): Call current_data_size
10504         and addralign methods of relaxed input sections.
10505         * symtab.cc (Symbol_table::compute_final_value): Extract template
10506         from the body of Symbol_table::sized_finalize_symbol.
10507         (Symbol_table::sized_finalized_symbol): Call
10508         Symbol_table::compute_final_value.
10509         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10510         (Symbol_table::compute_final_value): New templated method declaration.
10511         * target.cc (Target::do_make_output_section): New method defintion.
10512         * target.h (Target::make_output_section): New method declaration.
10513         (Target::relax): Add more parameters for input objects, symbol table
10514         and layout.  Adjust call to do_relax.
10515         (Target::do_make_output_section): New method declaration.
10516         (Target::do_relax): Add parameters for input objects, symbol table
10517         and layout.
10518
10519 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10520
10521         * pread.c: Include stdio.h.
10522
10523 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10524
10525         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10526         defined.
10527
10528 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10529
10530         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10531         Change read_shndx type to unsigned int.
10532         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10533         int.
10534         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10535         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10536         Change read_shndx type to unsigned int.
10537         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10538         int.
10539         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10540         * layout.cc (Layout::create_symtab_sections): Cast the result of
10541         local_symcount * symsize to off_t in the gold_assert.
10542
10543 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10544
10545         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10546         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10547         R_ARM_BASE_ABS.
10548         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10549         (Arm_relocate_functions::thm_abs5): New function.
10550         (Arm_relocate_functions::abs12): New function.
10551         (Arm_relocate_functions::abs16): New function.
10552         (Arm_relocate_functions::base_abs): New function.
10553         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10554         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10555         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10556         R_ARM_BASE_ABS.
10557         (Scan::global): Likewise.
10558         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10559         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10560         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10561         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10562         R_ARM_BASE_ABS.
10563
10564 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10565
10566         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10567         (Arm_relocate_functions::movt_prel): New function.
10568         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10569         (Arm_relocate_functions::thm_movt_prel): New function.
10570         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10571         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10572         (Scan::global, Relocate::relocate): Likewise.
10573         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10574
10575 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10576
10577         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10578         Incremental_checker.
10579         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10580         unsigned int.
10581         (class Incremental_inputs_header): New class.
10582         (Incremental_inputs_header_writer): Edit comment.
10583         (Incremental_inputs_entry): New class.
10584         (Incremental_inputs_entry_writer): Edit comment.
10585         (Sized_incremental_binary::do_find_incremental_inputs_section):
10586         Add *strtab_shndx parameter, fill it.
10587         (Sized_incremental_binary::do_check_inputs): New method.
10588         (Incremental_checker::can_incrementally_link_output_file): Use
10589         Sized_incremental_binary::check_inputs.
10590         (Incremental_inputs::report_command_line): Save command line in
10591         command_line_.
10592         * incremental.h:
10593         (Incremental_binary::find_incremental_inputs_section): New
10594         method.
10595         (Incremental_binary::do_find_incremental_inputs_section): Add
10596         strtab_shndx parameter.
10597         (Incremental_binary::do_check_inputs): New pure virtual method.
10598         (Sized_incremental_binary::do_check_inputs): Declare.
10599         (Incremental_checker::Incremental_checker): Add incremental_inputs
10600         parameter, use it to initialize incremental_inputs_.
10601         (Incremental_checker::incremental_inputs_): New field.
10602         (Incremental_checker::command_line): New method.
10603         (Incremental_checker::inputs): New method.
10604         (Incremental_checker::command_line_): New field.
10605
10606 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10607
10608         * incremental.cc: Include <cstdarg> and "target-select.h".
10609         (vexplain_no_incremental): New function.
10610         (explain_no_incremental): New function.
10611         (Incremental_binary::error): New method.
10612         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10613         method.
10614         (make_sized_incremental_binary): New function.
10615         (open_incremental_binary): New function.
10616         (can_incrementally_link_file): Add checks if output is ELF and has
10617         inputs section.
10618         * incremental.h: Include "elfcpp_file.h" and "output.h".
10619         (Incremental_binary): New class.
10620         (Sized_incremental_binary): New class.
10621         (open_incremental_binary): Declare.
10622         * object.cc (is_elf_object): Use
10623         elfcpp::Elf_recognizer::is_elf_file.
10624         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10625         * output.h (Output_file::filesize): New method.
10626
10627 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10628
10629         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10630         New function.
10631         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10632         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10633         function.
10634         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10635         function.
10636         (Arm_relocate_functions::movw_abs_nc): New function.
10637         (Arm_relocate_functions::movt_abs): New function.
10638         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10639         (Arm_relocate_functions::thm_movt_abs): New function.
10640         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10641         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10642         (Scan::global): Likewise.
10643         (Relocate::relocate): Likewise.
10644         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10645
10646 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10647
10648         * arm.cc (Arm_relocate_functions::got_prel) New function.
10649         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10650         (Relocate::relocate): Likewise.
10651         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10652
10653 2009-10-06  Ian Lance Taylor  <iant@google.com>
10654
10655         * options.h (class General_options): Define
10656         split_stack_adjust_size parameter.
10657         * object.h (class Object): Add uses_split_stack_ and
10658         has_no_split_stack_ fields.  Add uses_split_stack and
10659         has_no_split_stack accessor functions.  Declare
10660         handle_split_stack_section.
10661         (class Reloc_symbol_changes): Define.
10662         (class Sized_relobj): Define Function_offsets.  Declare
10663         split_stack_adjust, split_stack_adjust_reltype, and
10664         find_functions.
10665         * object.cc (Object::handle_split_stack_section): New function.
10666         (Sized_relobj::do_layout): Call handle_split_stack_section.
10667         * dynobj.cc (Sized_dynobj::do_layout): Call
10668         handle_split_stack_section.
10669         * reloc.cc (Sized_relobj::relocate_sections): Call
10670         split_stack_adjust for executable sections in split_stack
10671         objects.  Pass reloc_map to relocate_section.
10672         (Sized_relobj::split_stack_adjust): New function.
10673         (Sized_relobj::split_stack_adjust_reltype): New function.
10674         (Sized_relobj::find_functions): New function.
10675         * target-reloc.h: Include "object.h".
10676         (relocate_section): Add reloc_symbol_changes parameter.  Change
10677         all callers.
10678         * target.h (class Target): Add calls_non_split method.  Declare
10679         do_calls_non_split virtual method.  Declare match_view and
10680         set_view_to_nop.
10681         * target.cc: Include "elfcpp.h".
10682         (Target::do_calls_non_split): New function.
10683         (Target::match_view): New function.
10684         (Target::set_view_to_nop): New function.
10685         * gold.cc (queue_middle_tasks): Give an error if mixing
10686         split-stack and non-split-stack objects with -r.
10687         * i386.cc (Target_i386::relocate_section): Add
10688         reloc_symbol_changes parameter.
10689         (Target_i386::do_calls_non_split): New function.
10690         * x86_64.cc (Target_x86_64::relocate_section): Add
10691         reloc_symbol_changes parameter.
10692         (Target_x86_64::do_calls_non_split): New function.
10693         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10694         parameter.
10695         * powerpc.cc (Target_powerpc::relocate_section): Add
10696         reloc_symbol_changes parameter.
10697         * sparc.cc (Target_sparc::relocate_section): Add
10698         reloc_symbol_changes parameter.
10699         * configure.ac: Call AM_CONDITIONAL for the default target.
10700         * configure: Rebuild.
10701         * testsuite/Makefile.am (TEST_AS): New variable.
10702         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10703         (check_DATA): Add split_i386 and split_x86_64 files.
10704         (SPLIT_DEFSYMS): Define.
10705         (split_i386_[1234n].o): New targets.
10706         (split_i386_[124]): New targets.
10707         (split_i386_[1234r].stdout): New targets.
10708         (split_x86_64_[1234n].o): New targets.
10709         (split_x86_64_[124]): New targets.
10710         (split_x86_64_[1234r].stdout): New targets.
10711         (MOSTLYCLEANFILES): Add new executables.
10712         * testsuite/split_i386.sh: New file.
10713         * testsuite/split_x86_64.sh: New file.
10714         * testsuite/split_i386_1.s: New file.
10715         * testsuite/split_i386_2.s: New file.
10716         * testsuite/split_i386_3.s: New file.
10717         * testsuite/split_i386_4.s: New file.
10718         * testsuite/split_i386_n.s: New file.
10719         * testsuite/split_x86_64_1.s: New file.
10720         * testsuite/split_x86_64_2.s: New file.
10721         * testsuite/split_x86_64_3.s: New file.
10722         * testsuite/split_x86_64_4.s: New file.
10723         * testsuite/split_x86_64_n.s: New file.
10724         * testsuite/testfile.cc (Target_test): Update relocation_section
10725         function.
10726         * testsuite/Makefile.in: Rebuild.
10727
10728 2009-10-06  Ian Lance Taylor  <iant@google.com>
10729
10730         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10731         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10732         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10733         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10734         the address on ldo_addrs_.
10735         (Target_i386::Relocate::fix_up_ldo): New function.
10736
10737 2009-10-06   Rafael Espindola  <espindola@google.com>
10738
10739         * plugin.cc (add_input_library): New.
10740         (Plugin::load): Add add_input_library to tv.
10741         (Plugin_manager::add_input_file): Add the is_lib argument.
10742         (add_input_file): Update call to Plugin_manager::add_input_file.
10743         (add_input_library): New.
10744         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10745
10746 2009-09-30  Doug Kwan  <dougkwan@google.com>
10747
10748         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10749         symbol and call Symbol::may_need_copy_reloc to determine if
10750         a copy reloc is needed.
10751         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10752         nocopyreloc is given in command line.
10753         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10754         given in command line.
10755         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10756         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10757         of the removed Target_i386::may_need_copy_reloc.
10758         * options.h (copyreloc): New option with default value false.
10759         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10760         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10761         instead of the removed Target_powerpc::may_need_copy_reloc.
10762         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10763         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10764         instead of the removed Target_sparc::may_need_copy_reloc.
10765         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10766         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10767         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10768         instead of the removed Target_x86_64::may_need_copy_reloc.
10769
10770 2009-09-30  Ian Lance Taylor  <iant@google.com>
10771
10772         * object.h (class Object): Remove target_ field, and target,
10773         sized_target, and set_target methods.
10774         (Object::sized_target): Remove.
10775         (class Sized_relobj): Update declarations.  Remove sized_target.
10776         * object.cc (Sized_relobj::setup): Remove target parameter.
10777         Change all callers.
10778         (Input_objects::add_object): Don't do anything with the target.
10779         (make_elf_sized_object): Add punconfigured parameter.  Change all
10780         callers.  Set or test parameter target.
10781         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10782         Change all callers.
10783         * parameters.cc (Parameters::set_target): Change parameter type to
10784         be non-const.
10785         (Parameters::default_target): Remove.
10786         (set_parameters_target): Change parameter type to be non-const.
10787         (parameters_force_valid_target): New function.
10788         (parameters_clear_target): New function.
10789         * parameters.h (class Parameters): Update declarations.  Remove
10790         default_target method.  Add sized_target and clear_target
10791         methods.  Change target_ to be non-const.
10792         (set_parameters_target): Update declaration.
10793         (parameters_force_valid_target): Declare.
10794         (parameters_clear_target): Declare.
10795         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10796         as NULL if we aren't searching.
10797         (Add_symbols::run): Don't check for compatible target.
10798         * fileread.cc (Input_file::open_binary): Call
10799         parameters_force_valid_target.
10800         * gold.cc (queue_middle_tasks): Likewise.
10801         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10802         set_target on object.
10803         * dynobj.h (class Sized_dynobj): Update declarations.
10804         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10805         make_elf_object returns NULL.
10806         (Archive::include_member): Don't check whether object target is
10807         compatible.
10808         * output.cc (Output_section::add_input_section): Get target from
10809         parameters.
10810         (Output_section::relax_input_section): Likewise.
10811         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10812         parameters.
10813         (Sized_relobj::do_scan_relocs): Likewise.
10814         (Sized_relobj::relocate_sections): Likewise.
10815         * resolve.cc (Symbol_table::resolve): Likewise.
10816         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10817         parameter.  Change all callers.
10818         (Symbol_table::add_from_object): Get target from parameters.
10819         (Symbol_table::add_from_relobj): Don't check object target.
10820         (Symbol_table::add_from_dynobj): Likewise.
10821         (Symbol_table::define_special_symbol): Get target from
10822         parameters.
10823         * symtab.h (class Symbol_table): Update declaration.
10824         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10825         parameter.  Change all callers.  Clear parameter target.
10826         (Binary_test): Test target here.
10827         * testsuite/object_unittest.cc (gold_testsuite): Remove
10828         target_test_pointer parameter.  Change all callers.
10829         (Object_test): Test target here.
10830
10831 2009-09-26  Ian Lance Taylor  <iant@google.com>
10832
10833         * testsuite/initpri1.c: Don't try to use constructor priorities if
10834         compiling with gcc before 4.3.
10835
10836 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10837
10838         * testsuite/retain_symbols_file_test.sh (check_present): Change
10839         output file name to retain_symbols_file_test.stdout.
10840         (check_absent): Likewise.
10841
10842 2009-09-18  Craig Silverstein  <csilvers@google.com>
10843
10844         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10845         * options.cc: Include <cerrno> and <fstream>.
10846         (General_options::finalize): Parse -retain-symbols-file tag.
10847         * options.h: New flag.
10848         (General_options): New method should_retain_symbol, new
10849         variable symbols_to_retain.
10850         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10851         should_retain_symbol map.
10852         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10853         * testsuite/Makefile.in: Regenerate.
10854         * testsuite/retain_symbols_file_test.sh: New file.
10855
10856 2009-09-18  Nick Clifton  <nickc@redhat.com>
10857
10858         * po/es.po: Updated Spanish translation.
10859
10860 2009-09-17  Doug Kwan  <dougkwan@google.com>
10861
10862         * debug.h (DEBUG_RELAXATION): New constant.
10863         (DEBUG_ALL): Add DEBUG_RELAXATION.
10864         (debug_string_to_enum): Add relaxation debug option.
10865         * layout.cc
10866         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10867         Layout::Relaxation_debug_check::read_sections,
10868         Layout::Relaxation_debug_check::read_sections): New method definitions.
10869         (Layout::Layout): Initialize data members
10870         record_output_section_data_from_scrips_,
10871         script_output_section_data_list_ and relaxation_debug_check_.
10872         (Layout::save_segments, Layout::restore_segments,
10873         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10874         Layout::relaxation_loop_body): New method definitions.
10875         (Layout::finalize): Support relaxation.  Move section layout code to
10876         Layout::relaxation_loop_body.
10877         (Layout::set_asection_address_from_script): Move code for orphan
10878         section placement out.
10879         (Layout::place_orphan_sections_in_script): New method definition.
10880         * layout.h (Output_segment_headers, Output_file_header):
10881         New forward class declarations.
10882         (Layout::~Layout): Define.
10883         (Layout::new_output_section_data_from_script): New method definition.
10884         (Layout::place_orphan_sections_in_script): New method declaration.
10885         (Layout::Segment_states): New type declaration.
10886         (Layout::save_segments, Layout::restore_segments,
10887         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10888         Layout::relaxation_loop_body): New method declarations.
10889         (Layout::Output_section_data_list): New type declaration.
10890         (Layout::Relaxation_debug_check): New class definition.
10891         (Layout::record_output_section_data_from_script_,
10892         Layout::script_output_section_data_list_, Layout::segment_states_,
10893         Layout::relaxation_debug_check_): New data members.
10894         * output.cc: (Output_section_headers::do_size): New method definition.
10895         (Output_section_headers::Output_section_headers): Move size
10896         computation to Output_section_headers::do_size.
10897         (Output_segment_headers::do_size): New method definition.
10898         (Output_file_header::Output_file_header): Move size computation to
10899         Output_file_header::do_size and call it.
10900         (Output_file_header::do_size): New method definition.
10901         (Output_data_group::Output_data_group): Adjust call to
10902         Output_section_data.
10903         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10904         (Output_symtab_xindex::do_write): Add array bound check.
10905         (Output_section::Input_section::print_to_mapfile): Handle
10906         RELAXED_INPUT_SECTION_CODE.
10907         (Output_section::Output_section): Initialize data member checkpoint_.
10908         (Output_section::~Output_section): Delete checkpoint object pointed
10909         by checkpoint_.
10910         (Output_section::add_input_section): Always add an Input_section if
10911         relaxing.
10912         (Output_section::add_merge_input_section): Add assert.
10913         (Output_section::relax_input_section): New method definition.
10914         (Output_section::set_final_data_size): Set load address to zero for
10915         an unallocated section.
10916         (Output_section::do_address_and_file_offset_have_reset_values):
10917         New method definition.
10918         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10919         Handle relaxed input section.
10920         (Output_section::sort_attached_input_sections): Checkpoint input
10921         section list lazily.
10922         (Output_section::get_input_sections): Change type of input_sections to
10923         list of Simple_input_section pointers.  Checkpoint input section list
10924         lazily.  Also handle relaxed input sections.
10925         (Output_section::add_input_section_for_script): Take a reference to
10926         a Simple_input_section object instead of Relobj pointer and section
10927         index as parameter.  Handle relaxed input sections.
10928         (Output_section::save_states, Output_section::restore_states): New
10929         method definitions.
10930         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10931         (Output_data::is_data_size_fixed): New method definition.
10932         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10933         if it is fixed.
10934         (Output_data::address_and_file_offset_have_reset_values): New method
10935         definition.
10936         (Output_data::do_address_and_file_offset_have_reset_values): New method
10937         definition.
10938         (Output_data::set_data_size): Check that data size is not fixed.
10939         (Output_data::fix_data_size): New method definition.
10940         (Output_data::is_data_size_fixed_): New data member.
10941         (Output_section_headers::set_final_data_size): New method definition.
10942         (Output_section_headers::do_size): New method declaration.
10943         (Output_segment_headers::set_final_data_size): New method definition.
10944         (Output_segment_headers::do_size): New method declaration.
10945         (Output_file_header::set_final_data_size)::New method definition.
10946         (Output_file_header::do_size)::New method declaration.
10947         (Output_section_data::Output_section_data): Add new parameter
10948         is_data_size_fixed and use it to fix data size.
10949         (Output_data_const::Output_data_const): Adjust call to base class
10950         constructor and fix data size.
10951         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10952         base class constructor and fix data size.
10953         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10954         base class constructor and fix data size.
10955         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10956         class constructor and fix data size.
10957         (Output_data_group::set_final_data_size): New method definition.
10958         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10959         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10960         class constructor and fix data size.
10961         (Output_relaxed_input_section): New class definition.
10962         (Output_section::Simple_input_section): New class definition.
10963         (Output_section::get_input_sections): Adjust parameter list.
10964         (Output_section::add_input_section_for_script): Same.
10965         (Output_section::save_states, Output_section::restore_states,
10966         Output_section::do_address_and_file_offset_have_reset_values,
10967         (Output_section::Input_section::Input_section): Handle
10968         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10969         Output_relaxed_input_section.
10970         (Output_section::Input_section::is_input_section,
10971         Output_section::Input_section::set_output_section): Handle relaxed
10972         input section.
10973         (Output_section::Input_section::is_relaxed_input_section,
10974         Output_section::Input_section::output_section_data,
10975         Output_section::Input_section::relaxed_input_section): New method
10976         definitions.
10977         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10978         value.
10979         (Output_section::Input_section::u1_): Update comments.
10980         (Output_section::Input_section::u2_): Add new union member poris.
10981         (Output_section::Checkpoint_output_section): New classs definition.
10982         (Output_section::relax_input_section): New method declaration.
10983         (Output_section::checkpoint_): New data member.
10984         (Output_segment): Update comments.
10985         (Output_segment::Output_segment): Un-privatize copy constructor.
10986         (Output_segment::operator=): Un-privatize.
10987         * script-sections.cc (Output_section_element::Input_section_list):
10988         Change element type to Output_section::Simple_input_section.
10989         (Output_section_element_dot_assignment::set_section_addresses):
10990         Register output section data for relaxation clean up.
10991         (Output_data_exression::Output_data_expression): Adjust call to base
10992         constructor to fix data size.
10993         (Output_section_element_data::set_section_addresses): Register
10994         Output_data_expression object for relaxation clean up.
10995         (struct Input_section_info): Replace Relobj pointer and section index
10996         pair with Output_section::Simple_input_section and Convert struct to a
10997         class.
10998         (Input_section_sorter::operator()): Adjust access to
10999         Input_section_info data member to use accessors.
11000         (Output_section_element_input::set_section_addresses): Use layout
11001         parameter.  Adjust code to use Output_section::Simple_input_section
11002         and Input_secction_info classes.  Register filler for relaxation
11003         clean up.
11004         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11005         and section index pair with Output_section::Simple_input_section
11006         class.  Adjust code accordingly.
11007         (Phdrs_element::release_segment): New method definition.
11008         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11009         segment list.
11010         (Script_sections::release_segments): New method definition.
11011         * gold/script-sections.h (Script_sections::release_segments): New
11012         method declaration.
11013         * gold/target.h (Target::may_relax, Target::relax,
11014         Target::do_may_relax, Target::do_relax): New method definitions.
11015
11016 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11017
11018         * arm.cc (has_signed_unsigned_overflow): New function.
11019         (Arm_relocate_functions::abs8): New function.
11020         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11021         (Target_arm::Scan::global): Likewise.
11022         (Target_arm::relocate::relocate): Likewise.
11023         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11024         Likewise.
11025
11026 2009-09-16  Cary Coutant  <ccoutant@google.com>
11027
11028         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11029         * testsuite/Makefile.in: Regenerate.
11030
11031 2009-09-11  Nick Clifton  <nickc@redhat.com>
11032
11033         * po/gold.pot: Updated by the Translation project.
11034
11035 2009-09-08  Cary Coutant  <ccoutant@google.com>
11036
11037         * output.cc (Output_file::open): Add execute permission to empty file.
11038         * testsuite/Makefile.am (permission_test): New test.
11039         * testsuite/Makefile.in: Regenerate.
11040
11041 2009-09-02  Ian Lance Taylor  <iant@google.com>
11042
11043         * output.cc (Output_file::resize): Call map_no_anonymous rather
11044         than map.
11045
11046 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11047
11048         * gold.cc: Include "incremental.h".
11049         (queue_initial_tasks): Call Incremental_checker methods.
11050         * incremental.cc: Include "output.h".
11051         (Incremental_checker::can_incrementally_link_output_file): New
11052         method.
11053         * incremental.h (Incremental_checker): New class.
11054
11055         * output.cc (Output_file::open_for_modification): New method.
11056         (Output_file::map_anonymous): Changed return type to bool.  Record
11057         map in base_ field.
11058         (Output_file::map_no_anonymous): New method, broken out of map.
11059         (Output_file::map): Use map_no_anonymous and map_anonymous.
11060         * output.h (class Output_file): Update declarations.
11061
11062 2009-08-24  Cary Coutant  <ccoutant@google.com>
11063
11064         * options.h (Command_line::Pre_options): New class.
11065         (Command_line::pre_options): New member.
11066         * options.cc (gold::options::ready_to_register): New variable.
11067         (One_option::register_option): Do nothing if not registering options.
11068         Assert if same short option registered twice.
11069         (General_options::General_options): Turn off option registration when
11070         done constructing.
11071         (Command_line::Pre_options::Pre_options): New constructor.
11072
11073 2009-08-24  Cary Coutant  <ccoutant@google.com>
11074
11075         * options.h (General_options::no_keep_memory): Remove incorrect
11076         short option.
11077
11078 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11079
11080         * Makefile.am (am__skiplex, am__skipyacc): New.
11081         * Makefile.in: Regenerate.
11082
11083 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11084
11085         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11086         (INCLUDES): ... this.
11087         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11088         (AM_CPPFLAGS): Renamed from ...
11089         (INCLUDE): ... this.
11090         * Makefile.in, testsuite/Makefile.in: Regenerate.
11091
11092         * Makefile.in: Regenerate.
11093         * aclocal.m4: Likewise.
11094         * config.in: Likewise.
11095         * configure: Likewise.
11096         * testsuite/Makefile.in: Likewise.
11097
11098         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11099         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11100         * Makefile.in: Regenerate.
11101         * testsuite/Makefile.in: Regenerate.
11102
11103 2009-08-19  Cary Coutant  <ccoutant@google.com>
11104
11105         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11106         symbols in shared libraries overridden by hidden or internal symbols
11107         in the main program.
11108
11109 2009-08-19  Chris Demetriou  <cgd@google.com>
11110
11111         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11112         checking source file names in error messages.
11113
11114 2009-08-18  Doug Kwan  <dougkwan@google.com>
11115
11116         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11117         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11118         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11119         an elfcpp::Ehdr as parameter.
11120         * object.cc (Object::set_target): Remove the version that looks up
11121         a target and sets it.
11122         (Sized_relobj::setup): Take a Target object instead of
11123         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11124         (make_elf_sized_object): Find target and ask target to
11125         make an ELF object.
11126         * object.h: (Object::set_target): Remove the version that looks up
11127         a target and sets it.
11128         (Sized_relobj::setup): Take a Target object instead of
11129         an elfcpp:Ehdr as parameter.
11130         * target.cc: Include dynobj.h.
11131         (Target::do_make_elf_object_implementation): New.
11132         (Target::do_make_elf_object): New.
11133         * target.h (Target::make_elf_object): New template declaration.
11134         (Target::do_make_elf_object): New method declarations.
11135         (Target::do_make_elf_object_implementation): New template declaration.
11136
11137 2009-08-14  Ian Lance Taylor  <iant@google.com>
11138
11139         * gold.h (FUNCTION_NAME): Define.
11140         (gold_unreachable): Use FUNCTION_NAME.
11141
11142 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11143
11144         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11145         symbol in the --keep-unique list is not found.
11146
11147 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11148
11149         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11150         been maked as --keep-unique.
11151         (Icf::unfold_section): New function.
11152         * icf.h (Icf::unfold_section): New function.
11153         * options.h (General_options::keep_unique): New option.
11154         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11155         * testsuite/Makefile.in: Regenerate.
11156         * testsuite/icf_keep_unique_test.sh: New file.
11157         * testsuite/icf_keep_unique_test.cc: New file.
11158
11159 2009-08-12  Cary Coutant  <ccoutant@google.com>
11160
11161         PR 10471
11162         * resolve.cc (Symbol_table::resolve): Check for references from
11163         dynamic objects to hidden and internal symbols.
11164         * testsuite/Makefile.am (hidden_test.sh): New test.
11165         * testsuite/Makefile.in: Regenerate.
11166         * testsuite/hidden_test.sh: New script.
11167         * testsuite/hidden_test_1.c: New test source.
11168         * testsuite/hidden_test_main.c: New test source.
11169
11170 2009-08-11  Doug Kwan  <dougkwan@google.com>
11171
11172         * arm.cc: Update comments.
11173         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11174         segment to locate the .ARM.exidx section if present.
11175
11176 2009-08-09  Doug Kwan  <dougkwan@google.com>
11177
11178         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11179         patch.
11180
11181 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11182         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11183         compiler warnings.
11184
11185 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11186
11187         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11188         valid tls_segment only for non-debug-section relocations.
11189         * testsuite/Makefile.am: Add gc_tls_test.
11190         * testsuite/Makefile.in: Regenerate.
11191         * testsuite/gc_tls_test.cc: New file.
11192         * testsuite/gc_tls_test.sh: New file.
11193
11194 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11195
11196         * icf.cc: New file.
11197         * icf.h: New file.
11198         * Makefile.am (CCFILES): Add icf.cc.
11199         (HFILES): Add icf.h
11200         * Makefile.in: Regenerate.
11201         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11202         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11203         section, symbol and addend information for the relocs.
11204         * gold.cc (queue_middle_tasks): Call identical code folding.
11205         * gold.h: Add defines for multimap.
11206         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11207         to the call of finalize_local_symbols.
11208         * main.cc (main): Create object of class Icf.
11209         * object.cc (Sized_relobj::do_layout): Allow this function to be
11210         called twice during icf.
11211         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11212         to sections marked as identical by icf.
11213         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11214         when available.
11215         (Sized_relobj::do_section_entsize): New function.
11216         * object.h (Object::section_entsize): New function.
11217         (Object::do_section_entsize): New pure virtual function.
11218         (Relobj::finalize_local_symbols): Add new parameter.
11219         (Relobj::do_section_entsize): New function.
11220         * options.h (General_options::icf): New option.
11221         (General_options::icf_iterations): New option.
11222         (General_options::print_icf_sections): New option.
11223         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11224         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11225         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11226         icf.
11227         * symtab.cc (Symbol_table::is_section_folded): New function.
11228         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11229         to sections marked as identical by icf.
11230         * symtab.h (Symbol_table::set_icf): New function.
11231         (Symbol_table::icf): New function.
11232         (Symbol_table::is_section_folded): New function.
11233         (Symbol_table::icf_): New data member.
11234         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11235         * testsuite/Makefile.am: Add commands to build icf_test.
11236         * testsuite/Makefile.in: Regenerate.
11237         * testsuite/icf_test.sh: New file.
11238         * testsuite/icf_test.cc: New file.
11239
11240 2009-07-24  Chris Demetriou  <cgd@google.com>
11241
11242         * layout.cc (is_compressible_debug_section): Fix incorrect
11243         comment about compressed section names.
11244
11245 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11246
11247         PR 10419
11248         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11249
11250 2009-07-16  Ian Lance Taylor  <iant@google.com>
11251
11252         PR 10400
11253         * layout.h: #include <map>.
11254         (class Kept_section): Change from struct to class.  Add accessors
11255         and setters.  Add section size to Comdat_group mapping.  Change
11256         Comdat_group to std::map.  Add is_comdat_ field.  Add
11257         linkonce_size field in union.
11258         (class Layout): Update declaration of find_or_add_kept_section.
11259         Don't declare find_kept_object.
11260         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11261         parameter.  Add object, shndx, is_comdat, and is_group_name
11262         parameters.  Change all callers.  Adjust for new Kept_section.
11263         (Layout::find_kept_object): Remove.
11264         * object.cc (Sized_relobj::include_section_group): Update use of
11265         Kept_section.  Rename secnum to shndx.  Only record
11266         Kept_comdat_section if sections are the same size.
11267         (Sized_relobj::include_linkonce_section): Update use of
11268         Kept_section.  Only record Kept_comdat_section if sections are the
11269         same size.  Set size of linkonce section.
11270         (Sized_relobj::map_to_kept_section): Update call to
11271         get_kept_comdat_section.
11272         * object.h (class Sized_relobj): Rename fields in
11273         Kept_comdat_section to drop trailing underscores; change object
11274         field to Relobj*.  Change Kept_comdat_section_table to store
11275         struct rather than pointer.
11276         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11277         Add kept_object and kept_shndx parameters.  Change all callers.
11278         (Sized_relobj::get_kept_comdat_section): Change return type to
11279         bool.  Add kept_object and kept_shndx parameters.  Change all
11280         callers.
11281         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11282         Layout::find_or_add_kept_section.
11283
11284 2009-07-09  Ian Lance Taylor  <iant@google.com>
11285
11286         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11287         Reserve space in the hash table.
11288
11289 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11290
11291         * fileread.cc (File_read::get_mtime): New method.
11292         * fileread.h (Timespec): New structure.
11293         (File_read::get_mtime): New method.
11294         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11295         Renamed from timestamp_nsec.
11296         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11297         Elf_Xword.
11298         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11299         timestamp_nsec.
11300         (Incremental_inputs::report_archive): Save mtime; style fix.
11301         (Incremental_inputs::report_obejct): Save mtime; style fix.
11302         (Incremental_inputs::report_script): Save mtime; style fix.
11303         (Incremental_inputs::finalize_inputs): Style fix.
11304         (Incremental_inputs::finalize): Style fix.
11305         (Incremental_inputs::create_input_section_data): Store inputs
11306         mtime.
11307         * incremental.h (Incremental_inputs::report_script): Add mtime
11308         argument.
11309         (Incremental_inputs::Input_info::Input_info): Intialize only one
11310         union member.
11311         (Incremental_inputs::Input_info::archive): Move to nameless
11312         union.
11313         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11314         (Incremental_inputs::Input_info::script): Move to nameless union.
11315         (Incremental_inputs::mtime): New field.
11316         * script.cc (read_input_script): Pass file mtime to
11317         Incremental_input.
11318         * script.h (Script_info::inputs): Style fix.
11319
11320 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11321
11322         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11323         instead of 32.
11324
11325 2009-06-24  Ian Lance Taylor  <iant@google.com>
11326
11327         PR 10156
11328         * layout.cc (Layout::choose_output_section): If we find an
11329         existing section, update the flags.
11330         (Layout::create_notes): New function, broken out of
11331         Layout::finalize.
11332         (Layout::finalize): Don't create note sections.
11333         (Layout::create_note): Don't crash if linker script discards
11334         section.
11335         (Layout::create_gold_note): Likewise.
11336         (Layout::create_build_id): Likewise.  Don't set
11337         after_input_sections on the section.
11338         (Layout::create_executable_stack_info): Remove target parameter.
11339         Change caller.
11340         * layout.h (class Layout): Declare create_notes.  Update
11341         declaration of create_executable_stack_info.
11342         * gold.cc (queue_middle_tasks): Call create_notes.
11343         * output.cc (Output_section::update_flags_for_input_section): Move
11344         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11345         invalid.
11346         * output.h (Output_data::mark_address_invalid): New function.
11347         (class Output_section): Only declare, not define,
11348         update_flags_for_input_section.  Remove set_flags.
11349
11350 2009-06-24  Ian Lance Taylor  <iant@google.com>
11351
11352         * script-sections.cc (Output_section_definition::
11353         set_section_addresses): Rename shadowing local load_address to
11354         laddr.
11355
11356 2009-06-24  Ian Lance Taylor  <iant@google.com>
11357
11358         PR 10244
11359         * reloc.cc (relocate_sections): Skip empty relocation sections.
11360
11361 2009-06-23  Ian Lance Taylor  <iant@google.com>
11362
11363         PR 10156
11364         * layout.cc (Layout::create_note): Use choose_output_section
11365         rather than make_output_section.
11366
11367 2009-06-23  Ian Lance Taylor  <iant@google.com>
11368
11369         PR 10237
11370         * options.cc (General_options::parse_V): Set printed_version_.
11371         (General_options::General_options): Initialize printed_version_.
11372         * options.h (class General_options): Add printed_version_ field.
11373         * gold.cc (queue_initial_tasks): If there are no input files,
11374         don't give a fatal error if we printed the version information.
11375         (queue_middle_tasks): If using -r with a shared object, give a
11376         fatal error rather than an ordinary error.
11377
11378 2009-06-23  Ian Lance Taylor  <iant@google.com>
11379
11380         PR 10219
11381         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11382         (Layout::make_output_section): Set have_stabstr_section_ if we see
11383         a .stab*str section.
11384         (Layout::finalize): Call link_stabs_sections.
11385         (Layout::link_stabs_sections): New file.
11386         * layout.h (class Layout): Add have_stabstr_section_ field.
11387         Declare link_stabs_sections.
11388
11389 2009-06-23  Doug Kwan  <dougkwan@google.com>
11390
11391         * Makefile.am (libgold_a_LIBADD): New.
11392         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11393         * Makefile.in: Regenerate.
11394         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11395         * configure: Regenerate.
11396         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11397         * fileread.cc: Include sys/state.h
11398         * gold.h: Declare memmem and strndup if found missing.
11399         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11400
11401 2009-06-23  Ian Lance Taylor  <iant@google.com>
11402
11403         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11404         * configure: Rebuild.
11405
11406 2009-06-23  Ian Lance Taylor  <iant@google.com>
11407
11408         PR 10147
11409         * object.cc (Object::section_contents): Don't try to get a view if
11410         the section has length zero.
11411         (Object::handle_gnu_warning_section): If the section is empty, use
11412         the name of the section as the warning.
11413
11414 2009-06-23  Ian Lance Taylor  <iant@google.com>
11415
11416         PR 10133
11417         * stringpool.h (class Stringpool_template): Add optimize_ field.
11418         (Stringpool_template::set_optimize): New function.
11419         * stringpool.cc (Stringpool_template::Stringpool_template):
11420         Initialize optimize_ field.
11421         (Stringpool_template::set_string_offsets): Test local optimize
11422         fild rather than parameter.
11423         * layout.cc (Layout::Layout): Call set_optimize on the section
11424         name stringpool.
11425
11426 2009-06-22  Ian Lance Taylor  <iant@google.com>
11427
11428         PR 10030
11429         * yyscript.y: Parse TARGET.
11430         * script.cc (script_set_target): New function.
11431         * script-c.h (script_set_target): Declare.
11432         * options.cc (General_options::string_to_object_format): Rename
11433         from string_to_object_format in anonymous namespace.  Change
11434         callers.
11435         * options.h (class General_options): Declare
11436         string_to_object_format.
11437
11438 2009-06-22  Ian Lance Taylor  <iant@google.com>
11439
11440         * script-sections.cc (Script_sections::create_segments): Don't put
11441         program headers in a PT_LOAD segment if -n or -N.
11442
11443 2009-06-22  Ian Lance Taylor  <iant@google.com>
11444
11445         PR 10141
11446         * options.h (class General_options): Add -z lazy and -z now.  Sort
11447         -z options into alphabetical order.
11448         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11449
11450 2009-06-21  Ian Lance Taylor  <iant@google.com>
11451
11452         * layout.cc (Layout::make_output_section): Call
11453         Target::new_output_section.
11454         (Layout::attach_allocated_section_to_segment): Put large section
11455         sections in a separate load segment with the large segment flag
11456         set.
11457         (Layout::segment_precedes): Sort large data segments after other
11458         load segments.
11459         (align_file_offset): New static function.
11460         (Layout::set_segment_offsets): Use align_file_offset.
11461         * output.h (class Output_section): Add is_small_section_ and
11462         is_large_section_ fields.
11463         (Output_section::is_small_section): New function.
11464         (Output_section::set_is_small_section):  New function.
11465         (Output_section::is_large_section): New function.
11466         (Output_section::set_is_large_section): New function.
11467         (Output_section::is_large_data_section): New function.
11468         (class Output_segment): Add is_large_data_segment_ field.
11469         (Output_segment::is_large_data_segment): New function.
11470         (Output_segment::set_is_large_data_segment): New function.
11471         * output.cc (Output_section::Output_section): Initialize new
11472         fields.
11473         (Output_segment::Output_segment): Likewise.
11474         (Output_segment::add_output_section): Add assertion that large
11475         data sections always go in large data segments.  Force small data
11476         sections to the end of the list of data sections.  Force small BSS
11477         sections to the start of the list of BSS sections.  For large BSS
11478         sections to the end of the list of BSS sections.
11479         * symtab.h (class Symbol): Declare is_common_shndx.
11480         (Symbol::is_defined): Check Symbol::is_common_shndx.
11481         (Symbol::is_common): Likewise.
11482         (class Symbol_table): Define enum Commons_section_type.  Update
11483         declarations.  Add small_commons_ and large_commons_ fields.
11484         * symtab.cc (Symbol::is_common_shndx): New function.
11485         (Symbol_table::Symbol_table): Initialize new fields.
11486         (Symbol_table::add_from_object): Put small and large common
11487         symbols in the right list.
11488         (Symbol_table::sized_finalized_symbol): Check
11489         Symbol::is_common_shndx.
11490         (Symbol_table::sized_write_globals): Likewise.
11491         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11492         common symbol lists.  Don't call do_allocate_commons_list if the
11493         list is empty.
11494         (Symbol_table::do_allocate_commons_list): Remove is_tls
11495         parameter.  Add comons_section_type parameter.  Change all
11496         callers.  Handle small and large common symbols.
11497         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11498         Symbol::is_common_shndx.
11499         * resolve.cc (symbol_to_bits): Likewise.
11500         * target.h (Target::small_common_shndx): New function.
11501         (Target::small_common_section_flags): New function.
11502         (Target::large_common_shndx): New function.
11503         (Target::large_common_section_flags): New function.
11504         (Target::new_output_section): New function.
11505         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11506         small_common_section_flags, and large_common_section_flags
11507         fields.
11508         (Target::do_new_output_section): New virtual function.
11509         * arm.cc (Target_arm::arm_info): Initialize new fields.
11510         * i386.cc (Target_i386::i386_info): Likewise.
11511         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11512         Likewise.
11513         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11514         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11515         (Target_x86_64::do_new_output_section): New function.
11516         * configure.ac: Define conditional MCMODEL_MEDIUM.
11517         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11518         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11519         (large_LDFLAGS): Define.
11520         * testsuite/large.c: New file.
11521         * testsuite/testfile.cc (Target_test::test_target_info):
11522         Initialize new fields.
11523         * configure, testsuite/Makefile.in: Rebuild.
11524
11525 2009-06-05  Doug Kwan  <dougkwan@google.com>
11526
11527         * Makefile.am (CCFILES): Add target.cc.
11528         * Makefile.in: Regenerate.
11529         * i386.cc (class Target_i386): Define new virtual method to
11530         override do_is_local_label_name in parent.
11531         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11532         local symbols if --discard-locals or -X is given.
11533         * options.h (class General_options): Declare new options
11534         '--discard-locals' and '-X' for discarding locals.
11535         * target.h (class Target): Define new methods is_local_label_name.
11536         Declare new virtual method do_is_local_label_name.
11537         * target.cc: New file.
11538         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11539         (check_SCRIPTS): Add discard_locals_test.sh.
11540         (check_DATA): Add discard_local_tests.syms.
11541         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11542         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11543         * testsuite/Makefile.in: Regenerate.
11544         * testsuite/discard_locals_test.c: New file.
11545         * testsuite/discard_locals_test.sh: Same.
11546
11547 2009-06-05  Doug Kwan  <dougkwan@google.com>
11548
11549         * object.cc (Sized_relobj::Sized_relobj): Initialize
11550         discarded_eh_frame_shndx_ to -1U.
11551         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11552         section.
11553         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11554         a discarded .eh_frame section.
11555         (Sized_relobj::do_finalize_local_symbols): Ditto.
11556         * object.h (class Sized_relobj): Declare new member
11557         discarded_eh_frame_shndx_.
11558         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11559         (local_labels_test.o, local_labels_test): New rules.
11560         * testsuite/Makefile.in: Regenerate.
11561
11562 2009-06-04  Doug Kwan  <dougkwan@google.com>
11563
11564         * layout.cc (Layout::section_name_mapping): Add mapping for
11565         special ARM sections.
11566
11567 2009-06-03  Doug Kwan  <dougkwan@google.com>
11568
11569         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11570         (utils::has_overflow): Same.
11571
11572 2009-06-03  Ian Lance Taylor  <iant@google.com>
11573
11574         * layout.cc (Layout::section_name_mapping): New array, replacing
11575         Layout::linkonce_mapping.
11576         (Layout::section_name_mapping_count): New variable, replacing
11577         Layout::linkonce_mapping_count.
11578         (Layout::linkonce_output_name): Remove.
11579         (Layout::output_section_name): Rewrite.
11580         * layout.h (class Layout): Rename Linkonce_mapping to
11581         Section_name_mapping, linkonce_mapping to section_name_mapping,
11582         linkonce_mapping_count to section_name_mapping_count.  Don't
11583         declare linkonce_output_name.
11584
11585 2009-06-03  Doug Kwan  <dougkwan@google.com>
11586
11587         * gold/arm.cc (namespace utils): New.
11588         (Target_arm::reloc_is_non_pic): Define new method.
11589         (class Arm_relocate_functions): New.
11590         (Target_arm::Relocate::relocate): Handle relocation types used by
11591         Android.
11592
11593 2009-06-03  Ian Lance Taylor  <iant@google.com>
11594
11595         * arm.cc (Target_arm::scan::global): Use || instead of |.
11596
11597 2009-06-02  Doug Kwan  <dougkwan@google.com>
11598
11599         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11600         issued_non_pic_error_.
11601         (class Target_arm::Scan): Declare new method check_non_pic.
11602         Define new method symbol_needs_plt_entry.
11603         Declare new data member issued_non_pic_error_.
11604         (class Target_arm::Relocate): Declare new method
11605         should_apply_static_reloc.
11606         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11607         (Target_arm::Scan::check_non_pic): Define new method.
11608         (Target_arm::Scan::local): Handle a small subset of reloc types used
11609         by Android.
11610         (Target_arm::Scan::local): Same.
11611         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11612
11613 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11614
11615         * incremental.cc (Incremental_inputs::report_command_line): Filter
11616         out --incremental-* options.
11617
11618 2009-05-29  Doug Kwan  <dougkwan@google.com>
11619
11620         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11621         template class.
11622         (class Target_arm): Update comment.
11623         (Target_arm::Target_arm): Initialize new data members GOT_,
11624         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11625         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11626         and Target_arm::rel_dyn_section.
11627         Declare new_enum Target_arm::Got_type.
11628         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11629         and DYNBSS_.
11630         Update commments for member do_dynsym_value.
11631         (Target_arm::got_size, Target_arm::plt_section,
11632         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11633         new methods inside class defintion.
11634         (Target_arm::got_section): Define new method.
11635         (Target_arm::rel_dyn_section): Same.
11636         (Output_data_plt_arm): New template class.
11637         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11638         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11639         (Output_data_plt_arm::add_entry): Same.
11640         (Output_data_plt_arm::first_plt_entry): Define new
11641         static data member for PLT instruction template.
11642         (Output_data_plt_arm::plt_entry): Same.
11643         (Output_data_plt_arm::do_write): Define new method.
11644         (Target_arm::make_plt_entry): Same.
11645         (Target_arm::do_finalize_sections): Same.
11646         (Target_arm::do_dynsym_value): Same.
11647
11648 2009-05-28  Doug Kwan  <dougkwan@google.com>
11649
11650         * Makefile.am (TARGETSOURCES): Add arm.cc.
11651         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11652         * Makefile.in: Regenerate.
11653         * arm.cc: New file.
11654         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11655
11656 2009-05-26  Doug Kwan  <dougkwan@google.com>
11657
11658         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11659         (General_options::check_excluded_libs): Strip off directories in
11660         archive name before matching like GNU ld does.
11661         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11662         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11663         (exclude_libs_test_LDFLAGS): Add linker option
11664         -Wl,--exclude-libs,libexclude_libs_test_3
11665         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11666         an explicit archive without using -l.
11667         (alt/libexclude_libs_test_3.a): New make rule.
11668         * testsuite/Makefile.in: Regenerate.
11669         * testsuite/exclude_libs_test.c : Declare lib3_default().
11670         (main): Call it.
11671         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11672         * exclude_libs_test_3.c: New file.
11673
11674 2009-05-26  Nick Clifton  <nickc@redhat.com>
11675
11676         * po/id.po: New Indonesian translation.
11677         * po/gold.pot: Updated template file.
11678
11679 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11680
11681         * testsuite/Makefile.am: Add -ffunction-sections to compile
11682         gc_comdat_test files.  Add -Wl,--gc-sections to build
11683         gc_comdat_test.
11684         * testsuite/Makefile.in: Regenerate.
11685         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11686
11687 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11688
11689         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11690         kept comdat section was garbage collected.
11691         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11692         * testsuite/Makefile.in: Regenerate.
11693         * testsuite/gc_comdat_test.sh: New file.
11694         * testsuite/gc_comdat_test_1.cc: New file.
11695         * testsuite/gc_comdat_test_2.cc: New file.
11696
11697 2009-05-19  Doug Kwan  <dougkwan@google.com>
11698
11699         * archive.cc (Archive::Archive): Move constructor from archive.h
11700         to here.  Initialize no_export_.
11701         (Archive::get_elf_object_for_member): Set no_export flag of object.
11702         * archive.h (Archive::Archive): Move constructor body to
11703         archive.cc.
11704         (Archive::no_export): New method.
11705         (Archive::no_export_): New field.
11706         * object.h (Object::Object): Initialize no_export_ to false.
11707         (Object::no_export, Object::set_no_export): New methods.
11708         (Object::no_export_): New field.
11709         * options.cc (General_options::parse_exclude_libs): New method.
11710         (General_options::check_excluded_libs) Same.
11711         * options.h (exclude_libs): New option.
11712         (General_options::check_excluded_libs): New method declaration.
11713         (General_options::excluded_libs_): New field.
11714         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11715         default or protected visibility if an object has no-export flag set.
11716         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11717         (check_SCRIPTS): Add exclude_libs_test.sh.
11718         (check_DATA): Add exclude_libs_test.syms.
11719         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11720         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11721         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11722         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11723         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11724         libexclude_libs_test_2.a): New rules.
11725         * testsuite/Makefile.in: Regenerate.
11726         * testsuite/exclude_libs_test.c: New file.
11727         * testsuite/exclude_libs_test.sh: Ditto.
11728         * testsuite/exclude_libs_test_1.c: Ditto.
11729         * testsuite/exclude_libs_test_2.c: Ditto.
11730
11731 2009-05-15  Ian Lance Taylor  <iant@google.com>
11732
11733         * configure.ac: Check for declarations for cases where libiberty.h
11734         checks HAVE_DECL_xxx.
11735         * configure, config.in: Rebuild.
11736
11737 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11738
11739         * gold.h (Incremental_argument_list): Remove (invalid) forward
11740         declaration.
11741         * incremental.cc (Incremental_inputs::report_achive): New method.
11742         (Incremental_inputs::report_object): New method.
11743         (Incremental_inputs::report_script): New method.
11744         (Incremental_inputs::finalize_inputs): New method.
11745         (Incremental_inputs::finalize): Call finalize_inputs().
11746         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11747         Create inputs entries.
11748         * incremental.h (Incremental_input_type): New enum.
11749         (Incremental_inputs::Incremental_input): Initialize new fields.
11750         (Incremental_inputs::report_inputs): New method.
11751         (Incremental_inputs::report_achive): New method.
11752         (Incremental_inputs::report_object): New method.
11753         (Incremental_inputs::report_script): New method.
11754         (Incremental_inputs::finalize_inputs): New method.
11755         (Incremental_inputs::Input_info): New struct.
11756         (Incremental_inputs::Input_info_map): New typedef.
11757         (Incremental_inputs::lock_): New field.
11758         (Incremental_inputs::Inputs_): New field.
11759         (Incremental_inputs::Inputs_map): New field.
11760         * main.cc (main): Call Incremental_input::report_inputs.
11761         * options.h (Input_argument_list): Typedef moved from
11762         Input_arguments.
11763         (Input_file_group::Files): Remove, use ::Input_argument_list.
11764         (Input_file_group::Input_argument_list): Remove, use
11765         ::Input_argument_list.
11766         * plugin.cc (Plugin_manager::add_input_file): Add error in
11767         incremental build.
11768         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11769         functions.
11770         * script.cc (read_input_script): Call
11771         Incremental_input::report_script.
11772         * script.h (Script_info): New class.
11773
11774 2009-04-27  Ian Lance Taylor  <iant@google.com>
11775
11776         * x86_64.cc (do_adjust_output_section): Set entsize to
11777         plt_entry_size.
11778
11779 2009-04-23  Elliott Hughes  <enh@google.com>
11780
11781         * output.cc (Output_file::close): After short writes, continue
11782         writing from the correct offset in the buffer being written.
11783
11784 2009-04-23  Chris Demetriou  <cgd@google.com>
11785
11786         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11787         * configure: Regenerate.
11788         * config.in: Regenerate.
11789         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11790         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11791
11792 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11793
11794         * incremental.cc (Incremental_inputs_header_data): Renamed from
11795         Incremental_input_header_data.
11796         (Incremental_inputs_header_data::data_size): New field.
11797         (Incremental_inputs_header_data::put_input_file_count): Renamed
11798         from input_file_count.
11799         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11800         from command_line_offset.
11801         (Incremental_inputs_header_data::put_reserved): Renamed from
11802         put_reserved.
11803         (Incremental_inputs_entry_data): Renamed from
11804         Incremental_input_entry_data.
11805         (Incremental_inputs_entry_data::data_size): New field.
11806         (Incremental_inputs::report_command_line): New method.
11807         (Incremental_inputs::finalize): New method.
11808         (Incremental_inputs::create_incremental_inputs_data): New method.
11809         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11810         * incremental.h: New file.
11811         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11812         (Layout::finalize): Create incremental inputs section in
11813         incremental builds.
11814         (Layout::create_incremental_info_sections): New method.
11815         * layout.h (Layout::incremental_inputs): New method.
11816         (Layout::create_incremental_info_sections): New method.
11817         (Layout::incremental_inputs_): New field.
11818         * main.cc (main): Notify Incremental_input of the command line.
11819
11820 2009-04-01  Ian Lance Taylor  <iant@google.com>
11821             Mikolaj Zalewski  <mikolajz@google.com>
11822
11823         * gold.h (reserve_unordered_map): Define, three versions, one for
11824         each version of Unordered_map.
11825         * layout.cc (Layout::Layout): Remove options parameter.  Add
11826         number_of_input_files parameter.  Don't initialize options_.
11827         Initialize number_of_input_files_ and resized_signatures_.  Move
11828         sections_are_attached_.
11829         (Layout::layout_group): Reserve space for group_signatures_.
11830         (Layout::find_or_add_kept_section): Change name parameter to be a
11831         reference.  Resize signatures_ map when it gets large enough.
11832         (Layout::layout_eh_frame): Use parameters->options() instead of
11833         this->options_.
11834         (Layout::make_output_section): Likewise.
11835         (Layout::attach_allocated_section_to_segment): Likewise.
11836         (Layout::finalize, Layout::create_executable_stack): Likewise.
11837         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11838         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11839         * layout.h (class Layout): Update declarations.  Remove options_
11840         field.  Add number_of_input_files_ and resized_signatures_
11841         fields.  Move sections_are_attached_ field.
11842         * main.cc (main): Pass number of input files to Layout
11843         constructor.  Don't pass options.
11844
11845 2009-03-30  Ian Lance Taylor  <iant@google.com>
11846
11847         * ffsll.c (ffsll): Correct implementation.
11848
11849 2009-03-27  Ian Lance Taylor  <iant@google.com>
11850
11851         * ffsll.c: New file.
11852         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11853         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11854         * ftruncate.c (ftruncate): Declare before definition.
11855         * mremap.c (mremap): Likewise.
11856         * pread.c (pread): Likewise.
11857         * configure, Makefile.in, config.in: Rebuild.
11858
11859         * mremap.c: New file.
11860         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11861         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11862         (mremap): Declare if HAVE_MREMAP is not defined.
11863         * configure, Makefile.in, config.in: Rebuild.
11864
11865 2009-03-27  Cary Coutant  <ccoutant@google.com>
11866
11867         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11868         position independent.
11869         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11870         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11871
11872 2009-03-24  Cary Coutant  <ccoutant@google.com>
11873
11874         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11875         an executable.
11876         (needs_dynamic_reloc): Likewise.
11877
11878 2009-03-24  Ian Lance Taylor  <iant@google.com>
11879
11880         * yyscript.y (file_cmd): Recognize EXTERN.
11881         (extern_name_list, extern_name_list_body): New nonterminals.
11882         * script.cc (script_add_extern): Define.
11883         * script-c.h (script_add_extern): Declare.
11884
11885 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11886
11887         * object.cc (is_elf_object): Define.
11888         * object.h (is_elf_object): Declare.
11889         * archive.cc (Archive::get_elf_object_for_member): Call
11890         is_elf_object.
11891         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11892
11893 2009-03-24  Elliott Hughes  <enh@google.com>
11894
11895         * output.cc (Output_file::map_anonymous): Define.
11896         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11897         try an anonymous one.  Report the size if the mmap fails.
11898         * output.h (class Output_file): Declare map_anonymous.
11899
11900 2009-03-24  Ian Lance Taylor  <iant@google.com>
11901
11902         * target-select.cc (instantiate_target): Don't acquire the lock if
11903         the instantiated_target_ field has already been set.
11904
11905 2009-03-23  Ian Lance Taylor  <iant@google.com>
11906
11907         * gold-threads.h (class Initialize_lock): Define.
11908         * gold-threads.cc (class Initialize_lock_once): Define.
11909         (initialize_lock_control): New static variable.
11910         (initialize_lock_pointer): New static variable.
11911         (initialize_lock_once): New static function.
11912         (Initialize_lock::Initialize_lock): Define.
11913         (Initialize_lock::initialize): Define.
11914         * target-select.h: Include "gold-threads.h".
11915         (class Target_selector): Add lock_ and initialize_lock_ fields.
11916         Don't define instantiate_target, just declare it.
11917         * target-select.cc (Target_selector::Target_selector): Initialize
11918         new fields.
11919         (Target_selector::instantiate_target): Define.
11920         * descriptors.h: Include "gold-threads.h".
11921         (class Descriptors): Add initialize_lock_ field.
11922         * descriptors.cc (Descriptors::Descriptors): Initialize new
11923         field.
11924         (Descriptors::open): Use initialize_lock_ field
11925         * errors.h (class Errors): Add initialize_lock_ field.
11926         * errors.cc (Errors::Errors): Initialize new field.
11927         (Errors::initialize_lock): Use initialize_lock_ field.
11928         * powerpc.cc (class Target_selector_powerpc): Remove
11929         instantiated_target_ field.  In do_recognize call
11930         instantiate_target rather than do_instantiate_target.  In
11931         do_instantiate_target just allocate a new target.
11932         * sparc.cc (class Target_selector_sparc): Likewise.
11933
11934         * freebsd.h: New file.
11935         * i386.cc: Include "freebsd.h".
11936         (Target_i386): Derive from Target_freebsd rather than
11937         Sized_target.
11938         (Target_selector_i386): Derive from Target_selector_freebsd rather
11939         than Target_selector.
11940         * x86_64.cc: Include "freebsd.h".
11941         (Target_x86_64): Derive from Target_freebsd rather than
11942         Sized_target.
11943         (Target_selector_x86_64): Derive from Target_selector_freebsd
11944         rather than Target_selector.
11945         * target.h (class Target): Add adjust_elf_header and
11946         do_adjust_elf_header.
11947         * output.cc (Output_file_header:: do_sized_write): Call target
11948         adjust_elf_header routine.
11949         * configure.tgt: Set targ_osabi.
11950         * configure.ac: Define GOLD_DEFAULT_OSABI.
11951         * parameters.cc (Parameters::default_target): Pass
11952         GOLD_DEFAULT_OSABI to select_target.
11953         * target-select.h (class Target_selector): Make instantiate_target
11954         protected rather than private.
11955         * Makefile.am (HFILES): Add freebsd.h.
11956         * configure, Makefile.in, config.in: Rebuild.
11957
11958         * merge.cc (do_add_input_section): Correct pend value.  Change
11959         message about last entry not being null terminated from error to
11960         warning.
11961
11962 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11963
11964         * incremental.cc: New file.
11965         * Makefile.am (CCFILES): Add incremental.cc.
11966         * Makefile.in: Rebuild.
11967
11968 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11969
11970         * layout.cc (Layout::output_section_name): Preserve names
11971         of '.note.' sections.
11972
11973 2009-03-19  Ian Lance Taylor  <iant@google.com>
11974
11975         * descriptors.cc (Descriptors::open): Check that the options are
11976         valid before using them.
11977
11978 2009-03-18  Ian Lance Taylor  <iant@google.com>
11979
11980         * script-sections.h: Include <list>.
11981         (class Script_sections): Change Sections_elements from std::vector
11982         to std::list.  Typedef public Elements_iterator.  Add
11983         orphan_section_placement_, data_segment_align_start_, and
11984         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11985         field.
11986         * script-sections.cc (class Orphan_section_placement): New class.
11987         (class Sections_element): Add virtual functions is_relro and
11988         orphan_section_init.  Remove virtual function place_orphan_here.
11989         (class Output_section_definition): Add is_relro and
11990         orphan_section_init.  Remove place_orphan_here.
11991         (class Orphan_output_section): Likewise.
11992         (Script_sections::Script_sections): Update for field changes.
11993         (Script_sections::data_segment_align): Set saw_data_segment_align_
11994         and data_segment_align_start_, not data_segment_align_index.
11995         (Script_sections::data_segment_relro_end): Check
11996         saw_data_segment_align_.  Use data_segment_align_start_ rather
11997         than data_segment_align_index_.
11998         (Script_sections::place_orphan): Rewrite to use
11999         Orphan_section_placement.
12000
12001 2009-03-17  Ian Lance Taylor  <iant@google.com>
12002
12003         * archive.cc (Archive::add_symbols): Check for a version attached
12004         to the symbol name in the archive map.
12005         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12006         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12007         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12008         (ver_test_11.a): New target.
12009         * testsuite/Makefile.in: Rebuild.
12010
12011         * configure.ac: Check for chsize and posix_fallocate.  Replace
12012         ftruncate.
12013         * ftruncate.c: New file, from gnulib.
12014         * output.cc (posix_fallocate): Define dummy version if not
12015         HAVE_POSIX_FALLOCATE.
12016         (Output_file::map): Call posix_fallocate rather than lseek and
12017         write.
12018         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12019         * configure, Makefile.in, config.in: Rebuild.
12020
12021 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12022
12023         * layout.h (Layout::create_note): Add section_name parameter.
12024         * layout.cc (Layout::create_note): Likewise.
12025         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12026
12027 2009-03-17  Ian Lance Taylor  <iant@google.com>
12028
12029         * descriptors.cc: Include "options.h".
12030         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12031         (Descriptors::open): Always use O_CLOEXEC when opening a new
12032         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12033         then set FD_CLOEXEC.
12034
12035         * sparc.cc (class Target_sparc): Add has_got_section.
12036         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12037         make sure we have a GOT section.
12038
12039         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12040         (Target_sparc::Scan::local): Likewise.
12041         (Target_sparc::Scan::global): Likewise.
12042         (Target_sparc::Relocate::relocate): Likewise.
12043         (Target_sparc::Relocate::relocate_tls): Likewise.
12044
12045         * symtab.cc (Symbol_table::define_default_version): New function,
12046         broken out of add_from_object.
12047         (Symbol_table::add_from_object): Call define_default_version.
12048         (Symbol_table::define_special_symbol): Add resolve_oldsym
12049         parameter.  Change all callers.  If the version for a symbol comes
12050         from a version script, resolve it with the symbol with the same
12051         name with no version.  Also add the symbol without a version if
12052         appropriate.
12053         (do_define_in_output_data): If resolving with oldsym, don't delete
12054         sym.
12055         (do_define_in_output_segment): Likewise.
12056         (do_define_as_constant): Likewise.
12057         * symtab.h (class Symbol_table): Update declarations.
12058
12059 2009-03-13  Ian Lance Taylor  <iant@google.com>
12060
12061         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12062         (Read_symbols::requeue): New function.
12063         (Read_symbols::do_read_symbols): If make_elf_object fails because
12064         the target type is not configured, and the file was searched for,
12065         issue a warning and retry with the next directory.
12066         (Add_symbols::run): If the file has an incompatible format, and
12067         it was searched for, requeue the Read_symbols task.  On error,
12068         release the object.
12069         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12070         dirindex parameter to constructor.  Change all callers.  Declare
12071         incompatible_warning and requeue.
12072         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12073         input_argument_ and input_group_ fields.  Add them to
12074         constructor.  Change all callers.
12075         (class Read_script): Add dirindex_ field.  Add it to constructor.
12076         Change all callers.
12077         * archive.cc (Archive::setup): Remove input_objects parameter.
12078         Change all callers.
12079         (Archive::get_file_and_offset): Likewise.
12080         (Archive::read_all_symbols): Likewise.
12081         (Archive::read_symbols): Likewise.
12082         (Archive::get_elf_object_for_member): Remove input_objects
12083         parameter.  Add punconfigured parameter.  Change all callers.
12084         (Archive::add_symbols): Change return type to bool.  Check return
12085         value of include_member.
12086         (Archive::include_all_members): Likewise.
12087         (Archive::include_member): Change return type to bool.  Return
12088         false if first included object has incompatible target.  Set
12089         included_member_ field.
12090         (Add_archive_symbols::run): If add_symbols returns false, requeue
12091         Read_symbols task.
12092         * archive.h (class Archive): Add included_member_ field.
12093         Initialize it in constructor.  Add input_file and searched_for
12094         methods.  Update declarations.
12095         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12096         input_argument_ fields.  Add them to constructor.  Change all
12097         callers.
12098         * script.cc: Include "target-select.h".
12099         (class Parser_closure): Add skip_on_incompatible_target_ and
12100         found_incompatible_target_ fields.  Add
12101         skip_on_incompatible_target parameter to constructor.  Change all
12102         callers.  Add methods skip_on_incompatible_target,
12103         clear_skip_on_incompatible_target, found_incompatible_target, and
12104         set_found_incompatible_target.
12105         (read_input_script): Add dirindex parameter.  Change all callers.
12106         If parser finds an incompatible target, requeue Read_symbols
12107         task.
12108         (script_set_symbol): Clear skip_on_incompatible_target in
12109         closure.
12110         (script_add_assertion, script_parse_option): Likewise.
12111         (script_start_sections, script_add_phdr): Likewise.
12112         (script_check_output_format): New function.
12113         * script.h (read_input_script): Update declaration.
12114         * script-c.h (script_check_output_format): Declare.
12115         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12116         (ignore_cmd): Remove OUTPUT_FORMAT.
12117         * fileread.cc (Input_file::Input_file): Add explicit this.
12118         (Input_file::will_search_for): New function.
12119         (Input_file::open): Add pindex parameter.  Change all callers.
12120         * fileread.h (class Input_file): Add input_file_argument method.
12121         Declare will_search_for.  Update declarations.
12122         * object.cc (make_elf_object): Add punconfigured parameter.
12123         Change all callers.
12124         * object.h (class Object): Make input_file public.  Add
12125         searched_for method.
12126         (make_elf_object): Update declaration.
12127         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12128         restart search.
12129         * dirsearch.h (class Dirsearch): Update declaration.
12130         * options.h (class General_options): Add --warn-search-mismatch.
12131         * parameters.cc (Parameters::is_compatible_target): New function.
12132         * parameters.h (class Parameters): Declare is_compatible_target.
12133         * workqueue.cc (Workqueue::add_blocker): New function.
12134         * workqueue.h (class Workqueue): Declare add_blocker.
12135
12136         * fileread.cc (Input_file::open): Remove options parameter.
12137         Change all callers.
12138         (Input_file::open_binary): Likewise.
12139         * script.cc (read_input_script): Likewise.
12140         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12141         options parameter from constructor.  Change all callers.
12142         (class Read_script): Likewise.
12143         * fileread.h (class Input_file): Update declarations.
12144         * script.h (read_input_script): Update declaration.
12145
12146 2009-03-10  Nick Clifton  <nickc@redhat.com>
12147
12148         * po/es.po: New Spanish translation.
12149
12150 2009-03-06  Cary Coutant  <ccoutant@google.com>
12151
12152         * options.cc (parse_short_option): Keep dash_z from registering itself.
12153
12154 2009-03-03  Ian Lance Taylor  <iant@google.com>
12155
12156         PR 9918
12157         * target-reloc.h (relocate_section): Pass output_section to
12158         relocate.
12159         * i386.cc (Target_i386::should_apply_static_reloc): Add
12160         output_section parameter.  Change all callers.
12161         (Target_i386::Relocate::relocate): Add output_section parameter.
12162         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12163         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12164         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12165         * testsuite/two_file_shared.sh: New script.
12166         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12167         (check_DATA): Add two_file_shared.dbg.
12168         (two_file_shared.dbg): New target.
12169         * testsuite/Makefile.in: Rebuild.
12170
12171 2009-03-01  Ian Lance Taylor  <iant@google.com>
12172
12173         * configure.ac: Check for byteswap.h.
12174         * configure: Rebuild.
12175         * config.in: Rebuild.
12176
12177 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12178
12179         * layout.cc (Layout::find_or_add_kept_section): New function.
12180         (Layout::add_comdat): Removed.
12181         * layout.h (struct Kept_section): Move out of class Layout.
12182         Remove trailing underscores from field names.  Add group_sections
12183         field.  Rename group_ field to is_group.  Change all uses.
12184         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12185         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12186         comdat_groups_ field.
12187         (Sized_relobj::include_section_group): Use
12188         find_or_add_kept_section and Kept_section::group_sections.
12189         (Sized_relobj::include_linkonce_section): Likewise.
12190         * object.cc (class Sized_relobj): Don't define Comdat_group or
12191         Comdat_group_table.  Remove find_comdat_group and
12192         add_comdat_group.  Remove comdat_groups_ field.
12193         * plugin.cc (include_comdat_group): Use
12194         Layout::find_or_add_kept_section.
12195
12196 2009-02-28  Ian Lance Taylor  <iant@google.com>
12197
12198         * README: --gc-sections and map files are now supported.  Document
12199         some build requirements.
12200
12201         PR 6992
12202         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12203         relocatable link set the value of the section symbol to zero.
12204         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12205         relocatable link don't include the section address in the local
12206         symbol value.
12207
12208 2009-02-27  Ian Lance Taylor  <iant@google.com>
12209
12210         PR 6811
12211         * options.h (class Search_directory): Add is_system_directory.
12212         (class General_options): Declare is_in_system_directory.
12213         * options.cc (get_relative_sysroot): Make static.
12214         (get_default_sysroot): Make static.
12215         (General_optoins::is_in_system_directory): New function.
12216         * fileread.cc (Input_file::is_in_system_directory): New function.
12217         * fileread.h (class Input_file): Declare is_in_system_directory.
12218         * object.h (class Object): Add is_in_system_directory.
12219         (class Input_objects): Remove system_library_directory_ field.
12220         * object.cc (Input_objects::add_object): Don't set
12221         system_library_directory_.
12222         (input_objects::found_in_system_library_directory): Remove.
12223         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12224         parameter.  Change all callers.
12225         (Symbol_table::sized_write_globals): Likewise.
12226         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12227         Call Object::is_in_system_directory.
12228         * symtab.h (class Symbol_table): Update declarations.
12229
12230         PR 5990
12231         * descriptors.h (Open_descriptor): Add is_on_stack field.
12232         * descriptors.cc (Descriptors::open): If the descriptor is on the
12233         top of the stack, remove it.  Initialize is_on_stack field.
12234         (Descriptors::release): Only add pod to stack if it is not on the
12235         stack already.
12236         (Descriptors::close_some_descriptor): Clear stack_next and
12237         is_on_stack fields.
12238
12239         PR 7091
12240         * output.cc (Output_section::find_starting_output_address): Rename
12241         from starting_output_address; add PADDR parameter; change return
12242         type.
12243         * output.h (class Output_section): Declare
12244         find_starting_output_address instead of starting_output_address.
12245         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12246         section symbol for which we can't find a merge section.
12247
12248         PR 9836
12249         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12250         hidden or internal, force the symbol to be local.
12251         * resolve.cc (Symbol::override_visibility): Define.
12252         (Symbol::override_base): Use override_visibility.
12253         (Symbol_table::resolve): Likewise.
12254         (Symbol::override_base_with_special): Likewise.
12255         (Symbol_table::override_with_special): If the visibility is hidden
12256         or internal, force the symbol to be local.
12257         * symtab.h (class Symbol): Add set_visibility and
12258         override_visibility.
12259         * testsuite/ver_test_1.sh: New file.
12260         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12261         (check_DATA): Add ver_test_1.syms.
12262         (ver_test_1.syms): New target.
12263         * testsuite/Makefile.in: Rebuild.
12264
12265 2009-02-25  Cary Coutant  <ccoutant@google.com>
12266
12267         * layout.cc (Layout::choose_output_section): Don't rename sections
12268         when using a linker script that has a SECTIONS clause.
12269         * Makefile.in: Regenerate.
12270
12271         * testsuite/Makefile.am (script_test_5.sh): New test case.
12272         * testsuite/Makefile.in: Regenerate.
12273         * testsuite/script_test_5.cc: New file.
12274         * testsuite/script_test_5.sh: New file.
12275         * testsuite/script_test_5.t: New file.
12276
12277 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12278
12279         * archive.cc (Archive::include_member): Update calls to add_symbols.
12280         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12281         the Layout argument.
12282         * dynobj.h (do_add_symbols): Add the Layout argument.
12283         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12284         Layout argument.
12285         * object.h (Object::add_symbols): Add the Layout argument.
12286         (Object::do_add_symbols): Add the Layout argument.
12287         (Sized_relobj::do_add_symbols): Add the Layout argument.
12288         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12289         Unify the two versions.
12290         (Add_plugin_symbols): Remove.
12291         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12292         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12293         (Add_plugin_symbols): Remove.
12294         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12295         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12296         (Add_symbols::run): Make it work with Pulginobj.
12297
12298 2009-02-06  Ian Lance Taylor  <iant@google.com>
12299
12300         * object.cc (Sized_relobj::do_layout): Make info message start
12301         with lower case letter.
12302
12303 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12304
12305         * binary.cc: Fix file comment.
12306
12307         * options.h (enum Incremental_disposition): Define.
12308         (class General_options): Add new options: --incremental,
12309         --incremental_changed, --incremental_unchanged,
12310         --incremental_unknown.  Add incremental_disposition_ and
12311         implicit_incremental_ fields.
12312         (General_options::incremental_disposition): New function.
12313         (class Position_dependent_options): Add incremental_disposition
12314         option.
12315         (Position_dependent_options::copy_from_options): Set incremental
12316         dispositions.
12317         * options.cc (General_options::parse_incremental_changed): New
12318         function.
12319         (General_options::parse_incremental_unchanged): New function.
12320         (General_options::parse_incremental_unknown): New function.
12321         (General_options::General_options): Initialize new fields
12322         incremental_disposition_ and implicit_incremental_.
12323         (General_options::finalize): Check for uasge of --incremental-*
12324         without --incremental.
12325
12326 2009-02-06  Chris Demetriou  <cgd@google.com>
12327
12328         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12329         pointer and to report location as the file name associated with
12330         the symbol.
12331         (gold_undefined_symbol_at_location): New function to replace the
12332         old gold_undefined_symbol functionality.
12333         * target-reloc.h (relocate_section): Update to use
12334         gold_undefined_symbol_at_location.
12335         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12336         Call gold_undefined_symbol function rather than gold_error.
12337         * errors.h (Errors::undefined_symbol): Take location as a
12338         string, rather than calculating it from a relocation.
12339         * errors.cc (Errors::fatal): Print "fatal error:" before the
12340         formatted message.
12341         (Errors::error, Errors::error_at_location): Print "error: "
12342         before the formatted message.
12343         (Errors::undefined_symbol): Take location as a string, rather
12344         than calculating it from a relocation.
12345         (gold_undefined_symbol_at_location): New function akin to
12346         old gold_undefined_symbol, calculates location from relocation.
12347         (gold_undefined_symbol): Change to take only a Symbol pointer
12348         and to report location as the file name associated with the symbol.
12349         * testsuite/debug_msg.sh: Update for changed error messages.
12350         * testsuite/undef_symbol.sh: Likewise.
12351
12352 2009-02-04  Duncan Sands  <baldrick@free.fr>
12353
12354         PR 9812
12355         * reduced_debug_output.h
12356         (Output_reduced_debug_abbrev_section::failed): Use format for
12357         gold_warning.
12358         (Output_reduced_debug_info_section::faild): Likewise.
12359
12360 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12361
12362         * script.cc (Lazy_demangler): New class.
12363         (Version_script_info::get_symbol_version_helper): Demangle a
12364         symbol only once.
12365
12366 2009-01-29  Cary Coutant  <ccoutant@google.com>
12367
12368         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12369         to __tls_get_addr.
12370         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12371
12372 2009-01-28  Ian Lance Taylor  <iant@google.com>
12373
12374         * version.cc (version_string): Bump to 1.9.
12375
12376         * gold.h: Include <cstring> and <stdint.h>.
12377         * version.cc: Include <cstdio>.
12378         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12379         warning.
12380         * reduced_debug_output.cc (insert_into_vector): Rename from
12381         Insert_into_vector; change all callers.  Use Swap_unaligned to
12382         avoid aliasing issue; remove union since it is unnecessary.
12383
12384 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12385
12386         * Makefile.am (CCFILES): Add gc.cc.
12387         (HFILES): Add gc.h.
12388         * Makefile.in: Regenerate.
12389         * gold.cc (Gc_runner): New class.
12390         (queue_initial_tasks): Call garbage collection related tasks
12391         when corresponding options are invoked.
12392         (queue_middle_gc_tasks): New function.
12393         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12394         processed early before laying out sections during garbage collection.
12395         * gold.h (queue_middle_gc_tasks): New function.
12396         (is_prefix_of): Move from "layout.cc".
12397         * i386.cc (Target_i386::gc_process_relocs): New function.
12398         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12399         * main.cc (main): Create object of class "Garbage_collection".
12400         * object.cc (Relobj::copy_symbols_data): New function.
12401         (Relobj::is_section_name_included): New function.
12402         (Sized_relobj::do_layout): Allow this function to be called twice
12403         during garbage collection and defer layout of section during the
12404         first call.
12405         * object.h (Relobj::get_symbols_data): New function.
12406         (Relobj::is_section_name_included): New function.
12407         (Relobj::copy_symbols_data): New function.
12408         (Relobj::set_symbols_data): New function.
12409         (Relobj::get_relocs_data): New function.
12410         (Relobj::set_relocs_data): New function.
12411         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12412         (Relobj::gc_process_relocs): New function.
12413         (Relobj::do_gc_process_relocs): New pure virtual function.
12414         (Relobj::sd_): New data member.
12415         (Sized_relobj::is_output_section_offset_invalid): New function.
12416         (Sized_relobj::do_gc_process_relocs): New function.
12417         * options.h (General_options::gc_sections): Modify to not be a no-op.
12418         (General_options::print_gc_sections): New option.
12419         * plugin.cc (Plugin_finish::run): Remove function call to
12420         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12421         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12422         * reloc.cc (Read_relocs::run): Add task to process relocs and
12423         determine unreferenced sections when doing garbage collection.
12424         (Gc_process_relocs): New class.
12425         (Sized_relobj::do_gc_process_relocs): New function.
12426         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12427         sections that are garbage collected.
12428         * reloc.h (Gc_process_relocs): New class.
12429         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12430         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12431         symbols whose corresponding sections are garbage collected.
12432         (Symbol_table::Symbol_table): Add new parameter for the garbage
12433         collection object.
12434         (Symbol_table::gc_mark_undef_symbols): New function.
12435         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12436         (Symbol_table::gc_mark_dyn_syms): New function.
12437         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12438         as garbage.
12439         (Symbol_table::add_from_object): Likewise.
12440         (Symbol_table::add_from_relobj): When building shared objects, do not
12441         treat externally visible symbols as garbage.
12442         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12443         table information for static and relocatable links.
12444         * symtab.h (Symbol_table::set_gc): New function.
12445         (Symbol_table::gc): New function.
12446         (Symbol_table::gc_mark_undef_symbols): New function.
12447         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12448         (Symbol_table::gc_mark_dyn_syms): New function.
12449         (Symbol_table::gc_): New data member.
12450         * target.h (Sized_target::gc_process_relocs): New pure virtual
12451         function.
12452         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12453         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12454
12455 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12456
12457         * options.h (General_options::gc_sections): Define as a no-op for now.
12458         (General_options::no_keep_memory): Ditto.
12459         (General_options::Bshareable): Define.
12460         * options.cc (General_options::finalize): Honor -Bshareable.
12461
12462 2009-01-20  Andreas Schwab  <schwab@suse.de>
12463
12464         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12465         read the value in the contents, since we don't use it.  Use the
12466         template endianness when writing.
12467         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12468
12469 2009-01-19  Andreas Schwab  <schwab@suse.de>
12470
12471         * configure.tgt (powerpc64-*): Fix targ_obj.
12472
12473 2009-01-15  Ian Lance Taylor  <iant@google.com>
12474
12475         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12476         local symbols when stripping all symbols.
12477
12478 2009-01-14  Cary Coutant  <ccoutant@google.com>
12479
12480         * output.cc (Output_reloc): Add explicit instantiations.
12481
12482 2009-01-14  Cary Coutant  <ccoutant@google.com>
12483
12484         * archive.cc (Archive::get_elf_object_for_member): Remove call
12485         to File_read::claim_for_plugin.
12486         * descriptors.cc (Descriptors::open): Remove reference to
12487         is_claimed.
12488         (Descriptors::claim_for_plugin): Remove.
12489         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12490         (Descriptors::is_claimed): Remove.
12491         (claim_descriptor_for_plugin): Remove.
12492         * fileread.cc (File_read::claim_for_plugin): Remove.
12493         * fileread.h (File_read::claim_for_plugin): Remove.
12494         (File_read::descriptor): Reopen descriptor if necessary.
12495         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12496         (Plugin_manager::all_symbols_read): Add task parameter. Change
12497         all callers.
12498         (Plugin_manager::get_input_file): New function.
12499         (Plugin_manager::release_input_file): New function.
12500         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12501         corresponding data member.
12502         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12503         and pass to base constructor. Change all callers.
12504         (get_input_file, release_input_file): New functions.
12505         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12506         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12507         (Plugin_manager::all_symbols_read): Add task parameter.
12508         (Plugin_manager::get_input_file): New function.
12509         (Plugin_manager::release_input_file): New function.
12510         (Plugin_manager::task_): New data member.
12511         (Pluginobj::Pluginobj): Add filesize parameter.
12512         (Pluginobj::filename): New function.
12513         (Pluginobj::descriptor): New function.
12514         (Pluginobj::filesize): New function.
12515         (Pluginobj::filesize_): New data member.
12516         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12517         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12518         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12519
12520         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12521         with archive libraries.
12522         * testsuite/Makefile.in: Regenerate.
12523         * testsuite/plugin_test.c (struct sym_info): New type.
12524         (get_input_file, release_input_file): New static variables.
12525         (onload): Capture new transfer vector entries.
12526         (claim_file_hook): Stop reading at end of file according to filesize.
12527         Factor out parsing of readelf output into separate function.
12528         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12529         APIs and get the source file name from the symbol table.  Convert
12530         source file name to corresponding object file name.  Print info
12531         message when adding new input files.
12532         (parse_readelf_line): New function.
12533         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12534         * testsuite/plugin_test_2.sh: Likewise.
12535         * testsuite/plugin_test_3.sh: Likewise.
12536         * testsuite/plugin_test_4.sh: New test case.
12537
12538 2009-01-07  Ian Lance Taylor  <iant@google.com>
12539
12540         * version.cc (version_string): Bump to 1.8.
12541
12542 2008-12-23  Cary Coutant  <ccoutant@google.com>
12543
12544         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12545         * plugin.cc (Plugin_manager::finish): Rename as
12546         layout_deferred_objects.  Move cleanup to separate function.
12547         (Plugin_manager::cleanup): New function.
12548         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12549         separately.
12550         * plugin.h (Plugin_manager::finish): Rename as
12551         layout_deferred_objects.
12552         (Plugin_manager::cleanup): New function.
12553         (Plugin_manager::cleanup_done): New field.
12554
12555 2008-12-23  Cary Coutant  <ccoutant@google.com>
12556
12557         * plugin.cc (is_visible_from_outside): New function.
12558         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12559         so we don't return "IR only" status for exported symbols or -r links.
12560
12561         * testsuite/Makefile.am (plugin_test_3): New test case.
12562         * testsuite/Makefile.in: Regenerate.
12563         * testsuite/plugin_test_3.sh: New file.
12564
12565 2008-12-22  Cary Coutant  <ccoutant@google.com>
12566
12567         * object.cc (Sized_relobj::layout_section): New function.
12568         (Sized_relobj::do_layout): Defer layout of input sections until after
12569         plugin has provided replacement files.
12570         (Sized_relobj::do_layout_deferred_sections): New function.
12571         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12572         (Relobj::layout_deferred_sections): New function.
12573         (Relobj::do_layout_deferred_sections): New function.
12574         (Sized_relobj::do_layout_deferred_sections): New function.
12575         (Sized_relobj::layout_section): New function.
12576         (Sized_relobj::Deferred_layout): New structure.
12577         (Sized_relobj::deferred_layout_): New field.
12578         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12579         Change all callers.  Layout deferred sections.
12580         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12581         references.
12582         (Plugin_hook::run): Move code from do_plugin_hook inline.
12583         (Plugin_hook::do_plugin_hook): Remove.
12584         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12585         (Plugin_manager::finish): Renamed, was cleanup.
12586         (Plugin_manager::should_defer_layout): New function.
12587         (Plugin_manager::add_deferred_layout_object): New function.
12588         (Plugin_manager::Deferred_layout_list): New type.
12589         (Plugin_manager::deferred_layout_objects_): New field.
12590         (Plugin_hook::do_plugin_hook): Remove.
12591
12592 2008-12-17  Ian Lance Taylor  <iant@google.com>
12593
12594         * options.h (class General_options): Add --no case for
12595         --export-dynamic.
12596
12597 2008-12-16  Cary Coutant  <ccoutant@google.com>
12598
12599         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12600         vector.
12601         (Plugin_manager::claim_file): Create plugin object even if
12602         plugin did not call the add_symbols callback.
12603         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12604         asking for more symbols than were added.
12605         * testsuite/Makefile.am (plugin_test_1): Add test case with
12606         no global symbols.
12607         (empty.syms): New target.
12608         * testsuite/Makefile.in: Regenerate.
12609         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12610         message. Don't call add_symbols if no globals.
12611         (all_symbols_read_hook): Don't provide replacement for empty
12612         claimed file.
12613
12614 2008-12-12  Ian Lance Taylor  <iant@google.com>
12615
12616         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12617         r_type == 0 for a local symbol with r_sym == 0.
12618         (scan_relocatable_relocs): Pass r_sym to
12619         local_non_section_strategy.
12620         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12621         r_sym parameter.
12622
12623         * configure.ac: Update test for TLS descriptors: they are
12624         supported as of glibc 2.9.
12625         * configure: Rebuild.
12626
12627 2008-12-11  Ian Lance Taylor  <iant@google.com>
12628
12629         PR 7091
12630         * target-reloc.h (Default_scan_relocatable_relocs): For each
12631         function, map r_type == 0 to RELOC_DISCARD.
12632
12633 2008-12-10  Cary Coutant  <ccoutant@google.com>
12634
12635         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12636         object to override a kept COMDAT group from a plugin object.
12637
12638 2008-12-09  Ian Lance Taylor  <iant@google.com>
12639
12640         PR 7088
12641         * yyscript.y (file_cmd): Handle INPUT.
12642
12643         * testsuite/initpri1.c: Change all declarations to be full
12644         prototypes by adding void, to avoid compiler warnings.
12645
12646 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12647
12648         * options.cc (General_options::parse_plugin_opt): New.
12649         (General_options::add_plugin): The argument now is just the filename.
12650         (General_options::add_plugin_option): New.
12651         * options.h (plugin_opt): New.
12652         (add_plugin): Change argument name.
12653         (add_plugin_option): New.
12654         * plugin.cc (Plugin::load): Don't parse the plugin option.
12655         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12656         (Plugin::add_option): New.
12657         (Plugin::args_): Change type.
12658         (Plugin::filename_): New.
12659         (Plugin_manager::add_plugin_option): New.
12660         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12661         * testsuite/Makefile.in: Regenerate.
12662
12663 2008-12-05  Cary Coutant  <ccoutant@google.com>
12664
12665         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12666         Handle --strip-lto-sections option.
12667         * options.h (strip_lto_sections): New option.
12668
12669 2008-12-01  Cary Coutant  <ccoutant@google.com>
12670
12671         * plugin.cc (ld_plugin_message): Change format parameter to const.
12672         Fix mismatch between new[] and delete.
12673
12674 2008-11-14  Cary Coutant  <ccoutant@google.com>
12675
12676         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12677         instead of -1U.
12678
12679 2008-11-05  Craig Silverstein  <csilvers@google.com>
12680
12681         * options.cc (General_options::parse_dynamic_list): New function.
12682         * options.h (General_options): New flags dynamic_list,
12683         dynamic_list_data, dynamic_list_cpp_new, and
12684         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12685         (General_options::in_dynamic_list): New function.
12686         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12687         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12688         (Lex::can_continue_name): Likewise.
12689         (yylex): Likewise.
12690         (read_script_file): New parameter script_options.
12691         (read_dynamic_list): New function.
12692         (Script_options::define_dynamic_list): New function.
12693         (dynamic_list_keyword_parsecodes): New variable.
12694         (dynamic_list_keywords): New variable.
12695         * script.h (Script_options::define_dynamic_list): New function
12696         prototype.
12697         (read_dynamic_list): New function prototype.
12698         * symtab.cc (strprefix): New macro.
12699         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12700         dynamic_list_data, dynamic_list_cpp_new, and
12701         dynamic_list_cpp_typeinfo.
12702         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12703         (dynamic_list_expr): New rule.
12704         (dynamic_list_nodes): Likewise.
12705         (dynamic_list_node): Likewise.
12706         * testsuite/Makefile.am (dynamic_list): New test.
12707         * testsuite/Makefile.in: Regenerated.
12708         * testsuite/dynamic_list.t: New file.
12709         * testsuite/dynamic_list.sh: New file.
12710
12711 2008-11-05  Craig Silverstein  <csilvers@google.com>
12712
12713         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12714         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12715         (t11_last): Likewise.
12716         * testsuite/ver_test_6.c (main): Likewise.
12717
12718 2008-10-07  Cary Coutant  <ccoutant@google.com>
12719
12720         * options.c (General_options::finalize): Add check for -static and
12721         -shared.
12722         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12723         is not empty.
12724
12725 2008-10-02  Cary Coutant  <ccoutant@google.com>
12726
12727         * plugin.cc (make_sized_plugin_object): Fix conditional
12728         compilation to work when not all targets are enabled.
12729
12730 2008-09-29  Cary Coutant  <ccoutant@google.com>
12731
12732         * archive.cc (Archive::get_file_and_offset): Use filename instead
12733         of name to get library path.
12734         (Archive::include_member): Unlock external member of a thin archive.
12735
12736         * testsuite/Makefile.am (TEST_AR): New variable.
12737         (thin_archive_test_1): New test.
12738         (thin_archive_test_2): New test.
12739         * testsuite/Makefile.in: Regenerate.
12740         * testsuite/thin_archive_main.cc: New file.
12741         * testsuite/thin_archive_test_1.cc: New file.
12742         * testsuite/thin_archive_test_2.cc: New file.
12743         * testsuite/thin_archive_test_3.cc: New file.
12744         * testsuite/thin_archive_test_4.cc: New file.
12745
12746 2008-09-29  Cary Coutant  <ccoutant@google.com>
12747
12748         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12749         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12750         instead of -1U.
12751         (Sized_relobj::do_finalize_local_symbols): Likewise.
12752         (Sized_relobj::map_to_kept_section): Likewise.
12753         * object.h (Sized_relobj::invalid_address): New constant.
12754         (Sized_relobj::do_output_section_offset): Check for invalid_address
12755         and return -1ULL.
12756         * output.cc (Output_reloc::local_section_offset): Use constant
12757         invalid_address instead of -1U.
12758         (Output_reloc::get_address): Likewise.
12759         (Output_section::output_address): Change -1U to -1ULL.
12760         * output.h (Output_reloc::invalid_address): New constant.
12761         * reloc.cc (Sized_relobj::write_sections): Use constant
12762         invalid_address instead of -1U.
12763         (Sized_relobj::relocate_sections): Likewise.
12764         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12765         values for merge sections.
12766         * target-reloc.h (relocate_for_relocatable): Use constant
12767         invalid_address instead of -1U.
12768
12769 2008-09-19  Cary Coutant  <ccoutant@google.com>
12770
12771         Add plugin functionality for link-time optimization (LTO).
12772         * configure.ac (plugins): Add --enable-plugins option.
12773         * configure: Regenerate.
12774         * config.in: Regenerate.
12775         * Makefile.am (LIBDL): New variable.
12776         (CCFILES): Add plugin.cc.
12777         (HFILES): Add plugin.h.
12778         (ldadd_var): Add LIBDL.
12779         * Makefile.in: Regenerate.
12780
12781         * archive.cc: Include "plugin.h".
12782         (Archive::setup): Don't preread archive symbols when using a plugin.
12783         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12784         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12785         files.
12786         (Archive::include_member): Add symbols from plugin objects.
12787         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12788         * descriptors.cc (Descriptors::open): Check for file descriptors
12789         abandoned by plugins.
12790         (Descriptors::claim_for_plugin): New function.
12791         * descriptors.h (Descriptors::claim_for_plugin): New function.
12792         (Open_descriptor::is_claimed): New field.
12793         (claim_descriptor_for_plugin): New function.
12794         * fileread.cc (File_read::claim_for_plugin): New function.
12795         * fileread.h (File_read::claim_for_plugin): New function.
12796         (File_read::descriptor): New function.
12797         * gold.cc: Include "plugin.h".
12798         (queue_initial_tasks): Add task to call plugin hooks for generating
12799         new object files.
12800         * main.cc: Include "plugin.h".
12801         (main): Load plugin libraries.
12802         * object.h (Pluginobj): Declare.
12803         (Object::pluginobj): New function.
12804         (Object::do_pluginobj): New function.
12805         (Object::set_target): New function.
12806         * options.cc: Include "plugin.h".
12807         (General_options::parse_plugin): New function.
12808         (General_options::General_options): Initialize plugins_ field.
12809         (General_options::add_plugin): New function.
12810         * options.h (Plugin_manager): Declare.
12811         (General_options): Add --plugin option.
12812         (General_options::has_plugins): New function.
12813         (General_options::plugins): New function.
12814         (General_options::add_plugin): New function.
12815         (General_options::plugins_): New field.
12816         * plugin.cc: New file.
12817         * plugin.h: New file.
12818         * readsyms.cc: Include "plugin.h".
12819         (Read_symbols::do_read_symbols): Check for archive before checking
12820         for ELF file.  Call plugin hooks to claim files.
12821         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12822         from a real object file; force override when processing replacement
12823         files.
12824         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12825         (Symbol::init_base_object): Likewise.
12826         (Symbol::init_base_output_data): Likewise.
12827         (Symbol::init_base_output_segment): Likewise.
12828         (Symbol::init_base_constant): Likewise.
12829         (Symbol::init_base_undefined): Likewise.
12830         (Symbol::output_section): Assert that object is not a plugin.
12831         (Symbol_table::add_from_pluginobj): New function.
12832         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12833         undefined.
12834         (Symbol_table::sized_write_globals): Likewise.
12835         (Symbol_table::add_from_pluginobj): Instantiate template.
12836         * symtab.h (Sized_pluginobj): Declare.
12837         (Symbol::in_real_elf): New function.
12838         (Symbol::set_in_real_elf): New function.
12839         (Symbol::in_real_elf_): New field.
12840         (Symbol_table::add_from_pluginobj): New function.
12841
12842         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12843         (LIBDL): New variable.
12844         (LDADD): Add LIBDL.
12845         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12846         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12847         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12848         (MOSTLYCLEANFILES): Likewise.
12849         * testsuite/Makefile.in: Regenerate.
12850         * testsuite/plugin_test.c: New file.
12851         * testsuite/plugin_test_1.sh: New file.
12852         * testsuite/plugin_test_2.sh: New file.
12853
12854 2008-09-16  Ian Lance Taylor  <iant@google.com>
12855
12856         * target-reloc.h (relocate_section): Check whether a symbol is
12857         defined by the ABI before reporting an undefined symbol error.
12858         * target.h (Target::is_defined_by_abi): Make parameter const.
12859         (Target::do_is_defined_by_abi): Likewise.
12860         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12861         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12862         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12863         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12864         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12865         * testsuite/Makefile.in: Rebuild.
12866
12867         * fileread.cc (make_view): Add casts to avoid warning.
12868
12869 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12870
12871         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12872         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12873
12874 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12875
12876         * options.h (General_options::output_is_executable): New.
12877         (General_options::output_is_pie): New.
12878         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12879         for shared libraries.
12880         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12881
12882 2008-09-11  Chris Demetriou  <cgd@google.com>
12883
12884         * options.h (origin): New -z option.
12885         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12886         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12887         in DT_FLAGS_1.
12888
12889 2008-09-05  Cary Coutant  <ccoutant@google.com>
12890
12891         * fileread.cc (File_read::make_view): Add check for attempt to map
12892         beyond end of file.
12893
12894 2008-09-05  Cary Coutant  <ccoutant@google.com>
12895
12896         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12897         explicit instantiations.
12898
12899 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12900
12901         PR gold/6858
12902         * options.cc (General_options::finalize): Allow undefined symbols
12903         in shlibs if linking -shared.
12904
12905         PR gold/6859
12906         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12907         symbols as not needing a dynsym entry.
12908
12909 2008-08-20  Craig Silverstein  <csilvers@google.com>
12910
12911         * fileread.cc (File_read::open): Do not lock the file unless it
12912         was successfully opened.
12913
12914 2008-08-14  Cary Coutant  <ccoutant@google.com>
12915
12916         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12917         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12918         * testsuite/tls_test.cc (struct int128): 128-bit struct
12919         for testing TLS relocs with non-zero addend.
12920         (v12): New TLS variable.
12921         (t12): New test.
12922         (t_last): Add check for v12.
12923         * testsuite/tls_test.h (t12): New function.
12924         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12925
12926 2008-08-13  Ian Lance Taylor  <iant@google.com>
12927
12928         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12929         set tls_segment_ or relro_segment_.
12930         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12931         when appropriate.
12932         * output.h (Output_section::clear_is_relro): New function.
12933         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12934         sections specially even when output_data_ is empty.
12935         (Output_segment::maximum_alignment): When first section is relro,
12936         only force alignment for PT_LOAD segments.
12937         * script.cc (script_data_segment_align): New function.
12938         (script_data_segment_relro_end): New function.
12939         * script-c.h (script_data_segment_align): Declare.
12940         (script_data_segment_relro_end): Declare.
12941         * script-sections.h (class Script_sections): Declare
12942         data_segment_align and data_segment_relro_end.  Add fields
12943         segment_align_index_ and saw_relro_end_.
12944         * script-sections.cc (class Sections_element): Add set_is_relro
12945         virtual function.  Add new bool* parameter to place_orphan_here.
12946         Add get_output_section virtual function.
12947         (class Output_section_definition): Add set_is_relro.  Add new
12948         bool* parameter to place_orphan_here.  Add get_output_section.
12949         Add is_relro_ field.
12950         (Output_section_definition::Output_section_definition): Initialize
12951         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12952         and is_relro_ fields.
12953         (Output_section_definition::place_orphan_here): Add is_relro
12954         parameter.
12955         (Output_section_definition::set_section_addresses): Set relro for
12956         output section.
12957         (Output_section_definition::alternate_constraint): Likewise.
12958         (class Orphan_output_section): Add new bool* parameter to
12959         place_orphan_here.  Add get_output_section.
12960         (Orphan_output_section::place_orphan_here): Add is_relro
12961         parameter.
12962         (Script_sections::Script_sections): Initialize
12963         data_segment_align_index_ and saw_relro_end_.
12964         (Script_sections::data_segment_align): New function.
12965         (Script_sections::data_segment_relro_end): New function.
12966         (Script_sections::place_orphan): Set or clear is_relro.
12967         (Script_sections::set_section_addresses): Force alignment of first
12968         TLS section.
12969         * yyscript.y (exp): Call script_data_segment_align and
12970         script_data_segment_relro_end.
12971         * testsuite/relro_script_test.t: New file.
12972         * testsuite/relro_test.cc (using_script): Declare.
12973         (t1, t2): Test using_script.
12974         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12975         (relro_script_test_SOURCES): Define.
12976         (relro_script_test_DEPENDENCIES): Define.
12977         (relro_script_test_LDFLAGS): Define.
12978         (relro_script_test_LDADD): Define.
12979         (relro_script_test.so): New target.
12980         * testsuite/Makefile.in: Rebuild.
12981
12982 2008-08-06  Cary Coutant <ccoutant@google.com>
12983
12984         * archive.cc (Archive::total_archives, Archive::total_members)
12985         (Archive::total_members_loaded): New variables.
12986         (Archive::setup): Add parameter.  Add option to preread
12987         archive symbols.
12988         (Archive::read_armap): Add counter.
12989         (Archive::get_file_and_offset): New function.
12990         (Archive::get_elf_object_for_member): New function.
12991         (Archive::read_all_symbols): New function.
12992         (Archive::read_symbols): New function.
12993         (Archive::add_symbols): Add counters.
12994         (Archive::include_all_members): Use armap to find members if it's
12995         already built.
12996         (Archive::include_member): Skip reading symbols if already read.
12997         Factored code into Archive::get_file_and_offset and
12998         Archive::get_elf_object_for_member.  Changed call to
12999         Mapfile::report_include_archive_member.
13000         (Archive::print_stats): New function.
13001         * archive.h: Declare Object and Read_symbols_data classes.
13002         (Archive::Archive): Add initializers for new members.
13003         (Archive::setup): Add parameter.
13004         (Archive::print_stats): New function.
13005         (Archive::total_archives, Archive::total_members)
13006         (Archive::total_members_loaded): New variables.
13007         (Archive::get_file_and_offset): New function.
13008         (Archive::get_elf_object_for_member): New function.
13009         (Archive::read_all_symbols): New function.
13010         (Archive::read_symbols): New function.
13011         (Archive::Archive_member): New class.
13012         (Archive::members_): New member.
13013         (Archive::num_members_): New member.
13014         * main.cc: Include archive.h.
13015         (main): Call Archive::print_stats.
13016         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13017         archive parameter; member_name is now the fully-decorated name.
13018         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13019         * options.h: (General_options): Add --preread-archive-symbols option.
13020         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13021         Archive::setup.
13022
13023 2008-08-04  Ian Lance Taylor  <iant@google.com>
13024
13025         * symtab.h (Symbol::use_plt_offset): New function.
13026         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13027         * powerpc.cc (Relocate::relocate): Likewise.
13028         * sparc.cc (Relocate::relocate): Likewise.
13029         * x86_64.cc (Relocate::relocate): Likewise.
13030         * testsuite/weak_plt.sh: New test.
13031         * testsuite/weak_plt_main.cc: New test.
13032         * testsuite/weak_plt_shared.cc: New test.
13033         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13034         (check_PROGRAMS): Add weak_plt.
13035         (check_DATA): Add weak_plt_shared.so.
13036         (weak_plt_main_pic.o, weak_plt): New targets.
13037         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13038         * testsuite/Makefile.in: Rebuild.
13039
13040         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13041         gcctestdir/ld.
13042         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13043         * testsuite/Makefile.in: Rebuild.
13044
13045 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13046
13047         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13048         * Makefile.in: Regenerate.
13049         * po/POTFILES.in: Regenerate.
13050
13051 2008-07-29  Ian Lance Taylor  <iant@google.com>
13052
13053         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13054         symbols before other symbols.
13055         * testsuite/script_test_2.cc (test_addr): Declare.
13056         (test_addr_alias): Declare.
13057         (main): Check that test_addr and test_addr_alias have the right
13058         values.
13059         * testsuite/script_test_2.t: Define test_addr_alias and
13060         test_addr.
13061
13062 2008-07-24  Ian Lance Taylor  <iant@google.com>
13063
13064         PR 5990
13065         * descriptors.cc: New file.
13066         * descriptors.h: New file.
13067         * gold-threads.h (class Hold_optional_lock): New class.
13068         * fileread.cc: Include "descriptors.h".
13069         (File_read::~File_read): Release descriptor rather than closing
13070         it.
13071         (File_read::open) [file]: Call open_descriptor rather than open.
13072         Set is_descriptor_opened_.
13073         (File_read::open) [memory]: Assert that descriptor is not open.
13074         (File_read::reopen_descriptor): New function.
13075         (File_read::release): Release descriptor.
13076         (File_read::do_read): Make non-const.  Reopen descriptor.
13077         (File_read::read): Make non-const.
13078         (File_read::make_view): Reopen descriptor.
13079         (File_read::do_readv): Likewise.
13080         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13081         Update declarations.
13082         * layout.cc: Include "descriptors.h".
13083         (Layout::create_build_id): Use open_descriptor rather than open.
13084         * output.cc: Include "descriptors.h".
13085         (Output_file::open): Use open_descriptor rather than open.
13086         * archive.cc (Archive::const_iterator): Change Archive to be
13087         non-const.
13088         (Archive::begin, Archive::end): Make non-const.
13089         (Archive::count_members): Likewise.
13090         * archive.h (class Archive): Update declarations.
13091         * object.h (Object::read): Make non-const.
13092         * Makefile.am (CCFILES): Add descriptors.cc.
13093         (HFILES): Add descriptors.h.
13094         * Makefile.in: Rebuild.
13095
13096         PR 6716
13097         * gold.h: Always include <clocale>.  Add Solaris workarounds
13098         following code in binutils/sysdep.h.
13099
13100         PR 6048
13101         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13102         this->eh_frame_hdr_ is NULL before using it.
13103
13104         * dynobj.cc (Versions::Versions): Update comment.
13105
13106         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13107         the base version name.
13108
13109         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13110         array size plus one.
13111         (Stringpool_template::set_string_offsets): Subtract one from key
13112         before using it as an array index.
13113         (Stringpool_template::get_offset_with_length): Likewise.
13114         (Stringpool_template::write_to_buffer): Likewise.
13115         * stringpool.h (Stringpool_template::get_offset_from_key):
13116         Likewise.
13117
13118 2008-07-23  Ian Lance Taylor  <iant@google.com>
13119
13120         PR 6658
13121         * object.h (Merged_symbol_value::value): Do our best to handle a
13122         negative addend.
13123
13124         PR 6647
13125         * script.cc (Version_script_info::get_versions): Don't add empty
13126         version tag to return value.
13127         (Version_script_info::get_symbol_version_helper): Change return
13128         type to bool.  Add pversion parameter.  Change all callers.
13129         (script_register_vers_node): Don't require a non-NULL tag.
13130         * script.h (class Version_script_info): Update declarations.
13131         (Version_script_info::get_symbol_version): Change return type to
13132         bool.  Add version parameter.  Change all callers.
13133         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13134         handling.  Handle an empty version from a version script.
13135         (Symbol_table::define_special_symbol): Likewise.
13136         * testsuite/ver_test_10.script: New file.
13137         * testsuite/ver_test_10.sh: New file.
13138         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13139         (check_DATA): Add ver_test_10.syms.
13140         (ver_test_10.syms, ver_test_10.so): New target.
13141         * testsuite/Makefile.in: Rebuild.
13142
13143 2008-07-23  Simon Baldwin  <simonb@google.com>
13144
13145         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13146         to zero for undefined symbols from dynamic libraries.
13147
13148 2008-07-23  Ian Lance Taylor  <iant@google.com>
13149
13150         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13151         Change all callers.
13152         * symtab.h (class Symbol_table): Update declaration.
13153         * testsuite/ver_test_9.cc: New file.
13154         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13155         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13156         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13157         (ver_test_9.so, ver_test_9.o): New targets.
13158         * testsuite/Makefile.in: Rebuild.
13159
13160 2008-07-22  Ian Lance Taylor  <iant@google.com>
13161
13162         * options.h (class General_options): Define --check-sections.
13163         * layout.cc (Layout::set_segment_offsets): Handle
13164         --check-sections.
13165
13166         * options.h (class General_options): Define -n/--nmagic and
13167         -N/--omagic.
13168         * options.cc (General_options::finalize): For -n/--nmagic or
13169         -N/--omagic, set -static.
13170         * layout.cc (Layout::attach_allocated_section_to_segment): If
13171         -N/--omagic, don't put read-only and read-write sections in
13172         different segments.
13173         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13174         finding a read-only segment.
13175         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13176         don't set the minimum segment alignment to the common page size,
13177         and don't set the file offset to the address modulo the page size.
13178         * script-sections.cc (Script_sections::create_segments): If
13179         -n/--omagic, don't put read-only and read-write sections in
13180         different segments.
13181
13182         * cref.cc: New file.
13183         * cref.h: New file.
13184         * options.h (class General_options): Add --print-symbol-counts.
13185         * main.cc (main): Issue defined symbol report if requested.
13186         * archive.cc (Archive::interpret_header): Make into a const member
13187         function.
13188         (Archive::add_symbols): Call Input_objects::archive_start and
13189         archive_stop.
13190         (Archive::const_iterator): Define new class.
13191         (Archive::begin, Archive::end): New functions.
13192         (Archive::include_all_members): Rewrite to use iterator.
13193         (Archive::count_members): New function.
13194         * archive.h (class Archive): Update declarations.
13195         (Archive::filename): New function.
13196         * object.cc: Include "cref.h".
13197         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13198         (Sized_relobj::do_get_global_symbol_counts): New function.
13199         (Input_objects::add_object): Add object to cross-referencer.
13200         (Input_objects::archive_start): New function.
13201         (Input_objects::archive_stop): New function.
13202         (Input_objects::print_symbol_counts): New function.
13203         * object.h: Declare Cref and Archive.
13204         (Object::get_global_symbol_counts): New function.
13205         (Object::do_get_global_symbol_counts): New pure virtual function.
13206         (class Sized_relobj): Add defined_count_ field.  Update
13207         declarations.
13208         (class Input_objects): Add cref_ field.  Update constructor.
13209         Update declarations.
13210         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13211         defined_count_.
13212         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13213         symbol counts.
13214         (Sized_dynobj::do_get_global_symbol_counts): New function.
13215         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13216         defined_count_.  Update declarations.  Define Symbols typedef.
13217         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13218         parameter.  Change all callers.
13219         (Symbol_table::add_from_dynobj): Add sympointers and defined
13220         parameters.  Change all callers.
13221         * symtab.h (class Symbol_table): Update declarations.
13222         * Makefile.am (CCFILES): Add cref.cc.
13223         (HFILES): Add cref.h.
13224         * Makefile.in: Rebuild.
13225
13226 2008-07-22  Simon Baldwin  <simonb@google.com>
13227
13228         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13229         to zero when writing undefined symbols.
13230
13231 2008-07-22  Ian Lance Taylor  <iant@google.com>
13232
13233         * output.cc (Output_section::add_input_section): Don't try to
13234         merge empty merge sections.
13235
13236 2008-07-21  Craig Silverstein  <csilvers@google.com>
13237
13238         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13239         Include symbol version in error message.
13240
13241 2008-07-20  Chris Demetriou  <cgd@google.com>
13242
13243         * configure.ac (gold_cv_c_random_seed): New configured variable.
13244         (RANDOM_SEED_CFLAGS): New substituted variable.
13245         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13246         * configure: Rebuild.
13247         * Makefile.in: Likewise.
13248         * testsuite/Makefile.in: Likewise.
13249
13250 2008-07-18  Ian Lance Taylor  <iant@google.com>
13251
13252         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13253         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13254         * testsuite/ver_test_main.cc (main): Call t4.
13255         (t4, t4_2a): Define.
13256         * testsuite/ver_test_2.cc (t4_2): Define.
13257         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13258         * testsuite/ver_test_4.cc (t4_2a): Define.
13259         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13260         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13261
13262 2008-07-17  Ian Lance Taylor  <iant@google.com>
13263
13264         * dynobj.cc (Versions::add_def): If we give an error about a
13265         missing version, go ahead and create the version anyhow.
13266
13267 2008-07-10  Ian Lance Taylor  <iant@google.com>
13268
13269         Handle output sections with more than 0x7fffffff bytes.
13270         * object.h (class Relobj): Change map_to_output_ to
13271         output_sections_, and just keep a section pointer.  Change all
13272         uses.  Move comdat group support to Sized_relobj.
13273         (Relobj::is_section_specially_mapped): Remove.
13274         (Relobj::output_section): Remove poff parameter.  Change all
13275         callers.
13276         (Relobj::output_section_offset): New function.
13277         (Relobj::set_section_offset): Rewrite.
13278         (Relobj::map_to_output): Remove.
13279         (Relobj::output_sections): New function.
13280         (Relobj::do_output_section_offset): New pure virtual function.
13281         (Relobj::do_set_section_offset): Likewise.
13282         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13283         group support from Relobj.  Update declarations.
13284         (Sized_relobj::get_output_section_offset): New function.
13285         (Sized_relobj::do_output_section_offset): New function.
13286         (Sized_relobj::do_set_section_offset): New function.
13287         * object.cc (Relobj::output_section_address): Remove.
13288         (Sized_relobj::Sized_relobj): Initialize new fields.
13289         (Sized_relobj::include_section_group): Cast find_kept_object to
13290         Sized_relobj.
13291         (Sized_relobj::include_linkonce_section): Likewise.
13292         (Sized_relobj::do_layout): Use separate arrays for output section
13293         and output offset.
13294         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13295         output_sections.
13296         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13297         output_sections and section_offsets.
13298         (Sized_relobj::write_local_symbols): Likewise.
13299         (map_to_kept_section): Compute output address directly.
13300         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13301         output_sections and section_offsets.
13302         (Sized_relobj::write_sections): Likewise.
13303         (Sized_relobj::relocate_sections): Likewise.
13304         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13305         * output.h (class Output_reloc): Update declarations.  Change
13306         u2_.relobj to Sized_relobj*.
13307         (class Output_data_reloc): Change add functions to use
13308         Sized_relobj*.
13309         * output.cc (Output_reloc::Output_reloc): Change relobj to
13310         Sized_relobj*.
13311         (Output_reloc::local_section_offset): Change return type to
13312         Elf_Addr.  Use get_output_section_offset.
13313         (Output_reloc::get_address): Likewise.
13314         (Output_section::is_input_address_mapped): Don't call
13315         is_section_specially_mapped.
13316         (Output_section::output_offset): Likewise.
13317         (Output_section::output_address): Likewise.
13318         (Output_section::starting_output_address): Likewise.
13319         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13320         parameter to Sized_relobj*.
13321         (Copy_relocs::need_copy_reloc): Likewise.
13322         (Copy_relocs::save): Likewise.
13323         * copy-relocs.h (class Copy_relocs): Update declarations.
13324         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13325         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13326         * target-reloc.h (relocate_for_relocatable): Change
13327         offset_in_output_section type to Elf_Addr.  Change code that uses
13328         it as well.
13329         * layout.cc (Layout::layout): Always set *off.
13330         * mapfile.cc (Mapfile::print_input_section): Use
13331         output_section_offset.
13332         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13333         Sized_relobj*.
13334         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13335         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13336         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13337
13338 2008-07-03  Ian Lance Taylor  <iant@google.com>
13339
13340         * layout.cc (Layout::include_section): Do not discard unrecognized
13341         SHT_STRTAB sections.
13342
13343 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13344
13345         * script.cc (Lex::can_continue_name): Make '?' allowable in
13346         version-script names.
13347         * testsuite/version_script.map: Change glob pattern to use '?'
13348
13349 2008-06-30  Manish Singh  <yosh@gimp.org>
13350
13351         PR 6585
13352         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13353         Correct typo.
13354
13355 2008-06-30  Ian Lance Taylor  <iant@google.com>
13356
13357         PR 6660
13358         PR 6682
13359         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13360         versions]: Don't try to read the value in the contents, since we
13361         don't use it.  Use the template endianness when writing.
13362
13363 2008-06-25  Cary Coutant  <ccoutant@google.com>
13364
13365         * fileread.cc (File_read::make_view): Assert on zero-length view.
13366         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13367         symbol table when there are no symbols to read.
13368
13369 2008-06-23  Craig Silverstein  <csilvers@google.com>
13370
13371         * version.cc (version_string): Bump to 1.7
13372
13373 2008-06-18  Craig Silverstein  <csilvers@google.com>
13374
13375         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13376         constant 0xFFFF to type Valtype.
13377         (Powerpc_relocate_functions::rel16_ha): Likewise.
13378
13379 2008-06-17  Ian Lance Taylor  <iant@google.com>
13380
13381         * output.h (Output_section::Input_section): Initialize p2align_ to
13382         zero for Output_section_data constructors.
13383         (Output_section::Input_section::addralign): If not an input
13384         section, return the alignment of the Output_section_data.
13385         * testsuite/copy_test.cc: New file.
13386         * testsuite/copy_test_1.cc: New file.
13387         * testsuite/copy_test_2.cc: New file.
13388         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13389         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13390         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13391         (copy_test_1_pic.o, copy_test_1.so): New targets.
13392         (copy_test_2_pic.o, copy_test_2.so): New targets.
13393         * testsuite/Makefile.in: Rebuild.
13394
13395         * script-sections.cc (Script_sections::place_orphan): Initialize
13396         local variable exact.
13397
13398 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13399
13400         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13401
13402 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13403             David S. Miller  <davem@davemloft.net>
13404
13405         * powerpc.cc: New file.
13406         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13407         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13408         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13409         * Makefile.in: Rebuild.
13410
13411 2008-06-09  Ian Lance Taylor  <iant@google.com>
13412
13413         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13414         <exception>.
13415         (throwing, orig_terminate): New static variables.
13416         (terminate_handler): New static function.
13417         (t2): Set terminate handler.
13418
13419 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13420
13421         PR 6584
13422         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13423         alignment.
13424
13425 2008-05-30  Cary Coutant  <ccoutant@google.com>
13426
13427         * archive.cc (Archive::include_all_members) Correct to step
13428         over symbol table and extended name table in thin archives.
13429
13430 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13431
13432         PR 6407
13433         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13434         calculation.
13435
13436 2008-05-28  Caleb Howe  <cshowe@google.com>
13437
13438         * reduced_debug_output.cc: New file.
13439         * reduced_debug_output.h: New file.
13440         * options.h (class General_options): Add --strip-debug-non-line.
13441         * options.cc (General_options::finalize): Add strip_debug_non_line
13442         to the strip heirarchy.
13443         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13444         fields.
13445         * layout.cc: Include "reduced_debug_output.h".
13446         (Layout::Layout): Initialize new fields.
13447         (line_only_debug_sections): New static array.
13448         (is_lines_only_debug_sections): New static inline function.
13449         (Layout::include_section): Handle --strip-debug-non-line.
13450         (Layout::make_output_section): If --strip-debug-non-line, build
13451         new output sections for .debug_abbrev and .debug_info.
13452         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13453         gold.  Warn about possible overflow.
13454         (read_signed_LEB_128): Likewise.
13455         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13456         (read_signed_LEB_128): Declare.
13457         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13458         (HFILES): Add reduced_debug_output.h.
13459         * Makefile.in: Rebuild.
13460
13461 2008-05-21  Ian Lance Taylor  <iant@google.com>
13462
13463         * mapfile.cc: New file.
13464         * mapfile.h: New file.
13465         * options.h (class General_options): Add -M/--print-map and -Map.
13466         * options.cc (General_options::finalize): Make -M equivalent to
13467         -Map -.
13468         * main.cc: Include <cstdio> and "mapfile.h".
13469         (main): Open mapfile if requested.
13470         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13471         constructor.  Change caller.
13472         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13473         (queue_middle_tasks): Likewise.
13474         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13475         declarations.
13476         * archive.cc: Include "mapfile.h".
13477         (Archive::add_symbols): Add mapfile parameter.  Change all
13478         callers.  Pass mapfile, symbol, and reason to include_member.
13479         (Archive::include_all_members): Add mapfile parameter.  Change all
13480         callers.
13481         (Archive::include_member): Add mapfile, sym, and why parameters.
13482         Change all callers.  Report inclusion to map file.
13483         * archive.h: Include "fileread.h".
13484         (class Archive): Update declarations.
13485         (Archive::file): New const method.
13486         (class Add_archive_symbols): Add mapfile_ field.  Update
13487         constructor.  Change all callers.
13488         * readsyms.h (class Read_symbols): Likewise.
13489         (class Finish_group): Likewise.
13490         (class Read_script): Likewise.
13491         * common.cc: Include "mapfile.h".
13492         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13493         all callers.
13494         (Symbol_table::do_allocate_commons): Likewise.
13495         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13496         symbol allocation to mapfile.
13497         * common.h (class Allocate_commons_task): Add mapfile_ field.
13498         Update constructor.  Change all callers.
13499         * symtab.h (class Symbol_table): Update declarations.
13500         * layout.cc: Include "mapfile.h".
13501         (Layout_task_runner::run): Print information to mapfile.
13502         (Layout::create_gold_note): Change Output_data_fixed_space to
13503         Output_data_zero_fill.
13504         (Layout::create_build_id): Likewise.
13505         (Layout::print_to_mapfile): New function.
13506         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13507         constructor.  Change caller.
13508         (class Layout): Declare print_to_mapfile.
13509         * output.cc (Output_section::Input_section::print_to_mapfile): New
13510         function.
13511         (Output_section::add_input_section): If producing a map, always
13512         add to input_sections_ list.
13513         (Output_section::do_print_to_mapfile): New function.
13514         (Output_segment::print_sections_to_mapfile): New function.
13515         (Output_segment::print_section_list_to_mapfile): New function.
13516         * output.h: Include "mapfile.h".
13517         (Output_data::print_to_mapfile): New function.
13518         (Output_data::do_print_to_mapfile): New virtual function.
13519         (Output_segment_headers::do_print_to_mapfile): New function.
13520         (Output_file_header::do_print_to_mapfile): New function.
13521         (Output_data_const::do_print_to_mapfile): New function.
13522         (class Output_data_const_buffer): Add map_name_ field.  Update
13523         constructor.  Change all callers.  Add do_print_to_mapfile
13524         function.
13525         (class Output_data_fixed_space): Likewise.
13526         (class Output_data_space): Likewise.
13527         (class Output_data_zero_fill): New class.
13528         (Output_data_strtab::do_print_to_mapfile): New function.
13529         (Output_data_reloc_base::do_print_to_mapfile): New function.
13530         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13531         (Output_data_group::do_print_to_mapfile): New function.
13532         (Output_data_got::do_print_to_mapfile): New function.
13533         (Output_data_dynamic::do_print_to_mapfile): New function.
13534         (Output_symtab_xindex::do_print_to_mapfile): New function.
13535         (class Output_section): Declare do_print_to_mapflie.  Declare
13536         print_to_mapfile in Input_section.
13537         (class Output_segment): Declare new functions.
13538         * object.h (Sized_relobj::symbol_count): New function.
13539         * script-sections.cc
13540         (Output_section_element_dot_assignment::set_section_addresses):
13541         Change Output_data_fixed_space to Output_data_zero_fill.
13542         (Output_data_expression::do_print_to_mapfile): New function.
13543         * script.cc (read_input_script): Add mapfile parameter.  Change
13544         all callers.
13545         * script.h (read_input_script): Update declaration.
13546         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13547         (Eh_frame::do_print_to_mapfile): New function.
13548         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13549         (Output_merge_string::do_print_to_mapfile): New function.
13550         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13551         function.
13552         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13553         function.
13554         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13555         function.
13556         * Makefile.am (CCFILES): Add mapfile.cc.
13557         (HFILES): Add mapfile.h.
13558         * Makefile.in: Rebuild.
13559
13560 2008-05-19  Ian Lance Taylor  <iant@google.com>
13561
13562         * options.h (class General_options): Add -z relro.
13563         * layout.cc (Layout::Layout): Initialize relro_segment_.
13564         (Layout::add_output_section_data): Return the output section.
13565         (Layout::make_output_section): Rcognize relro sections and mark
13566         them appropriately.
13567         (Layout::attach_allocated_section_to_segment): Put relro sections
13568         in a PT_GNU_RELRO segment.
13569         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13570         section as relro.
13571         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13572         PT_TLS segments.
13573         (Layout::linkonce_mapping): Map d.rel.ro.local to
13574         .data.rel.ro.local.
13575         (Layout::output_section_name): Us .data.rel.ro.local for any
13576         section which begins with that.
13577         * layout.h (class Layout): Update add_output_section_data
13578         declaration.  Add relro_segment_ field.
13579         * output.cc (Output_section::Output_section): Initialize is_relro_
13580         and is_relro_local_ fields.
13581         (Output_segment::add_output_section): Group relro sections.
13582         (Output_segment::is_first_section_relro): New function.
13583         (Output_segment::maximum_alignment): If there is a relro section,
13584         align the segment to the common page size.
13585         (Output_segment::set_section_addresses): Track whether we are
13586         looking at relro sections.  If the last section is a relro
13587         section, align to the common page size.
13588         (Output_segment::set_section_list_addresses): Add in_relro
13589         parameter.  Change all callers.  Align to the page size when
13590         moving from relro to non-relro section.
13591         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13592         segment.
13593         * output.h (class Output_section): Add is_relro_ and
13594         is_relro_local_ fields.
13595         (Output_section::is_relro): New function.
13596         (Output_section::set_is_relro): New function.
13597         (Output_section::is_relro_local): New function.
13598         (Output_section::set_is_relro_local): New function.
13599         (class Output_segment): Update declarations.
13600         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13601         * sparc.cc (Target_sparc::got_section): Likewise.
13602         * x86_64.cc (Target_x86_64::got_section): Likewise.
13603         * testsuite/relro_test_main.cc: New file.
13604         * testsuite/relro_test.cc: New file.
13605         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13606         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13607         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13608         (relro_test.so, relro_test_pic.o): New targets.
13609         * testsuite/Makefile.in: Rebuild.
13610
13611 2008-05-16  Ian Lance Taylor  <iant@google.com>
13612
13613         * output.cc (Output_segment::add_output_section): Remove front
13614         parameter.
13615         * output.h (class Output_segment): Remove
13616         add_initial_output_section and overloaded add_output_section.
13617         Update declaration of remaining add_output_section.
13618         * layout.cc (Layout::create_interp): Call add_output_section
13619         rather than add_initial_output_section.
13620         (Layout::finish_dynamic_section): Likewise.
13621
13622         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13623         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13624         know the dynamic type.
13625         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13626         field.  Initialize it in constructor.
13627         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13628         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13629         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13630         reloc.
13631
13632         * output.cc (Output_reloc::get_address): Change return type to
13633         Elf_Addr.
13634         * output.h (class Output_reloc): Update get_address declaration.
13635         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13636         for section addresses.
13637
13638 2008-05-09  Ian Lance Taylor  <iant@google.com>
13639
13640         PR 6493
13641         * gold.cc (gold_nomem): Use return value of write.
13642
13643 2008-05-08  Ian Lance Taylor  <iant@google.com>
13644
13645         * symtab.c (Symbol::init_base_output_data): Add version
13646         parameter.  Change all callers.
13647         (Symbol::init_base_output_segment): Likewise.
13648         (Symbol::init_base_constant): Likewise.
13649         (Symbol::init_base_undefined): Likewise.
13650         (Sized_symbol::init_output_data): Likewise.
13651         (Sized_symbol::init_output_segment): Likewise.
13652         (Sized_symbol::init_constant): Likewise.
13653         (Sized_symbol::init_undefined): Likewise.
13654         (Symbol_table::do_define_in_output_data): If the new symbol has a
13655         version, mark it as the default.
13656         (Symbol_table::do_define_in_output_segment): Likewise.
13657         (Symbol_table::do_define_as_constant): Likewise.
13658         * symtab.h (class Symbol): Update declarations.
13659         (class Sized_symbol): Likewise.
13660         * resolve.cc (Symbol::override_version): New function.
13661         (Symbol::override_base): Call override_version.
13662         (Symbol::override_base_with_special): Likewise.
13663         * testsuite/ver_script_8.script: New file.
13664         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13665         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13666         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13667         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13668
13669 2008-05-06  Ian Lance Taylor  <iant@google.com>
13670
13671         PR 6049
13672         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13673         functions.
13674         (class General_options): Remove existing --undefined, and add
13675         --no-undefined instead.  Add new --undefined as synonym for -u.
13676         * archive.cc (Archive::add_symbols): Check whether symbol was
13677         named with -u.
13678         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13679         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13680         all uses.  Add IS_UNDEFINED.  Update declarations to split
13681         different versions of init_base.  Declare init_base_undefined.
13682         (Symbol::is_defined): Handle IS_UNDEFINED.
13683         (Symbol::is_undefined): Likewise.
13684         (Symbol::is_weak_undefined): Call is_undefined.
13685         (Symbol::is_absolute): Handle IS_CONSTANT.
13686         (class Sized_symbol): Update declarations to split different
13687         versions of init.  Declare init_undefined.
13688         (class Symbol_table): Declare new functions.
13689         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13690         Change all callers.
13691         (Symbol::init_base_output_data): Likewise.
13692         (Symbol::init_base_output_segment): Likewise.
13693         (Symbol::init_base_constant): Likewise.
13694         (Symbol::init_base_undefined): New function.
13695         (Sized_symbol::init_object): Rename from init.  Change all
13696         callers.
13697         (Sized_symbol::init_output_data): Likewise.
13698         (Sized_symbol::init_output_segment): Likewise.
13699         (Sized_symbol::init_constant): Likewise.
13700         (Sized_symbol::init_undefined): New function.
13701         (Symbol_table::add_undefined_symbols_from_command_line): New
13702         function.
13703         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13704         function.
13705         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13706         (Symbol::output_section): Likewise.
13707         (Symbol::set_output_section): Likewise.
13708         (Symbol_table::sized_finalize_symbol): Likewise.
13709         (Symbol_table::sized_write_globals): Likewise.
13710         * resolve.cc (Symbol_table::should_override): Likewise.
13711         (Symbol::override_base_with_special): Likewise.
13712
13713         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13714         symbol, change it to have default visibility.
13715         * testsuite/protected_1.cc: New file.
13716         * testsuite/protected_2.cc: New file.
13717         * testsuite/protected_3.cc: New file.
13718         * testsuite/protected_main_1.cc: New file.
13719         * testsuite/protected_main_2.cc: New file.
13720         * testsuite/protected_main_3.cc: New file.
13721         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13722         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13723         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13724         (protected_1.so): New target.
13725         (protected_1_pic.o, protected_2_pic.o): New targets.
13726         (protected_3_pic.o): New target.
13727         (check_PROGRAMS): Add protected_2.
13728         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13729         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13730         * testsuite/Makefile.in: Rebuild.
13731
13732         * options.h (DEFINE_var): Add set_user_set_##varname__.
13733         (DEFINE_bool_alias): New macro.
13734         (class General_options): Define -Bstatic using DEFINE_bool_alias
13735         rather than DEFINE_special.  Add --undefined as an alias for -z
13736         defs.
13737         * options.cc (General_options::parse_Bstatic): Remove.
13738
13739         * options.h (class General_options): Add --fatal-warnings.
13740         * main.cc (main): Implement --fatal-warnings.
13741         * errors.h (Errors::warning_count): New function.
13742
13743         * options.h (class General_options): Add -Bsymbolic-functions.
13744         * symtab.h (Symbol::is_preemptible): Check for
13745         -Bsymbolic-functions.
13746
13747 2008-05-05  Ian Lance Taylor  <iant@google.com>
13748
13749         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13750         as noVARNAME rather than no-VARNAME.
13751         (class General_options): Add option -z combreloc.
13752         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13753         get_address.
13754         (Output_reloc::sort_before) [SHT_REL]: New function.
13755         (Output_reloc::sort_before) [SHT_RELA]: New function.
13756         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13757         Sort_relocs_comparison.
13758         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13759         parameter.  Change all callers.
13760         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13761         sort_relocs parameter.  Change all callers.
13762         * output.cc (Output_reloc::get_address): New function, broken out
13763         of write_rel.
13764         (Output_reloc::write_rel): Call it.
13765         (Output_reloc::compare): New function.
13766         (Output_data_reloc_base::do_write): Optionally sort relocs.
13767
13768         * configure.ac: If targ_extra_obj is set, link it in.
13769         * configure.tgt: Initialize all variables.
13770         (x86_64*): Set targ_extra_obj and targ_extra_size.
13771         * configure: Rebuild.
13772
13773         * object.cc (Sized_relobj::include_section_group): Adjust section
13774         indexes read from group data.  Build vector to pass to
13775         layout_group.
13776         * layout.cc (Layout::layout_group): Add flags and shndxes
13777         parameters.  Remove contents parameter.  Change caller.  Update
13778         explicit instantiations.
13779         * layout.h (class Layout): Update layout_group declaration.
13780         * output.cc (Output_data_group::Output_data_group): Add flags and
13781         input_shndxes parameters.  Remove contents parameter.  Change
13782         caller.
13783         (Output_data_group::do_write): Change input_sections_ to
13784         input_shndxes_.
13785         * output.h (class Output_data_group): Update constructor
13786         declaration.  Rename input_sections_ to input_shndxes_.
13787         * testsuite/many_sections_test.cc: Add template.
13788
13789 2008-04-30  Cary Coutant  <ccoutant@google.com>
13790
13791         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13792
13793         * layout.cc (Layout::include_section): Refactored check for debug
13794         info section.
13795         (Layout::add_comdat): Add new parameters.  Change type
13796         of signature parameter.  Add object and shndx to signatures table.
13797         (Layout::find_kept_object): New function.
13798         * layout.h: Include <cstring>.
13799         (Layout::is_debug_info_section): New function.
13800         (Layout::add_comdat): Add new parameters.
13801         (Layout::find_kept_object): New function.
13802         (Layout::Kept_section): New struct.
13803         (Layout::Signatures): Change type of map range.
13804         * object.cc (Relobj::output_section_address): New function.
13805         (Sized_relobj::include_section_group): Add new parameters.  Change
13806         calls to Layout::add_comdat.  Change to build table of kept comdat
13807         groups and table mapping discarded sections to kept sections.
13808         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13809         (Sized_relobj::do_layout): Change calls to include_section_group and
13810         include_linkonce_section.
13811         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13812         value to zero when section is discarded.
13813         (Sized_relobj::map_to_kept_section): New function.
13814         * object.h (Relobj::output_section_address): New function.
13815         (Relobj::Comdat_group): New type.
13816         (Relobj::find_comdat_group): New function.
13817         (Relobj::Comdat_group_table): New type.
13818         (Relobj::Kept_comdat_section): New type.
13819         (Relobj::Kept_comdat_section_table): New type.
13820         (Relobj::add_comdat_group): New function.
13821         (Relobj::set_kept_comdat_section): New function.
13822         (Relobj::get_kept_comdat_section): New function.
13823         (Relobj::comdat_groups_): New field.
13824         (Relobj::kept_comdat_sections_): New field.
13825         (Symbol_value::input_value): Update comment.
13826         (Sized_relobj::map_to_kept_section) New function.
13827         (Sized_relobj::include_linkonce_section): Add new parameter.
13828         * target-reloc.h (Comdat_behavior): New type.
13829         (get_comdat_behavior): New function.
13830         (relocate_section): Add code to map a discarded section to the
13831         corresponding kept section when applying a relocation.
13832
13833 2008-04-30  Craig Silverstein  <csilvers@google.com>
13834
13835         * dwarf_reader.cc (next_generation_count): New static var.
13836         (Addr2line_cache_entry): New struct.
13837         (addr2line_cache): New static var.
13838         (Dwarf_line_info::one_addr2line): Added caching.
13839         (Dwarf_line_info::clear_addr2line_cache): New function.
13840         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13841         cache-size parameter.
13842         (Dwarf_line_info::one_addr2line_cache): New function.
13843         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13844         new cache-size argument to one_addr2line(), and clear cache.
13845
13846 2008-04-28  Cary Coutant  <ccoutant@google.com>
13847
13848         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13849         R_386_PC8 relocations.
13850
13851 2008-04-23  Ian Lance Taylor  <iant@google.com>
13852
13853         * object.cc (Sized_relobj::include_section_group): Check for
13854         invalid section group.
13855
13856         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13857         header size.
13858
13859         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13860         than read for file header.
13861         * archive.cc (Archive::include_member): Likewise.
13862
13863 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13864
13865         * aclocal.m4: Regenerate.
13866         * configure: Regenerate.
13867
13868 2008-04-19  Ian Lance Taylor  <iant@google.com>
13869
13870         * version.cc (version_string): Bump to 1.6.
13871
13872         * testsuite/Makefile.am (many_sections_r_test): New target.
13873         (many_sections_r_test_SOURCES): Remove.
13874         (many_sections_r_test_DEPENDENCIES): Remove.
13875         (many_sections_r_test_LDFLAGS): Remove.
13876         (many_sections_r_test_LDADD): Remove.
13877
13878         * object.cc (Sized_relobj::do_add_symbols): Always pass
13879         local_symbol_count_ to add_from_relobj.
13880
13881         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13882         every thousand variables.
13883         * testsuite/Makefile.in: Rebuild.
13884
13885         * object.cc (Xindex::initialize_symtab_xindex): New function.
13886         (Xindex::read_symtab_xindex): New function.
13887         (Xindex::sym_xindex_to_shndx): New function.
13888         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13889         available.
13890         (Sized_relobj::do_initialize_xindex): New function.
13891         (Sized_relobj::do_read_symbols): Adjust section links.
13892         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13893         parameter.  Change all callers.
13894         (Sized_relobj::include_section_group): Adjust section links and
13895         symbol section indexes.
13896         (Sized_relobj::do_layout): Adjust section links.
13897         (Sized_relobj::do_count_local_symbols): Adjust section links and
13898         symbol section indexes.
13899         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13900         ordinary and special symbols.
13901         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13902         dynsym_xindex parameters.  Change all callers.  Adjust section
13903         links.  Use SHN_XINDEX when needed.
13904         (Sized_relobj::get_symbol_location_info): Adjust section links.
13905         Don't get fooled by special symbols.
13906         * object.h (class Xindex): Define.
13907         (class Object): Add xindex_ parameter.  Declare virtual functoin
13908         do_initialize_xindex.
13909         (Object::adjust_sym_shndx): New function.
13910         (Object::set_xindex): New protected function.
13911         (class Symbol_value): Add is_ordinary_shndx_ field.
13912         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13913         (Symbol_value::value): Assert ordinary section.
13914         (Symbol_value::initialize_input_to_output_map): Likewise.
13915         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13916         Change all callers.
13917         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13918         all callers.
13919         (class Sized_relobj): Update declarations.
13920         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13921         parameter.  Change all callers.
13922         (Sized_relobj::adjust_shndx): New function.
13923         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13924         field.
13925         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13926         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13927         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13928         (Sized_dynobj::read_dynsym_section): Adjust section links.
13929         (Sized_dynobj::read_dynamic): Likewise.
13930         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13931         section links.
13932         (Sized_dynobj::do_initialize_xindex): New function.
13933         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13934         do_initialize_xindex.
13935         (Sized_dynobj::adjust_shndx): New function.
13936         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13937         dynsym_xindex_ fields.
13938         (Layout::finalize): Add a call to set_section_indexes before
13939         creating the symtab sections.
13940         (Layout::set_section_indexes): Don't do anything if the section
13941         already has a section index.
13942         (Layout::create_symtab_sections): Add shnum parameter.  Change
13943         caller.  Create .symtab_shndx section if needed.
13944         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13945         caller.
13946         (Layout::allocated_output_section_count): New function.
13947         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13948         needed.
13949         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13950         fields.  Update declarations.
13951         (Layout::symtab_xindex): New function.
13952         (Layout::dynsym_xindex): New function.
13953         (class Write_symbols_task): Add layout_ field.
13954         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13955         Change caller.
13956         * output.cc (Output_section_headers::Output_section_headers): Add
13957         shstrtab_section parameter.  Change all callers.
13958         (Output_section_headers::do_sized_write): Store overflow values
13959         for section count and section string table section index in
13960         section header zero.
13961         (Output_file_header::do_sized_write): Check for overflow of
13962         section count and section string table section index.
13963         (Output_symtab_xindex::do_write): New function.
13964         (Output_symtab_xindex::endian_do_write): New function.
13965         * output.h (class Output_section_headers): Add shstrtab_section_.
13966         Update declarations.
13967         (class Output_symtab_xindex): Define.
13968         (Output_section::has_out_shndx): New function.
13969         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13970         field.
13971         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13972         Change all callers.
13973         (Sized_symbol::init): Likewise.
13974         (Symbol::output_section): Check for ordinary symbol.
13975         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13976         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13977         callers.
13978         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13979         Change all callers.  Simplify handling of symbols from sections
13980         not included in the link.
13981         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13982         distinction.
13983         (Weak_alias_sorter::operator()): Assert that symbols are
13984         ordinary.
13985         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13986         distinction.
13987         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13988         parameters.  Change all callers.
13989         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13990         symbol distinction.  Use SHN_XINDEX when needed.
13991         (Symbol_table::write_section_symbol): Add symtab_xindex
13992         parameter.  Change all callers.
13993         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13994         SHN_XINDEX when needed.
13995         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13996         declarations.
13997         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13998         (Symbol::is_defined): Check is_ordinary.
13999         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14000         (Symbol::is_absolute, Symbol::is_common): Likewise.
14001         (class Sized_symbol): Update declarations.
14002         (class Symbol_table): Update declarations.
14003         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14004         parameters.  Change all callers.
14005         (Sized_symbol::override): Likewise.
14006         (Symbol_table::override): Likewise.
14007         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14008         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14009         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14010         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14011         to be in an ordinary section.
14012         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14013         object and is_ordinary parameters.  Change all callers.
14014         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14015         Change all callers.  Don't add undefined or non-ordinary symbols
14016         to reloc_map_.
14017         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14018         Change all callers.
14019         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14020         declarations.
14021         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14022         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14023         (Sized_relobj::relocate_sections): Likewise.
14024         * target-reloc.h (scan_relocs): Adjust section symbol index.
14025         (scan_relocatable_relocs): Likewise.
14026         * i386.cc (Scan::local): Check for ordinary symbols.
14027         * sparc.cc (Scan::local): Likewise.
14028         * x86_64.cc (Scan::local): Likewise.
14029         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14030         to symbol_section_and_value.
14031         * testsuite/many_sections_test.cc: New file.
14032         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14033         (check_PROGRAMS): Add many_sections_test.
14034         (many_sections_test_SOURCES): Define.
14035         (many_sections_test_DEPENDENCIES): Define.
14036         (many_sections_test_LDFLAGS): Define.
14037         (BUILT_SOURCES): Add many_sections_define.h.
14038         (many_sections_define.h): New target.
14039         (BUILT_SOURCES): Add many_sections_check.h.
14040         (many_sections_check.h): New target.
14041         (check_PROGRAMS): Add many_sections_r_test.
14042         (many_sections_r_test_SOURCES): Define.
14043         (many_sections_r_test_DEPENDENCIES): Define.
14044         (many_sections_r_test_LDFLAGS): Define.
14045         (many_sections_r_test_LDADD): Define.
14046         (many_sections_r_test.o): New target.
14047         * testsuite/Makefile.in: Rebuild.
14048
14049 2008-04-17  Cary Coutant  <ccoutant@google.com>
14050
14051         * errors.cc (Errors::info): New function.
14052         (gold_info): New function.
14053         * errors.h (Errors::info): New function.
14054         * gold.h (gold_info): New function.
14055         * object.cc (Input_objects::add_object): Print trace output.
14056         * options.cc (options::parse_set): New function.
14057         (General_options::parse_wrap): Deleted.
14058         (General_options::General_options): Deleted initializer.
14059         * options.h (options::String_set): New typedef.
14060         (options::parse_set): New function.
14061         (DEFINE_set): New macro.
14062         (General_options::wrap): Changed to use DEFINE_set. Changed
14063         callers of any_wrap_symbols and is_wrap_symbol.
14064         (General_options::trace, General_options::trace_symbol):
14065         New options.
14066         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14067         (General_options::wrap_symbols_): Deleted.
14068         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14069
14070 2008-04-17  David S. Miller  <davem@davemloft.net>
14071
14072         * options.cc (General_options::parse_V): New function.
14073         * options.h: Add entries for -V and -Qy.
14074
14075 2008-04-17  Ian Lance Taylor  <iant@google.com>
14076
14077         * common.cc (Symbol_table::allocate_commons): Remove options
14078         parameter.  Change caller.
14079         (Symbol_table::do_allocate_commons): Remove options parameter.
14080         Change caller.  Just call do_allocate_commons_list twice.
14081         (Symbol_table::do_allocate_commons_list): New function, broken out
14082         of do_allocate_commons.
14083         * common.h (class Allocate_commons_task): Remove options_ field.
14084         Update constructor.
14085         * symtab.cc (Symbol_table::Symbol_table): Initialize
14086         tls_commons_.
14087         (Symbol_table::add_from_object): Put TLS common symbols on
14088         tls_commons_ list.
14089         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14090         which are IN_OUTPUT_DATA.
14091         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14092         allocate_commons and do_allocate_commons declarations.  Declare
14093         do_allocate_commons_list.
14094         * gold.cc (queue_middle_tasks): Update creation of
14095         Allocate_commons_task to not pass options.
14096         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14097         (TLS_TEST_C_FLAGS): New variable.
14098         (tls_test_c_pic.o): New target.
14099         (tls_test_shared.so): Link in tls_test_c_pic.o.
14100         (tls_test_c_pic_ie.o): New target.
14101         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14102         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14103         (tls_test_c.o): New target.
14104         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14105         (tls_pic_test_LDADD): Likewise.
14106         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14107         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14108         (tls_test_c_gnu2.o): New target.
14109         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14110         tls_test_c_gnu2.o.
14111         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14112         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14113         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14114         * testsuite/tls_test.cc: Include "config.h".
14115         (t_last): Call t11_last.
14116         * testsuite/tls_test.h (t11, t11_last): Declare.
14117         * testsuite/tls_test_c.c: New file.
14118         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14119         * configure.ac: Check for OpenMP support.
14120         * configure, config.in, Makefile.in: Rebuild.
14121         * testsuite/Makefile.in: Rebuild.
14122
14123 2008-04-16  Cary Coutant  <ccoutant@google.com>
14124
14125         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14126         (Target_i386::tls_base_symbol_defined_): New field.
14127         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14128         (Target_i386::Scan::global): Likewise.
14129         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14130         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14131         (Target_x86_64::tls_base_symbol_defined_): New field.
14132         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14133         (Target_x86_64::Scan::global): Likewise.
14134
14135 2008-04-16  Cary Coutant  <ccoutant@google.com>
14136
14137         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14138         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14139         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14140         building shared libraries.
14141         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14142         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14143         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14144         * testsuite/Makefile.in: Rebuild.
14145         * testsuite/weak_undef.h: New file.
14146         * testsuite/weak_undef_file1.cc: Add extra test cases.
14147         * testsuite/weak_undef_file2.cc: Likewise.
14148         * testsuite/weak_undef_test.cc: Likewise.
14149
14150 2008-04-16  David S. Miller  <davem@davemloft.net>
14151
14152         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14153         Add issued_non_pic_error_ field.  Declare check_non_pic.
14154         (Target_sparc::Scan::check_non_pic): New function.
14155         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14156         (Target_sparc::Scan::global): Likewise.
14157
14158         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14159         * configure: Rebuild.
14160
14161         * options.h (DEFINE_enable): New macro.
14162         (new_dtags): New enable option.
14163         (initfirst, interpose, loadfltr, nodefaultlib,
14164         nodelete, nodlopen, nodump): New -z options.
14165         * layout.cc (Layout:finish_dynamic_section): If new
14166         dtags enabled, emit DT_RUNPATH.  Also, emit a
14167         DT_FLAGS_1 containing any specified -z flags.
14168
14169 2008-04-16  Ian Lance Taylor  <iant@google.com>
14170
14171         * copy-relocs.cc: New file.
14172         * copy-relocs.h: New file.
14173         * reloc.cc: Remove Copy_relocs code.
14174         * reloc.h: Likewise.
14175         * reloc-types.h (struct Reloc_types) [both versions]: Add
14176         get_reloc_addend_noerror.
14177         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14178         variants of add_global which take an addend which must be zero.
14179         * i386.cc: Include "copy-relocs.h".
14180         (class Target_i386): Change type of copy_relocs_ to variable,
14181         update initializer.
14182         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14183         Change all callers.
14184         (Target_i386::do_finalize_sections): Change handling of
14185         copy_relocs_.
14186         * sparc.cc: Include "copy-relocs.h".
14187         (class Target_sparc): Change type of copy_relocs_ to variable,
14188         update initializer.
14189         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14190         Change all callers.
14191         (Target_sparc::do_finalize_sections): Change handling of
14192         copy_relocs_.
14193         * x86_64.cc: Include "copy-relocs.h".
14194         (class Target_x86_64): Change type of copy_relocs_ to variable,
14195         update initializer.
14196         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14197         class.  Change all callers.
14198         (Target_x86_64::do_finalize_sections): Change handling of
14199         copy_relocs_.
14200         * Makefile.am (CCFILES): Add copy-relocs.cc.
14201         (HFILES): Add copy-relocs.h.
14202
14203         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14204
14205         * testsuite/script_test_4.sh: Permit leading zeroes.
14206
14207 2008-04-15  Ian Lance Taylor  <iant@google.com>
14208
14209         * script-sections.cc (Script_sections::create_segments): Use
14210         header_size_adjustment even when there is enough room for the
14211         headers.
14212         * testsuite/script_test_4.sh: New file.
14213         * testsuite/script_test_4.t: New file.
14214         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14215         (check_DATA): Add script_test_4.stdout.
14216         (MOSTLYCLEANFILES): Likewise.
14217         (script_test_4): New target.
14218         (script_test_4.stdout): New target.
14219         * testsuite/Makefile.in: Rebuild.
14220
14221         * sparc.cc: Add definitions for Output_data_plt_sparc class
14222         constants.
14223
14224 2008-04-14  David S. Miller  <davem@davemloft.net>
14225
14226         * sparc.cc: New file.
14227         * Makefile.am (TARGETSOURCES): Add sparc.cc
14228         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14229         * configure.tgt: Document targ_extra_size and
14230         targ_extra_big_endian.  Add entries for sparc-* and
14231         sparc64-*.
14232         * configure.ac: Handle targ_extra_size and
14233         targ_extra_big_endian.
14234         * Makefile.in: Rebuild.
14235         * configure: Likewise.
14236         * po/POTFILES.in: Likewise.
14237         * po/gold.pot: Likewise.
14238
14239 2008-04-14  Ian Lance Taylor  <iant@google.com>
14240
14241         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14242         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14243         in the name/type/flags to section mapping.  Don't call
14244         allocate_output_section.
14245         (Layout::choose_output_section): Change parameter from adjust_name
14246         to is_input_section.  Don't permit input sections after sections
14247         are attached to segments.  Don't call allocate_output_section.
14248         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14249         not write_enable_output_section.
14250         (Layout::make_output_section): Don't push to
14251         unattached_section_list_ nor call attach_to_segment.  Call
14252         attach_section_to_segment if sections are attached.
14253         (Layout::attach_sections_to_segments): New function.
14254         (Layout::attach_section_to_segment): New function.
14255         (Layout::attach_allocated_section_to_segment): Rename from
14256         attach_to_segment.  Remove flags parameter.
14257         (Layout::allocate_output_section): Remove function.
14258         (Layout::write_enable_output_section): Remove function.
14259         * layout.h (class Layout): Update for above changes.  Add new
14260         field sections_are_attached_.
14261         * output.h (Output_section::update_flags_for_input_section): New
14262         function.
14263         * output.cc (Output_section::add_input_section): Call
14264         update_flags_for_input_section.
14265         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14266
14267 2008-04-11  Cary Coutant  <ccoutant@google.com>
14268
14269         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14270         thought unnecessary.
14271         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14272
14273 2008-04-11  Ian Lance Taylor  <iant@google.com>
14274
14275         * output.h (class Output_section_data): Remove inline definition
14276         of set_addralign.
14277         * output.cc (Output_section_data::set_addralign): New function.
14278
14279 2008-04-11  Cary Coutant  <ccoutant@google.com>
14280
14281         Add support for TLS descriptors for i386 and x86_64.
14282         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14283         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14284         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14285         GOT_TYPE_TLS_DESC.
14286         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14287         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14288         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14289         relocations.
14290         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14291         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14292         Fix problem with initial-exec relocations.
14293         (Target_i386::Relocate::relocate_tls): Likewise.
14294         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14295         relaxation.
14296         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14297         support for section-plus-offset dynamic table entries.
14298         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14299         (Output_data_dynamic::Dynamic_entry): Add support for
14300         section-plus-offset dynamic table entries.
14301         (Output_data_dynamic::Classification): Likewise.
14302         (Output_data_dynamic::classification_): Renamed offset_.
14303         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14304         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14305         (Target_x86_64::make_plt_section): New function.
14306         (Target_x86_64::reserve_tlsdesc_entries): New function.
14307         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14308         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14309         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14310         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14311         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14312         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14313         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14314         add extra PLT entry for TLS descriptors.
14315         (Output_data_plt_x86_64::got_): New field.
14316         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14317         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14318         fields.
14319         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14320         descriptors.
14321         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14322         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14323         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14324         R_386_TLS_DESC_CALL relocations.
14325         (Target_x86_64::Scan::global): Likewise.
14326         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14327         for TLS descriptors.
14328         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14329         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14330         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14331         GD-to-IE relaxation.
14332         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14333         and TLS_DESCRIPTORS.
14334         * Makefile.in: Rebuild.
14335         * configure: Rebuild.
14336         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14337         (tls_test_shared2.so): New target.
14338         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14339         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14340         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14341         (tls_shared_gd_to_ie_test_LDADD): New variable.
14342         (tls_shared_gnu2_gd_to_ie_test): New target.
14343         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14344         New targets.
14345         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14346         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14347         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14348         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14349         (tls_shared_gnu2_test): New target.
14350         (tls_test_gnu2_shared.so): New target.
14351         (tls_shared_gnu2_test_SOURCES): New variable.
14352         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14353         (tls_shared_gnu2_test_LDFLAGS): New variable.
14354         (tls_shared_gnu2_test_LDADD): New variable.
14355         * testsuite/Makefile.in: Rebuild.
14356         * testsuite/Makefile.
14357
14358 2008-04-11  Ian Lance Taylor  <iant@google.com>
14359
14360         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14361         justsyms.t.
14362         * testsuite/Makefile.in: Rebuild.
14363
14364         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14365         long.
14366         * testsuite/script_test_2.cc (main): Adjust test.
14367
14368 2008-04-11  David S. Miller  <davem@davemloft.net>
14369             Ian Lance Taylor  <iant@google.com>
14370
14371         * options.h (General_options): Add entries for '-Y' and
14372         '-relax'.
14373         * options.cc (General_options:finalize): If -Y was used, add those
14374         entries to the library path instead of the default "/lib" and
14375         "/usr/lib".
14376
14377 2008-04-11  David S. Miller  <davem@davemloft.net>
14378
14379         * testsuite/justsyms.t: Start at 0x100.
14380         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14381         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14382         long.
14383         * testsuite/script_test_2.cc: Adjust string and section length
14384         checks.
14385
14386 2008-04-09  Ian Lance Taylor  <iant@google.com>
14387
14388         PR gold/5996
14389         * script-sections.cc (Sections_element::allocate_to_segment): Add
14390         orphan parameter.
14391         (Output_section_definition::allocate_to_segment): Likewise.
14392         (Orphan_output_section::allocate_to_segment): Likewise.
14393         (Script_sections::attach_sections_using_phdrs_clause): Don't
14394         propagate non-PT_LOAD segments to orphan sections.
14395         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14396         readelf rather than objdump.
14397         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14398         .interp section and PT_INTERP segment are the same size.
14399         * testsuite/Makefile.in: Rebuild.
14400
14401         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14402         aliases for symbols defined in the same object.
14403         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14404         (weak_alias_test_SOURCES): New variable.
14405         (weak_alias_test_DEPENDENCIES): New variable.
14406         (weak_alias_test_LDFLAGS): New variable.
14407         (weak_alias_test_LDADD): New variable.
14408         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14409         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14410         (weak_alias_test_3.o): New target.
14411         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14412         * testsuite/weak_alias_test_main.cc: New file.
14413         * testsuite/weak_alias_test_1.cc: New file.
14414         * testsuite/weak_alias_test_2.cc: New file.
14415         * testsuite/weak_alias_test_3.cc: New file.
14416
14417 2008-04-08  Ian Lance Taylor  <iant@google.com>
14418
14419         * options.h (class General_options): Add --noinhibit-exec option.
14420         * main.cc (main): Check --noinhibit-exec.
14421
14422         * options.h (class General_options): Define --wrap as a special
14423         option.  Add wrap_symbols_ field.
14424         (General_options::any_wrap_symbols): New function.
14425         (General_options::is_wrap_symbol): New function.
14426         * options.cc (General_options::parse_wrap): New function.
14427         (General_options::General_options): Initialize wrap_symbols_.
14428         * symtab.cc (Symbol_table::wrap_symbol): New function.
14429         (Symbol_table::add_from_object): Handle --wrap.
14430         * symtab.h (class Symbol_table): Declare wrap_symbol.
14431         * target.h (Target::wrap_char): New function.
14432         (Target::Target_info): Add wrap_char field.
14433         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14434         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14435         * testsuite/testfile.cc (Target_test::test_target_info):
14436         Likewise.
14437
14438         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14439         there is one.
14440
14441         * layout.h (class Layout): Add added_eh_frame_data_ field.
14442         * layout.cc (Layout::Layout): Initialize new field.
14443         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14444         output section until we find a section we merged successfully.
14445         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14446         that the size be non-zero.
14447
14448         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14449         qualifier.
14450
14451 2008-04-08  Craig Silverstein  <csilvers@google.com>
14452
14453         * configure.ac: Export new conditional variable HAVE_ZLIB.
14454         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14455         on HAVE_ZLIB.
14456         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14457         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14458
14459 2008-04-07  Ian Lance Taylor  <iant@google.com>
14460
14461         * version.cc (version_string): Set to "1.5".
14462
14463         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14464         Add issued_non_pic_error_ field.  Declare check_non_pic.
14465         (Target_x86_64::Scan::check_non_pic): New function.
14466         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14467         (Target_x86_64::Scan::global): Likewise.
14468
14469         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14470         addend parameter.  Change caller.  Handle merge sections.
14471         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14472         Address to Addend.  Don't add in the result of
14473         local_section_offset, pass down the addend and use the returned
14474         value.
14475         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14476         Update declarations of local_section_offset and symbol_value.
14477         * testsuite/two_file_test_1.cc (t18): New function.
14478         * testsuite/two_file_test_2.cc (f18): New function.
14479         * testsuite/two_file_test_main.cc (main): Call t18.
14480         * testsuite/two_file_test.h (t18, f18): Declare.
14481
14482         * configure.ac: Don't test for objdump, c++filt, or readelf.
14483         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14484         conditionals.
14485         (TEST_READELF): New variable.
14486         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14487         (check_PROGRAMS): Add two_file_strip_test.
14488         (two_file_strip_test): New target.
14489         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14490         (two_file_same_shared_strip_test_SOURCES): New variable.
14491         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14492         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14493         (two_file_same_shared_strip_test_LDADD): New variable.
14494         (two_file_shared_strip.so): New target.
14495         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14496         (ver_test_5.syms, ver_test_7.syms): Likewise.
14497         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14498         (strip_test_3.stdout): Use TEST_OBJDUMP.
14499         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14500
14501 2008-04-04  Cary Coutant  <ccoutant@google.com>
14502
14503         * symtab.h (Symbol::is_weak_undefined): New function.
14504         (Symbol::is_strong_undefined): New function.
14505         (Symbol::is_absolute): New function.
14506         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14507         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14508         absolute symbols.
14509         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14510         (weak_undef_test): New target.
14511         * testsuite/Makefile.in: Rebuild.
14512         * testsuite/weak_undef_file1.cc: New file.
14513         * testsuite/weak_undef_file2.cc: New file.
14514         * testsuite/weak_undef_test.cc: New file.
14515
14516 2008-04-03  Craig Silverstein  <csilvers@google.com>
14517
14518         * compressed_output.h (class Output_compressed_section): Use
14519         unsigned buffer.
14520         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14521         add zlib header.
14522         (zlib_compressed_suffix): Removed.
14523         (Output_compressed_section::set_final_data_size): Use unsigned
14524         buffers.
14525         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14526         Fix linker invocation.
14527         (flagstest_o_specialfile_and_compress_debug_sections):
14528         Likewise.
14529         * testsuite/Makefile.in: Regenerated.
14530
14531 2008-04-02  David S. Miller  <davem@davemloft.net>
14532
14533         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14534         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14535
14536 2008-04-02  Craig Silverstein  <csilvers@google.com>
14537
14538         * TODO: New file.
14539
14540 2008-04-02  Ian Lance Taylor  <iant@google.com>
14541
14542         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14543         parameters.  Update for new key type to views_.  Change all
14544         callers.
14545         (File_read::read): Adjust for byteshift in returned view.
14546         (File_read::add_view): New function, broken out of
14547         find_and_make_view.
14548         (File_read::make_view): New function, broken out of
14549         find_and_make_view.
14550         (File_read::find_or_make_view): Add offset and aligned
14551         parameters.  Rewrite accordingly.  Change all callers.
14552         (File_read::get_view): Add offset and aligned parameters.  Adjust
14553         for byteshift in return value.
14554         (File_read::get_lasting_view): Likewise.
14555         * fileread.h (class File_read): Update declarations.
14556         (class File_read::View): Add byteshift_ field.  Add byteshift to
14557         constructor.  Add byteshift method.
14558         * archive.h (Archive::clear_uncached_views): New function.
14559         (Archive::get_view): Add aligned parameter.  Change all callers.
14560         * object.h (Object::get_view): Add aligned parameter.  Change all
14561         callers.
14562         (Object::get_lasting_view): Likewise.
14563
14564         * fileread.cc (File_read::release): Don't call clear_views if
14565         there are multiple objects.
14566         * fileread.h (File_read::clear_uncached_views): New function.
14567         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14568         on the archive.
14569
14570 2008-03-31  Cary Coutant  <ccoutant@google.com>
14571
14572         Add thin archive support.
14573         * archive.cc (Archive::armagt): New const.
14574         (Archive::setup): Remove task parameter and calls to unlock.
14575         (Archive::unlock_nested_archives): New function.
14576         (Archive::read_header): Add nested_off parameter. Change
14577         all callers.
14578         (Archive::interpret_header): Likewise.
14579         (Archive::include_all_members): Change to handle thin
14580         archives.
14581         (Archive::include_member): Likewise.
14582         * archive.h (Archive::Archive): Add new parameters and
14583         initializers.
14584         (Archive::armagt): New const.
14585         (Archive::setup): Remove task parameter.
14586         (Archive::unlock_nested_archives): New function.
14587         (Archive::read_header): Add nested_off parameter.
14588         (Archive::interpret_header): Likewise.
14589         (Archive::Nested_archive_table): New typedef.
14590         (Archive::is_thin_archive_): New field.
14591         (Archive::nested_archives_): New field.
14592         (Archive::options_): New field.
14593         (Archive::dirpath_): New field.
14594         (Archive::task_): New field.
14595         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14596         for thin archives.  Pass additional parameters to
14597         Archive::Archive.  Unlock the archive file after calling
14598         Archive::setup.
14599
14600 2008-03-29  Ian Lance Taylor  <iant@google.com>
14601
14602         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14603         version symbol to be local.
14604         * testsuite/ver_test_4.sh: New file.
14605         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14606         (check_DATA): Add ver_test_4.syms.
14607         (ver_test_4.syms): New target.
14608         * testsuite/Makefile.in: Rebuild.
14609
14610         * output.cc
14611         (Output_section::Input_section_sort_entry::has_priority): New
14612         function.
14613         (Output_section::Input_section_sort_entry::match_file_name): New
14614         function.
14615         (Output_section::Input_section_sort_entry::match_section_name):
14616         Remove.
14617         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14618         Remove.
14619         (Output_section::Input_section_sort_entry::match_section_file):
14620         Remove.
14621         (Output_section::Input_section_sort_compare::operator()): Rewrite
14622         using new Input_section_sort_entry functions.  Sort crtbegin and
14623         crtend first.  Sort sections with no priority before sections with
14624         a priority.
14625         * testsuite/initpri1.c (d3): Check j != 4.
14626         (cd5): New constructor/destructor function.
14627         (main): Check j != 2.
14628
14629         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14630         new symbol when resolving, don't call set_is_default.
14631         * testsuite/ver_test_7.cc: New file.
14632         * testsuite/ver_test_7.sh: New file.
14633         * testsuite/Makefile.am (ver_test_7.so): New target.
14634         (ver_test_7.o): New target.
14635         (check_SCRIPTS): Add ver_test_7.sh.
14636         (check_DATA): Add ver_test_7.syms.
14637         (ver_test_7.syms): New target.
14638
14639 2008-03-28  Ian Lance Taylor  <iant@google.com>
14640
14641         * layout.cc (Layout::layout): If we see an input section with a
14642         name that needs sorting, set the must_sort flag for the output
14643         section.
14644         (Layout::make_output_section): If the name of the output section
14645         indicates that it might require sorting, set the may_sort flag.
14646         * output.h (Output_section::may_sort_attached_input_sections): New
14647         function.
14648         (Output_section::set_may_sort_attached_input_sections): New
14649         function.
14650         (Output_section::must_sort_attached_input_sections): New
14651         function.
14652         (Output_section::set_must_sort_attached_input_sections): New
14653         function.
14654         (class Output_section): Declare Input_section_sort_entry.  Define
14655         Input_section_sort_compare.  Declare
14656         sort_attached_input_sections.  Add new fields:
14657         may_sort_attached_input_sections_,
14658         must_sort_attached_input_sections_,
14659         attached_input_sections_are_sorted_.
14660         * output.cc (Output_section::Output_section): Initialize new
14661         fields.
14662         (Output_section::add_input_section): Add an entry to
14663         input_sections_ if may_sort or must_sort are true.
14664         (Output_section::set_final_data_size): Call
14665         sort_attached_input_sections if necessary.
14666         (Output_section::Input_section_sort_entry): Define new class.
14667         (Output_section::Input_section_sort_compare::operator()): New
14668         function.
14669         (Output_section::sort_attached_input_sections): New function.
14670         * configure.ac: Check whether the compiler supports constructor
14671         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14672         * testsuite/initpri1.c: New file.
14673         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14674         CONSTRUCTOR_PRIORITY.
14675         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14676         (initpri1_LDFLAGS): New variable.
14677         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14678
14679 2008-03-27  Ian Lance Taylor  <iant@google.com>
14680
14681         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14682         * testsuite/common_test_1.c: New file.
14683         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14684         (common_test_1_SOURCES): New variable.
14685         (common_test_1_DEPENDENCIES): New variable.
14686         (common_test_1_LDFLAGS): New variable.
14687
14688         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14689         and commons_ correctly when NAME/VERSION does not override
14690         NAME/NULL.
14691         * testsuite/ver_test_6.c: New file.
14692         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14693         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14694         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14695
14696 2008-03-26  Ian Lance Taylor  <iant@google.com>
14697
14698         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14699         of an undefined symbol from a version script.
14700         * testsuite/Makefile.am (ver_test_5.so): New target.
14701         (ver_test_5.o): New target.
14702         (check_SCRIPTS): Add ver_test_5.sh.
14703         (check_DATA): Add ver_test_5.syms.
14704         (ver_test_5.syms): New target.
14705         * testsuite/ver_test_5.cc: New file.
14706         * testsuite/ver_test_5.script: New file.
14707         * testsuite/ver_test_5.sh: New file.
14708         * Makefile.in, testsuite/Makefile.in: Rebuild.
14709
14710         PR gold/5986
14711         Fix problems building gold with gcc 4.3.0.
14712         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14713         (gold_error_at_location, gold_warning_at_location): Use it.
14714         * configure.ac: Check whether we can compile and use a template
14715         function with a printf attribute.
14716         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14717         when jumping over bytes.
14718         * object.cc: Instantiate Object::read_section_data.
14719         * debug.h: Include <cstring>
14720         * dwarf_reader.cc: Include <algorithm>
14721         * main.cc: Include <cstring>.
14722         * options.cc: Include <cstring>.
14723         * output.cc: Include <cstring>.
14724         * script.cc: Include <cstring>.
14725         * script.h: Include <string>.
14726         * symtab.cc: Include <cstring> and <algorithm>.
14727         * target-select.cc: Include <cstring>.
14728         * version.cc: Include <string>.
14729         * testsuite/testmain.cc: Include <cstdlib>.
14730         * configure, config.in: Rebuild.
14731
14732 2008-03-25  Ian Lance Taylor  <iant@google.com>
14733
14734         * options.cc: Include "../bfd/bfdver.h".
14735         (options::help): Print bug reporting address.
14736
14737         * version.cc (print_version): Adjust output for current value of
14738         BFD_VERSION_STRING.
14739
14740         * NEWS: New file.
14741
14742         * options.cc (options::help): Print list of supported targets.
14743         * target-select.h: Include <vector>.
14744         (class Target_selector): Make machine_, size_, and is_big_endian_
14745         fields const.  Add bfd_name_ and instantiated_target_ fields.
14746         (Target_selector::Target_selector): Add bfd_name parameter.
14747         (Target_selector::recognize): Make non-virtual, call
14748         do_recognize.
14749         (Target_selector::recognize_by_name): Make non-virtual, call
14750         do_recognize_by_name.
14751         (Target_selector::supported_names): New function.
14752         (Target_selector::bfd_name): New function.
14753         (Target_selector::do_instantiate_target): New pure virtual
14754         function.
14755         (Target_selector::do_recognize): New virtual function.
14756         (Target_selector::do_recognize_by_name): New virtual function.
14757         (Target_selector::instantiate_target): New private function.
14758         (supported_target_names): Declare.
14759         * target-select.cc (Target_selector::Target_selector): Update for
14760         new parameter and fields.
14761         (select_target_by_name): Check that the name matches before
14762         calling recognize_by_name.
14763         (supported_target_names): New function.
14764         * i386.cc (class Target_selector_i386): Update Target_selector
14765         constructor call.  Remove recognize and recognize_by_name.  Add
14766         do_instantiate_target.
14767         * x86_64.cc (class Target_selector_x86_64): Likewise.
14768         * testsuite/testfile.cc (class Target_selector_test): Update for
14769         changes to Target_selector.
14770
14771         * README: Rewrite, with some notes on unsupported features.
14772
14773 2008-03-24  Cary Coutant  <ccoutant@google.com>
14774
14775         * i386.cc (Target_i386::Got_type): New enum declaration.
14776         (Target_i386::Scan::local): Updated callers of Output_data_got
14777         member functions.
14778         (Target_i386::Scan::global): Likewise.
14779         (Target_i386::Relocate::relocate): Likewise.
14780         (Target_i386::Relocate::relocate_tls): Likewise.
14781         * object.h (Got_offset_list): New class.
14782         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14783         (Sized_relobj::local_got_offset): Likewise.
14784         (Sized_relobj::set_local_got_offset): Likewise.
14785         (Sized_relobj::local_has_tls_got_offset): Removed.
14786         (Sized_relobj::local_tls_got_offset): Removed.
14787         (Sized_relobj::set_local_tls_got_offset): Removed.
14788         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14789         * output.cc (Output_data_got::add_global): Added got_type parameter.
14790         (Output_data_got::add_global_with_rel): Likewise.
14791         (Output_data_got::add_global_with_rela): Likewise.
14792         (Output_data_got::add_global_pair_with_rel): New function.
14793         (Output_data_got::add_global_pair_with_rela): New function.
14794         (Output_data_got::add_local): Added got_type parameter.
14795         (Output_data_got::add_local_with_rel): Likewise.
14796         (Output_data_got::add_local_with_rela): Likewise.
14797         (Output_data_got::add_local_pair_with_rel): New function.
14798         (Output_data_got::add_local_pair_with_rela): New function.
14799         (Output_data_got::add_global_tls): Removed.
14800         (Output_data_got::add_global_tls_with_rel): Removed.
14801         (Output_data_got::add_global_tls_with_rela): Removed.
14802         (Output_data_got::add_local_tls): Removed.
14803         (Output_data_got::add_local_tls_with_rel): Removed.
14804         (Output_data_got::add_local_tls_with_rela): Removed.
14805         * output.h (Output_data_got::add_global): Added got_type parameter.
14806         (Output_data_got::add_global_with_rel): Likewise.
14807         (Output_data_got::add_global_with_rela): Likewise.
14808         (Output_data_got::add_global_pair_with_rel): New function.
14809         (Output_data_got::add_global_pair_with_rela): New function.
14810         (Output_data_got::add_local): Added got_type parameter.
14811         (Output_data_got::add_local_with_rel): Likewise.
14812         (Output_data_got::add_local_with_rela): Likewise.
14813         (Output_data_got::add_local_pair_with_rel): New function.
14814         (Output_data_got::add_local_pair_with_rela): New function.
14815         (Output_data_got::add_global_tls): Removed.
14816         (Output_data_got::add_global_tls_with_rel): Removed.
14817         (Output_data_got::add_global_tls_with_rela): Removed.
14818         (Output_data_got::add_local_tls): Removed.
14819         (Output_data_got::add_local_tls_with_rel): Removed.
14820         (Output_data_got::add_local_tls_with_rela): Removed.
14821         * resolve.cc (Symbol::override_base_with_special): Removed
14822         reference to has_got_offset_ field.
14823         * symtab.cc (Symbol::init_fields): Replaced initialization
14824         of got_offset_ with got_offsets_.  Removed initialization
14825         of has_got_offset_
14826         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14827         (Symbol::got_offset): Likewise.
14828         (Symbol::set_got_offset): Likewise.
14829         (Symbol::has_tls_got_offset): Removed.
14830         (Symbol::tls_got_offset): Removed.
14831         (Symbol::set_tls_got_offset): Removed.
14832         (Symbol::got_offset_): Removed.
14833         (Symbol::tls_mod_got_offset_): Removed.
14834         (Symbol::tls_pair_got_offset_): Removed.
14835         (Symbol::got_offsets_): New field.
14836         (Symbol::has_got_offset): Removed.
14837         (Symbol::has_tls_mod_got_offset): Removed.
14838         (Symbol::has_tls_pair_got_offset): Removed.
14839         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14840         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14841         member functions.
14842         (Target_x86_64::Scan::global): Likewise.
14843         (Target_x86_64::Relocate::relocate): Likewise.
14844         (Target_x86_64::Relocate::relocate_tls): Likewise.
14845
14846 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14847
14848         * yyscript.y: Fix spelling error in comment.
14849
14850 2008-03-24  Ian Lance Taylor  <iant@google.com>
14851
14852         * options.h (class General_options): Define build_id option.
14853         * layout.h (class Layout): Declare write_build_id, create_note,
14854         create_build_id.  Add build_id_note_ member.
14855         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14856         "libiberty.h", "md5.h", "sha1.h".
14857         (Layout::Layout): Initialize eh_frame_data_,
14858         eh_frame_hdr_section_, and build_id_note_.
14859         (Layout::finalize): Call create_build_id.
14860         (Layout::create_note): New function, broken out of
14861         Layout::create_gold_note.
14862         (Layout::create_gold_note): Call create_note.
14863         (Layout::create_build_id): New function.
14864         (Layout::write_build_id): New function.
14865         (Close_task_runner::run): Call write_build_id.
14866
14867         * x86_64.cc: Correct license to GPLv3.
14868
14869 2008-03-23  Ian Lance Taylor  <iant@google.com>
14870
14871         * options.cc: Include "demangle.h".
14872         (parse_optional_string): New function.
14873         (parse_long_option): Handle takes_optional_argument.
14874         (parse_short_option): Update dash_z initializer.  Handle
14875         takes_optional_argument.
14876         (General_options::General_options): Initialize do_demangle_.
14877         (General_options::finalize): Set do_demangle_.  Handle demangling
14878         style.
14879         * options.h (parse_optional_string): Declare.
14880         (struct One_option): Add optional_arg field.  Update constructor.
14881         Update call constructor calls.  Add takes_optional_argument
14882         function.
14883         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14884         (DEFINE_optional_string): Define.
14885         (General_options::demangle): Change from DEFINE_bool to
14886         DEFINE_optional_string.
14887         (General_options::no_demangle): New function.
14888         (General_options::do_demangle): New function.
14889         (General_options::set_do_demangle): New function.
14890         (General_options::execstack_status_): Move definition to end of
14891         class definition.
14892         (General_options::static_): Likewise.
14893         (General_options::do_demangle_): New field.
14894         * object.cc (big_endian>::get_symbol_location_info): Call
14895         Options::do_demangle, not Options::demangle.
14896         * symtab.cc (demangle): Likewise.
14897
14898 2008-03-22  Ian Lance Taylor  <iant@google.com>
14899
14900         * gold.h: Include <cstddef> and <sys/types.h>
14901         * options.h: Include <cstring>.
14902
14903 2008-03-21  Ian Lance Taylor  <iant@google.com>
14904
14905         * Added source code to GNU binutils.
14906 \f
14907 Copyright (C) 2008-2013 Free Software Foundation, Inc.
14908
14909 Copying and distribution of this file, with or without modification,
14910 are permitted in any medium without royalty provided the copyright
14911 notice and this notice are preserved.
14912
14913 Local Variables:
14914 mode: change-log
14915 left-margin: 8
14916 fill-column: 74
14917 version-control: never
14918 End: